xxxxxxxxxx
26
let col = {r:0,g:0,b:0};
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){
col.r = map(i,0,9,50,255);
col.b = map(i,0,9,255,50);
fill(col.r,col.g,col.b);
} else {
fill(255);
}
rect(i * 1 / 10 * width, 0, width / 10, height);
}
}