Created
March 23, 2017 16:00
-
-
Save slambert/810c775126b775e3e49b965821ff563f to your computer and use it in GitHub Desktop.
set a time and see red flash 5 seconds later.
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
// Time Demo | |
// set a time and see red flash 5 seconds later. | |
// v 0.2 | |
// Includes text on screen | |
// Steve is the best | |
// It seems he can do anything. | |
// March 23, 2017 | |
int startTime = 0; | |
int currentTime = 0; | |
int endTime = 15000; | |
void setup() { | |
size(250, 250); | |
} | |
void draw() { | |
background(25); | |
println("startTime: "+startTime); | |
println("currentTime: "+currentTime); | |
println("endTime: "+endTime); | |
currentTime = millis(); | |
if (currentTime >= endTime){ // if we get to the endTime.... | |
startTime = currentTime; // it resets itself!! | |
endTime = currentTime + 5000; // another 5 seconds | |
background(255,0,0); | |
} | |
text("CURRENT TIME: " + (currentTime/1000), (width/5*1), height/2-15); | |
text("START TIME: " + (startTime/1000), (width/5*1), height/2); | |
text("END TIME: " + (endTime/1000), (width/5*1), height/2+15); | |
} | |
void keyPressed() { | |
if(key == 'r'){ | |
// println("millis: "+millis()); // show me the time! | |
startTime = currentTime; | |
endTime = currentTime + 5000; // another 5 seconds | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment