xxxxxxxxxx
23
// map function of p5
// color = map(par,min1,max1,min2,max2);
// min1 - max1 is the range of the variable par
// and we want to map it to the range min2 - max2
let r = 100;
let g = 100;
let b = 100;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(r,g,b);
r = map(mouseX,0,400,0,255);
g = map(mouseX+mouseY,0,800,0,255);
b = map(mouseY,0,400,0,255);
fill(200,100,200);
circle(mouseX,mouseY,20);
}