xxxxxxxxxx
24
function setup() {
createCanvas(400, 400);
noStroke();
}
function draw() {
stroke(255,0,255);
background(220);
for (let i = 0; i < 10; i++) {
if (mouseX >= i * width / 10 && mouseX < (i + 1) * width / 10 && i%2==0) {
fill(0, 0, 255);
} else if(mouseX >= i * width / 10 && mouseX < (i + 1) * width / 10){
fill(255,0,0);
} else {
fill(255);
}
rect(i * 1 / 10 * width, 0, width / 10, height);
}
}