Skip to content

Instantly share code, notes, and snippets.

@benfarahmand
Created January 14, 2014 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benfarahmand/8420475 to your computer and use it in GitHub Desktop.
Save benfarahmand/8420475 to your computer and use it in GitHub Desktop.
How to make a movie in processing
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