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++) {
if (mouseX > (i - 1) * w && mouseX < i * w) {
fill(100, 255, i * 255/n);
} else {
noFill();
}
rect((i - 1) * w, 0, w, height);
}
}