Trying to export multiple PDF-files; No Sketch-Canvas!

edited July 2015 in Library Questions

Hey Coders!

I'm trying to export one PDF every frame but i get some problems with this code:

  1. When running the code, no sketch-canvas opens
  2. It ony saves one PDF-file

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

Sign In or Register to comment.