xxxxxxxxxx
36
function setup() {
createCanvas(400, 400);
}
//let i = 0;
function draw() {
background(220);
/*
ellipse(i, 200, 10, 10);
ellipse(i + 20, 200, 10, 10);
ellipse(i + 40, 200, 10, 10);
ellipse(i + 60, 200, 10, 10);
*/
// START: i = 0
// END: i = 400
// INCREMENT: i + 20
// START END INCREMENT
for (let i = 0; i < 400; i = i + 20) {
if (i % 80 == 0) { // % modulus, give the remainder of a division
fill(255, 0, 0);
} else {
fill(0, 0, 255);
}
ellipse(i, 50, 15, 15); // ellipses are horizontal
ellipse(100, i, 15, 15); // ellipses are vertical
} // end for loop
}