Guest User

Untitled

a guest
Nov 15th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. void setup() {
  2. size(640, 360);
  3. }
  4.  
  5. void draw() {
  6. background(260);
  7.  
  8.  
  9. pushMatrix();
  10. translate(width*0.2, height*0.5);
  11. rotate(frameCount / 20.0);
  12. star(0, 100, 15, 240, 3);
  13. popMatrix();
  14. fill(20, 130, 200);
  15.  
  16. pushMatrix();
  17. translate(width*0.7, height*0.5);
  18. rotate(frameCount / 45.0);
  19. star(0, 200, 80, 100, 40);
  20. popMatrix();
  21. fill(260, 30, 45);
  22.  
  23. pushMatrix();
  24. translate(width*0.7, height*0.5);
  25. rotate(frameCount / 40.0);
  26. star(0, 200, 80, 100, 40);
  27. popMatrix();
  28. fill(260, 30, 260);
  29.  
  30. pushMatrix();
  31. translate(width*0.7, height*0.5);
  32. rotate(frameCount / 35.0);
  33. star(0, 200, 80, 100, 40);
  34. popMatrix();
  35. fill(26, 260, 255);
  36.  
  37. pushMatrix();
  38. translate(width*0.7, height*0.5);
  39. rotate(frameCount / 30.0);
  40. star(0, 200, 80, 100, 40);
  41. popMatrix();
  42. fill(260, 150, 45);
  43.  
  44. pushMatrix();
  45. translate(width*0.7, height*0.5);
  46. rotate(frameCount / 25.0);
  47. star(0, 200, 80, 100, 40);
  48. popMatrix();
  49. fill(260, 30, 45);
  50.  
  51. pushMatrix();
  52. translate(width*0.7, height*0.5);
  53. rotate(frameCount / 20.0);
  54. star(0, 200, 80, 100, 40);
  55. popMatrix();
  56. fill(260, 260, 45);
  57.  
  58.  
  59. pushMatrix();
  60. translate(width*0.7, height*0.5);
  61. rotate(frameCount / 15.0);
  62. star(0, 200, 80, 100, 40);
  63. popMatrix();
  64. fill(260, 30, 45);
  65.  
  66. pushMatrix();
  67. translate(width*0.7, height*0.5);
  68. rotate(frameCount / 14.0);
  69. star(0, 200, 80, 100, 40);
  70. popMatrix();
  71. fill(150, 260, 45);
  72.  
  73. pushMatrix();
  74. translate(width*0.7, height*0.5);
  75. rotate(frameCount / 10.0);
  76. star(0, 200, 80, 100, 40);
  77. popMatrix();
  78. fill(260, 0, 0);
  79.  
  80. pushMatrix();
  81. translate(width*0.7, height*0.5);
  82. rotate(frameCount / 12.0);
  83. star(0, 200, 80, 100, 40);
  84. popMatrix();
  85. fill(260, 150, 0);
  86.  
  87. pushMatrix();
  88. translate(width*0.8, height*0.5);
  89. rotate(frameCount / -30.0);
  90. star(0, 20, 30, 120, 5);
  91. popMatrix();
  92. fill(150, 26, 260);
  93.  
  94.  
  95. }
  96.  
  97. void star(float x, float y, float radius1, float radius2, int npoints) {
  98. float angle = TWO_PI / npoints;
  99. float halfAngle = angle/2.0;
  100. beginShape();
  101. for (float a = 0; a < TWO_PI; a += angle) {
  102. float sx = x + cos(a) * radius2;
  103. float sy = y + sin(a) * radius2;
  104. vertex(sx, sy);
  105. sx = x + cos(a+halfAngle) * radius1;
  106. sy = y + sin(a+halfAngle) * radius1;
  107. vertex(sx, sy);
  108. }
  109. endShape(CLOSE);
  110. }
Add Comment
Please, Sign In to add comment