Chapter 7. Media

p5.js is capable of drawing more than simple lines and shapes. It’s time to learn how to create images and text in our programs to extend the visual possibilities to photography, detailed diagrams, and diverse typefaces.

Before we do that, we first need to talk a little bit about servers. Up to this point, we’ve just been viewing the index.html file directly in the browser. This works fine for things like running simple animations. However, if you want to do things like load an external image file into your sketch, you might find that your browser doesn’t allow this. If you look in the console, you may see an error containing the term cross-origin. For loading external files, you will need to run a server. A server is a program ...

Get Getting Started with p5.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.