Basics & Structure
Shapes & Canvas
Variables & Data
Logic & Loops
Composition & The Rule of Thirds
100

This built-in function runs only once when the program starts and is usually where you put createCanvas().

What is setup()?

100

The parameters (x, y, w, h) inside the ellipse() function stand for these four measurements.

What are x-position, y-position, width, and height?

100

Which keyword is used to create a variable in JavaScript?

Let

100

What statement allows a program to make decisions?

An if statement

100

The Rule of Thirds divides a canvas into this total number of equal rectangles using two horizontal and two vertical lines.

What is nine?

200

Unlike setup(), this function runs continuously in a cycle, allowing you to animate shapes across the screen.

What is draw()?

200

What are the coordinates of the top-left corner of the canvas?

(0,0)

200

What variable stores the mouse's x-position?

mouseX

200

What symbol checks if two values are equal?

==

200

Instead of placing your main focal point dead-center, the Rule of Thirds suggests placing it along the grid lines or on one of these four spots where lines cross.

What are intersections (or power points)?

300

In p5.js, the coordinate (0, 0) is located in this specific corner of the canvas.

What is the top-left corner?

300

Adding a fourth number to fill(255, 0, 0, 100) controls this visual property, also known as opacity.

What is alpha (or transparency)?

300

Calling random(10, 50) will return a number between 10 and 50, including decimals, unless you wrap it inside this rounding function.

What is floor() (or round() / int())?

300

What does a loop do?

Repeats code

300

In a 600-pixel-wide p5.js canvas, your two vertical Rule of Thirds grid lines should be drawn at these two x coordinates.

What are 200 and 400 (or width / 3 and (width / 3) * 2)?  

400

Using two forward slashes (//) allows you to leave these in your code, which the computer completely ignores when running the sketch.

What are comments?

400

What shape does ellipse(50, 50, 40, 40) create?

An oval

400

This control structure lets your code make a decision, running a block of code only when a specific condition inside parentheses is true.

What is an if statement (or conditional)?

400

What happens when an if statement's condition is true?

The code inside the if statement runs.

400

When coding a landscape in p5.js, placing the horizon line along the bottom third line gives visual emphasis to this part of the scene.

What is the sky?

500

If you want a shape to have an outline, you use stroke(), but if you want to remove the outline completely, you call this function.

What is noStroke()?

500

This function requires six numbers—representing three pairs of (x, y) coordinates—to draw a three-sided polygon.

What is triangle()?

500

To make a variable named x increase by 5 every single frame, you can write x = x + 5; or use this shorter compound assignment operator.

What is x += 5;?

500

Give an example of when you might use a loop in animation.

To continuously move an object across the screen.

500

Using dynamic math like width / 3 instead of a hard-coded number ensures your composition stays accurate even if you change this function's arguments.

What is createCanvas()?

M
e
n
u