xxxxxxxxxx
17
//map(variable, min orig, max orig, min desired, max desired)
let col = 0;
let r= 0, g = 0, b = 255;
function setup() {
createCanvas(400, 400);
}
function draw() {
//amt of red changes as mouse moves left and right
r = map(mouseX, 0, 400, 0, 255);
//we can also invert the range
b = map(mouseY, 0, 400, 255, 0);
background(r, 0, b);
circle(mouseX, mouseY, 24);
}