Something is up with my attempt at rendering this sketch as a PDF. In the PDF render the ellipses are misaligned. The drawing outputs perfectly to the screen. Any help would be appreciated (trying to output for printing).
On screen render:
PDF render:
- import processing.pdf.*;
- boolean record = true;
- PGraphics pdf;
- int d = 300;
- int r = 300;
- float z = random(1, 5);
- float rand;
- int stepX = 15;
- int stepY = 15;
- color[] palette = {
- #556270, #4ECDC4, #C7F464, #FF6B6B, #C44D58
- };
- void setup(){
- //background (palette[(int)random(1, 5)]);
- size(960, 645);
- ellipseMode(CORNER);
- smooth();
- pdf = (PGraphics) createGraphics((width), (height), PDF, "frame.pdf");
- noLoop();
- }
- void draw(){
- if(record){
- beginRecord(pdf);
- println("Recording started.");
- record = true;
- }
- float n = noise(d)*d;
- noiseSeed(0);
- noStroke();
- background (#556270);
- for (int y = stepY; y < height +d; y += d + stepY){
- for (int x = stepX; x < width; x += d + stepX){
- drawCircle(x, y, d);
- }
- }
- if(record){
- endRecord();
- println("Recording stopped.");
- record = false;
- }
- }
- void drawCircle(float x, float y, float d){
- //noFill();
- noStroke();
- fill(palette[(int)random(0, 5)]);
- ellipse(x, y, d, d);
- if(d > 2){
- drawCircle(x, y, d/1.5);
- }
- }