Created
January 14, 2014 15:50
-
-
Save benfarahmand/8420475 to your computer and use it in GitHub Desktop.
How to make a movie in processing
This file contains 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
boolean recording = false; | |
int counter = 0; | |
String[] myText = {"one"," ","two"," ","three"," ","four"," ","five"}; | |
PFont monospaced; | |
void setup(){ | |
monospaced = loadFont("Monospaced.plain-48.vlw"); | |
size(640,480); | |
frameRate(30); | |
textFont(monospaced,24); | |
textAlign(CENTER); | |
} | |
void draw() { | |
background(0); | |
fill(255); | |
if(counter < myText.length && counter >= 0) text(myText[counter],width/2,height/2); | |
if (recording) { | |
saveFrame("output/frames####.png"); | |
} | |
} | |
void keyPressed() { | |
if (key == 'r' || key == 'R') { | |
recording = !recording; | |
} | |
if ((key == 'n' || key == 'N') && counter < myText.length-1){ | |
counter++; | |
} | |
if ((key == 'p' || key == 'P') && counter > 0){ | |
counter--; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment