xxxxxxxxxx
26
let cols = 20;
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(220);
fill(255);
for (let i=0; i < cols; i++){
if (mouseX > width/cols*i && mouseX < width/cols*(i+1)){
if (mouseX > width/2){
fill(255,0,0);
} else fill(0,0,255);
if (mouseX > width/cols*6 && mouseX < width/cols*7) fill(255);
rect(width/cols*i, 0, width/cols, height);
} else {
fill(255);
rect(width/cols*i, 0, width/cols, height);
}
}
}