Created
August 3, 2015 19:21
-
-
Save REAS/b08298448524c4d437a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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