xxxxxxxxxx
25
// coding train p5 tutoruals for using the map () func
//the map function is a general function taht will take any range and MAP
// a value inside that range to a new value in any other range
var col= 0;
var r = 0;
var g =0;
var b= 0;
function setup() {
createCanvas(600, 400);
}
function draw() {
r= map(mouseX, 0, 600, 255, 0);
g= map(mouseY, 0, 400, 0, 255);
b= map(mouseX, 0, 600, 0, 255);
background(b,g,100);
fill (g,134,r);
ellipse (mouseX, mouseY, 64,64);
//mouseX goes inbetween a range of 0 and the width
// so when you move mouse X thats why the value of the color changes
}