Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.pdf.*;
- //Rotation counter
- float c1 = 0;
- float c2 = 0;
- //Rotation incrementation
- float c1Inc = 0.00020;
- float c2Inc = c1Inc*600;
- //Radius of "circles"
- float r1 = 300;
- float r2 = 50;
- //lastLoc2 is used to draw the lines from the last frame
- //to the most current one.
- PVector loc1, loc2, lastLoc2;
- void setup() {
- size(800, 800, PDF, "out05.pdf");
- noFill();
- stroke(0);
- background(255);
- lastLoc2 = new PVector(0, 0);
- loc1 = new PVector(width/2+cos(c1)*r1, height/2+sin(c1)*r1); //Center for first circle
- loc2 = new PVector(loc1.x+cos(c2)*r2, loc1.y+sin(c2/1.01)*r2); //Center for second circle
- }
- void draw() {
- beginShape();
- curveVertex(loc2.x, loc2.y);
- while (c1 <= TWO_PI+c1Inc) {
- lastLoc2 = loc2.copy();
- loc1 = new PVector(width/2+cos(c1)*r1, height/2+sin(c1)*r1);
- loc2 = new PVector(loc1.x+cos(c2)*r2, loc1.y+sin(c2/1.01)*r2);
- c1 += c1Inc;
- c2 += c2Inc;
- curveVertex(loc2.x, loc2.y);
- }
- curveVertex(loc2.x, loc2.y);
- endShape();
- exit();
- }
Add Comment
Please, Sign In to add comment