xxxxxxxxxx
39
var x= 0;
var r= 0;
var g= 0;
var b = 0;
function setup() {
createCanvas(600, 400);
}
function draw() {
r= map(x, 0, 600, 100,255);
g= map(x, 0, 600, 0, 100);
b= map(x, 0, 600, 0, 255);
a= (10);
background(g,r,b,a);
strokeWeight(5);
stroke(b*2,r,g*2);
fill(r,g,b);
ellipse(x, height/2, 30,30);
x = x+1;
if (x>200){
rectMode(CENTER);
rect(x,height/2,x-199,x-199);
}
if(x>300){
fill(125,255,100);
rect(x, height/2,x/5,x/5);
}
}
function mousePressed(){
x=0;
}
// use a conditional to make the colors change everytime you press
//the mouse?