Last active
March 28, 2018 14:56
-
-
Save brendandawes/4f7ed0305b1602d23e33e0fde5c08094 to your computer and use it in GitHub Desktop.
This is the boiler plate template I have setup each time I start a new Processing project. It includes my Dawesome Toolkit library as well as basic stuff for saving .png and .pdf files and exporting frames that you can compile into video. If you're a Vim user you can set this up to automatically be populated when you create a blank .pde file - t…
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
import dawesometoolkit.*; | |
import processing.pdf.*; | |
final String PROJECT = "project-x"; | |
final int BACKGROUND_COLOR = #000000; | |
final int SECONDS_TO_CAPTURE = 60; | |
final int VIDEO_FRAME_RATE = 60; | |
int videoFramesCaptured = 0; | |
boolean recordVideo = false; | |
boolean recordPDF = false; | |
DawesomeToolkit dawesome; //http://cloud.brendandawes.com/dawesometoolkit/ | |
void setup(){ | |
size(640,640); | |
dawesome = new DawesomeToolkit(this); | |
dawesome.enableLazySave('s',".png"); | |
} | |
void draw(){ | |
background(BACKGROUND_COLOR); | |
if(recordPDF){ | |
beginRecord(PDF,"####-"+PROJECT+".pdf"); | |
} | |
if (recordVideo){ | |
saveFrame("export/####-frame.tga"); | |
if (videoFramesCaptured > VIDEO_FRAME_RATE * SECONDS_TO_CAPTURE){ | |
recordVideo = false; | |
videoFramesCaptured = 0; | |
} | |
videoFramesCaptured ++; | |
} | |
if (recordPDF){ | |
endRecord(); | |
recordPDF = false; | |
} | |
} | |
void keyReleased() { | |
if (key == 'p') { | |
recordPDF = true; | |
} | |
if (key == 'r') { | |
recordVideo = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment