xxxxxxxxxx
20
let n = 10;
let w;
function setup() {
createCanvas(600, 600);
w = width / n;
}
function draw() {
background(20);
noStroke();
for (i = 1; i <= n; i += 2) {
if (mouseX > (i - 1) * w && mouseX < i * w) {
fill(50, 0, 255);
} else {
noFill();
}
rect((i - 1) * w, 0, w, height);
}
}