xxxxxxxxxx
25
function setup() {
createCanvas(400, 400);
}
function draw() {
colWidth = width / 20;
background(220);
// fill('red');
for (var c = 0; c < 20; c++) {
x = colWidth * c;
if (mouseX > x && mouseX < x + colWidth && c <= 9) {
fill('red');
rect(c * colWidth, 0, colWidth, height);
} else if (mouseX > x && mouseX < x + colWidth && c > 9) {
fill('blue');
rect(c * colWidth, 0, colWidth, height);
}
}
}