Guest User

Untitled

a guest
Jun 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import processing.pdf.*;
  2.  
  3. //Rotation counter
  4. float c1 = 0;
  5. float c2 = 0;
  6.  
  7. //Rotation incrementation
  8. float c1Inc = 0.00020;
  9. float c2Inc = c1Inc*600;
  10.  
  11. //Radius of "circles"
  12. float r1 = 300;
  13. float r2 = 50;
  14.  
  15. //lastLoc2 is used to draw the lines from the last frame
  16. //to the most current one.
  17. PVector loc1, loc2, lastLoc2;
  18.  
  19. void setup() {
  20. size(800, 800, PDF, "out05.pdf");
  21. noFill();
  22. stroke(0);
  23. background(255);
  24.  
  25. lastLoc2 = new PVector(0, 0);
  26. loc1 = new PVector(width/2+cos(c1)*r1, height/2+sin(c1)*r1); //Center for first circle
  27. loc2 = new PVector(loc1.x+cos(c2)*r2, loc1.y+sin(c2/1.01)*r2); //Center for second circle
  28. }
  29.  
  30. void draw() {
  31. beginShape();
  32. curveVertex(loc2.x, loc2.y);
  33. while (c1 <= TWO_PI+c1Inc) {
  34. lastLoc2 = loc2.copy();
  35.  
  36. loc1 = new PVector(width/2+cos(c1)*r1, height/2+sin(c1)*r1);
  37. loc2 = new PVector(loc1.x+cos(c2)*r2, loc1.y+sin(c2/1.01)*r2);
  38.  
  39. c1 += c1Inc;
  40. c2 += c2Inc;
  41.  
  42. curveVertex(loc2.x, loc2.y);
  43. }
  44. curveVertex(loc2.x, loc2.y);
  45. endShape();
  46.  
  47. exit();
  48. }
Add Comment
Please, Sign In to add comment