/ Published in: Processing
This is an slightly more involved processing basic sketch I use when creating Imagery so I can save and output images at any point in time when the sketch is running.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import processing.pdf.*; boolean isMakingPdf = false; void setup(){ } void draw(){ if(isMakingPdf){ beginRecord(PDF, "frame-####.pdf"); } //draw stuff if(isMakingPdf){ endRecord(); isMakingPdf = false;// stop pdf creation after the frame ends } } void keyPressed(){ //save PDF when you hit the o key if(key == 'o'){ isMakingPdf = true; } //save jpg image when you hit the s key if(key == 's'){ saveFrame("frame-####.jpg"); } }