xxxxxxxxxx
22
let num = 10;
let w = 20;
let h = 20;
function setup() {
createCanvas(400, 400);
frameRate(10);
rectMode(CENTER);
}
function draw() {
background(random(40,80));
// do this 10 times
for (let y = h; y < height ; y = y + height/num) {
for (let x = w; x < width; x = x + width/num) {
fill(255,0,0,random(255));
rect(x, y, w, h);
}
}
}