color fromColor,toColor,newBackColor;
void setup(){
size(900,700); //Set canvas size
fromColor = color(119, 242, 232);
toColor = color(105, 79, 255);
}
void draw(){
background(newBackColor);
float val = map(mouseX,0,width,0,1);
newBackColor = lerpColor(fromColor, toColor, val);
println(val);
}
1 Like