xxxxxxxxxx
28
let w;
let numCols=10;
function setup() {
createCanvas(400, 400);
w=width/numCols;
}
function draw() {
background(220);
for(let x=0;x<width;x+=w){
console.log(w);
if(mouseX>x && mouseX<x+w)
fill('red');
else
fill('white')
rect(x,0,w,height);
rect(x,0,w,height);
}
for(let x=0;x<width;x+=w){
console.log(x);
if(x/w==6)
fill ('blue')
else fill('white')
rect(x,0,w,height);
}
}