Chapter 3. Draw

At first, drawing on a computer screen is like working on graph paper. It starts as a careful technical procedure, but as new concepts are introduced, drawing simple shapes with software expands into animation and interaction. Before we make this jump, we need to start at the beginning.

A computer screen is a grid of light elements called pixels. Each pixel has a position within the grid defined by coordinates. When you create a p5.js sketch, you view it with a web browser. Within the window of the browser, p5.js creates a drawing canvas, an area in which graphics are drawn. The canvas may be the same size as the window, or it may have different dimensions. The canvas is usually positioned at the top left of your window, but ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.