xxxxxxxxxx
32
let w
let h
function setup() {
createCanvas(500, 500);
w = width/10
h = height/10
}
function draw() {
background(220);
fill(255)
for (let x = 0; x < width; x += w) {
for (let y = 0; y < height; y += h) {
if (mouseX > x && mouseX < x + w && mouseY > y && mouseY < y + h) {
fill(255, 0, 0)
} else {
fill(255);
}
rect(x, y, w, h);
}
}
}