I am doing a Roll Over Animation.
How will I revert back the color to its original after if fades away when the mouse cursor comes back to the tile?
in my code, the color fades to white then does not come back when I bring back the cursor to the tile
float addColorValue;
boolean clicked = false;
void setup() {
size(400,400); //pixel size of the program
}
void draw() {
background(255); //setting up the white background
line(width/2,height,width/2,0); //drawing the vertical line
line(width,height/2,0,width/2); //drawing the horizontal line
if(clicked){
if(mouseX > 200 && mouseY > 200){ // draws the 4th quadrant
fill(255,255,addColorValue+=1); rect(200,200,200,200); //draws rectangle
fill(255); textSize(50); text("4TH", 250, 300); //display which number of the quadrant
}
//draws the 3rd quadrant
else if(mouseX > 0 && mouseY > 200){
fill(addColorValue+=1,addColorValue+=1,255); rect(0,200,200,200);
fill(255); textSize(50); text("3RD", 50, 300);
}
//draws the 2nd quadrant
else if(mouseX > 200 && mouseY > 0){
fill(addColorValue+=1,255,addColorValue+=1); rect(200,0,200,200);
fill(255); textSize(50); text("2ND", 250, 100);
}
//draws the 1st quadrant
else if(mouseX > 0 && mouseY > 0){
fill(255,addColorValue+=1,addColorValue+=1); rect(0,0,200,200);
fill(255); textSize(50); text("1ST", 50, 100);
}
}
else{
background(0);
}
}
//switches on and off the lights of the program
void mousePressed() {
clicked = !clicked;
}