xxxxxxxxxx
24
var c1 = 0;
var c2 = 255
function setup() {
createCanvas(displayWidth*1.5, displayHeight *1.5).mouseMoved(changeColor);
noStroke();
}
function draw() {
background(0);
fill(c1);
rect(0, 0, width / 2, height);
fill(c2);
rect(width / 2, 0, width / 2, height);
}
function changeColor() {
console.log(mouseX);
if (mouseX < width / 2)
c1 = map(mouseX, 0, width / 2, 0, 255);
else
c2 = map(mouseX, width / 2, width, 0, 255);
}