Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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