Created
November 30, 2015 23:15
-
-
Save takawo/10a2521df8766557a828 to your computer and use it in GitHub Desktop.
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
import processing.pdf.*; | |
import java.util.Calendar; | |
boolean savePDF = false; | |
void setup() { | |
size(500, 500); | |
colorMode(HSB, 360, 100, 100); | |
} | |
void draw() { | |
if (savePDF) beginRecord(PDF, timestamp()+".pdf"); | |
if (savePDF) { | |
savePDF = false; | |
endRecord(); | |
} | |
} | |
void keyPressed() { | |
if (key=='s' || key=='S') saveFrame(timestamp()+"_##.png"); | |
if (key=='p' || key=='P') savePDF = true; | |
} | |
String timestamp() { | |
Calendar now = Calendar.getInstance(); | |
return String.format("%1$ty%1$tm%1$td_%1$tH%1$tM%1$tS", now); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment