/**
* Alternating backgrounds.
*
*
Elie Zananiri
* CART 253, Winter 2008
*/
void setup() {
size(300, 300);
frameRate(5);
smooth();
noStroke();
}
void draw() {
// if the frame count ends with 0...
if (frameCount%10 == 0) {
// ...draw a yellow background
background(240, 229, 17);
// if the frame count is even and the mouse is on the left side...
} else if ((frameCount%2 == 0) && (mouseX < width/2)) {
// ...draw a red background
background(216, 35, 35);
} else {
// draw a blue background
background(35, 103, 216);
}
}