Skip to content

Instantly share code, notes, and snippets.

@REAS
Created August 3, 2015 19:21
Show Gist options
  • Save REAS/b08298448524c4d437a4 to your computer and use it in GitHub Desktop.
Save REAS/b08298448524c4d437a4 to your computer and use it in GitHub Desktop.
import processing.pdf.*;
boolean recordFrame = false;
float x;
float diameter;
void setup() {
size(400, 600);
x = random(0, width);
diameter = random(10, 30);
}
void draw() {
if (recordFrame == true) {
beginRecord(PDF, "FourCircles-" + nf(frameCount, 3) + ".pdf");
}
background(204);
fill(0);
ellipse(x, 300, diameter, diameter);
ellipse(x, 320, diameter, diameter);
ellipse(x, 340, diameter, diameter);
ellipse(x, 360, diameter, diameter);
if (recordFrame == true) {
endRecord();
recordFrame = false;
}
}
void keyPressed() {
if (key == ' ') {
x = random(0, width);
diameter = random(10, 30);
}
if (key == 'r' || key == 'R') {
recordFrame = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment