xxxxxxxxxx
/*-----------------------------
Color Buttons
Click on the buttons to change their color
Created 1-30-17
Renee Cheng
cheng.835
Modified 1-31-17
project URL
-----------------------------*/
//center X and Y variables for positioning the rectangles
int centerX=250;
int centerY=250;
//color variables that are to be changed if the buttons are pressed
int color1=60;
int color2=80;
void setup(){
size (500,500);
background(0);
}
void draw(){
if (mousePressed){
if((mouseX >200) && (mouseX < 250)){
if((mouseY>200) && (mouseY <250)){
//change color variable
color1=200;
}
}
if((mouseX>250)&&(mouseX<300)){
if((mouseY>200) && (mouseY <250)){
//change other color variable
color2=160;
}
}
}
else{
color1=60;
color2=80;
}
fill(color1, 120, 75);
rect(centerX-50,centerY-50,50,50);
fill(130, 30, color2);
rect(centerX,centerY-50,50,50);
}