Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. void setup() {
  2. size(400,400);
  3. background(0);
  4. noLoop();
  5. }
  6.  
  7. //radii of the circles
  8. float r1=200;
  9. float r2=r1*3/8;
  10. float r3=r2*3/8;
  11. float r4=r3*3/8;
  12. float r5=r4*3/8;
  13.  
  14. int i=0;
  15.  
  16. //rotations of the circles
  17. float rot1;
  18. float rot2;
  19. float rot3;
  20. float rot4;
  21.  
  22. void draw() {
  23. //background(255,0,0);
  24. noStroke();
  25. //stroke(0);
  26. noFill();
  27. translate(200,200);
  28. rot1=i--*PI/300;
  29. rotate(rot1);
  30. ellipse(0,0,2*r1,2*r1);
  31.  
  32. //circle
  33. pushMatrix();
  34. translate(0,-r1+r2);
  35. noStroke();
  36. //stroke(0);
  37. ellipse(0,0,2*r2,2*r2);
  38. stroke(255,0,0);
  39. point(0,0);
  40. rotate(-rot1);
  41. rot2=rot1*3;
  42. rotate(-rot2);
  43.  
  44. //circle
  45. pushMatrix();
  46. translate(0,-r2+r3);
  47. noStroke();
  48. //stroke(0);
  49. ellipse(0,0,2*r3,2*r3);
  50. stroke(0,255,0);
  51. point(0,0);
  52. rotate(rot2);
  53. rot3=rot2*3;
  54. rotate(rot3);
  55.  
  56. //circle
  57. pushMatrix();
  58. translate(0,-r3+r4);
  59. noStroke();
  60. //stroke(0);
  61. ellipse(0,0,2*r4,2*r4);
  62. stroke(0,0,255);
  63. point(0,0);
  64. rotate(-rot3);
  65. rot4=rot3*4;
  66. rotate(-rot4);
  67.  
  68. //circle
  69. pushMatrix();
  70. translate(0,-r4+r5);
  71. noStroke();
  72. //stroke(0);
  73. ellipse(0,0,2*r5,2*r5);
  74. stroke(255,255,0);
  75. point(0,0);
  76. popMatrix();
  77.  
  78. popMatrix();
  79.  
  80. popMatrix();
  81.  
  82. popMatrix();
  83. }
  84.  
  85. //press to start animation
  86. void mousePressed() {
  87. loop();
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement