We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey Coders!
I'm trying to export one PDF every frame but i get some problems with this code:
What do i do wrong?
Thank you very much for helping me!
import processing.pdf.*;
// Farben
color s = #000000;
color w = #ffffff;
color b = #0000ff;
void setup(){
size(600,400, PDF, "hey.pdf");
background(w);
}
void draw(){
background(w);
fill(s);
noStroke();
translate(width/2, height/2);
// rotate
rotate(radians(mouseX));
rectMode(CENTER);
rect(0,0, 200, 200);
fill(b);
// Der folgende rotate-Befehl wird
// auf denn oben
rotate(radians(mouseX));
rect(0,0, mouseX, 100);
PGraphicsPDF pdf = (PGraphicsPDF) g; // Get the renderer
pdf.nextPage(); // Tell it to go to the next page
}
Answers
i think you need the "Single Frame from an Animation (With Screen Display)" methodology from here:
https://processing.org/reference/libraries/pdf/index.html
specifically the
beginRecord(PDF, "frame-####.pdf");
part will create multiple documents whereas specifying the filename in size() limits you to a single file.Perfect! Thank you koogs!!!