Last active
July 17, 2019 15:57
-
-
Save slambert/a219f919793cbf9b1288a2508261fd9b to your computer and use it in GitHub Desktop.
use "states" to change background based on time passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Far out light show | |
//Steve Lambert September 20, 2016 v1 | |
// July 17, 2019 v1.1 | |
// declare int variable | |
int state = 0; | |
void setup(){ | |
size(500,500); | |
background(0); | |
} | |
void draw(){ | |
println("frame: " + frameCount); | |
if (frameCount <= 300){ | |
state = 0; | |
} // if | |
if (frameCount >= 301 && frameCount <= 600){ | |
state = 1; | |
} | |
if (frameCount >= 601 && frameCount <= 900){ | |
state = 2; | |
} | |
if (state == 0){ | |
background(0); | |
} // if | |
if (state == 1){ | |
background(255,0,0); | |
} // if | |
if (state == 2){ | |
background(0,0,255); | |
ellipse(50,50,(width/2),height/2); | |
} // if | |
println("state: " + state); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment