Editor Link: https://editor.p5js.org/arshia.lodhi/sketches/pHwL1Mxtq

Example 1:

Q1. Why does the color keep changing?

The color keeps changing in the code because of the function code fill:

function draw() { fill(random(255), random(255), random(255)); ellipse(width/2, height/2, 50, 50) }

Since the fill code is under the loop function, it adds random colors within the same size and location of the circle.

Q2. What do the setup() and draw() functions do?

The setup() and draw() function starts the initial step of creating the workspace where your drawings/sketches will be made. You can set size and add color fills.

Untitled

Example 2:

Untitled

Example 3:

Untitled