xxxxxxxxxx
39
/*
Assumptions about counting:
- Changing by 1
- Starting point (Started at 1, default)
- Stopping point
- Direction of counting (counting up, default)
- Speed of counting
*/
let x,y;
let r,g,b;
function setup() {
createCanvas(400, 400);
background(220);
// Parts of for loop
// 1. Starting point
// 2. Stopping point
// 3. Amount of change (positive or negative)
for (let counter = 0; counter < 10; counter += 1) {
// code to repeat
// console.log(counter)
//for 100 squares instead of 10
//for (let counter = 0; counter < 100; counter += 1)
x = int(random(0, 350));
y = int(random(0, 350));
square(x,y,50);
r = random(0,255);
g = random(0,255);
b = random(0,255);
fill(r,g,b);
}
}