We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Can you please help me. I am trying to control where I begin and end recording of a multiple frame (into one file) PDF in order to capture a segment of the animation. Currently the recording starts automatically once the animation starts playing - I want to be able to control this "in point", presumably with pressing a key e.g. "s". I can stop the animation, all ok, and it writes the pdf; I just need to able to control when I start it. Any help appreciated!
import processing.pdf.*;
ArrayList<Snake>snake;
float x,y;
float t;
float count = 0;
int delay = 0;
void setup(){
beginRecord(PDF, "everything.pdf");
size(500,500);
smooth();
snake = new ArrayList<Snake>();
noStroke();
}
void draw(){
background(6,7,175);
translate(width/2, height/2);
delay++;
if(delay>=5){
count++;
delay = 0;
if(count<=80){
snake.add(new Snake(count));
}
}
for(Snake s : snake){
s.update();
s.display();
}
}
void keyPressed() {
if (key == 'q') {
endRecord();
exit();
}
}
Answers
Check this demo. Also older posts and they might work in your case:
https://forum.processing.org/two/discussion/1013/pdf-export
https://forum.processing.org/one/topic/multiple-pages-pdf-generation-error.html
https://processing.org/discourse/beta/num_1232303708.html
Kf
kfrajer, you are a super star - thank you so much for resolving this!!