Last active
October 27, 2015 16:07
-
-
Save slambert/b7bc8311c56f3ed6419f to your computer and use it in GitHub Desktop.
Sample for class of a time based slideshow
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
/* Slideshow Sketch | |
Steve Lambert October 27, 2015 | |
v.01 | |
Note: Add your own images in a data folder to make it work | |
*/ | |
float time; | |
float currentTime; | |
PImage acapulco; | |
PImage acapulco2; | |
PImage tape; | |
void setup(){ | |
size(720,480); | |
acapulco = loadImage("acapulco.png"); // Load the image into the program | |
acapulco2 = loadImage("acapulco2.png"); | |
tape = loadImage("tape.png"); | |
time = 0; | |
} // end setup | |
void draw(){ | |
currentTime = millis() - time; // what it the current time? | |
println("currentTime = " + currentTime/1000); | |
println("millis = " + millis()); | |
println("time = " + time); | |
if (currentTime > 0 && currentTime < 1000){ | |
image(acapulco, 0 , 0, 720, 480); | |
} | |
if (currentTime > 1001 && currentTime < 2000){ | |
image(acapulco2, 0 , 0, 720, 480); | |
} | |
if (currentTime > 2001 && currentTime < 3000){ | |
image(tape, 0 , 0, 720, 480); | |
} | |
if (currentTime > 3001){ | |
time = millis(); | |
} | |
} // end draw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment