Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. int angle = 0;
  2. void setup() {
  3. size (1200, 1200);
  4. pixelDensity(1);
  5. frameRate(60);
  6. background (0);
  7. smooth();
  8.  
  9. for (int i=0; i<100; i++){
  10. float c = random (100,255);
  11. float t = random(100, 255);
  12. fill(c,t);
  13. float x= random (0, width);
  14. float y= random (0, height);
  15. float s = random(1, 10);
  16. ellipse (x, y, s, s);
  17. }
  18. // rectMode(CENTER);
  19. }
  20. void draw () {
  21.  
  22.  
  23. pushMatrix();
  24. translate (mouseX, mouseY);
  25. rotate(radians( angle ));
  26.  
  27. drawCube ();
  28.  
  29.  
  30.  
  31. popMatrix();
  32. drawStars(0, 0, 255);
  33.  
  34.  
  35.  
  36.  
  37. angle = angle + 1;
  38.  
  39.  
  40.  
  41.  
  42. // drawCube ();
  43. }
  44.  
  45. void drawCube () {
  46. fill (240);
  47.  
  48. rect (100, 50, 300, 300);
  49.  
  50. fill( 200);
  51.  
  52. rect (125, 75, 250, 250);
  53.  
  54. fill (150);
  55.  
  56. rect (150, 100, 200, 200);
  57.  
  58. fill (100);
  59.  
  60. rect ( 175, 125, 150, 150);
  61.  
  62. fill (75);
  63.  
  64. rect (200, 150, 100, 100);
  65.  
  66. fill (50);
  67.  
  68. rect (225, 175, 50, 50);
  69.  
  70. line( 100, 50, 50, 100);
  71.  
  72. line(50, 100, 50, 400);
  73.  
  74. line(50, 400, 350, 400);
  75.  
  76. line (350, 400, 350, 100);
  77.  
  78. line(350, 100, 50, 100);
  79.  
  80. line (350, 100, 400, 50);
  81.  
  82. line (350, 400, 400, 350);
  83.  
  84. line (50, 400, 100, 350);
  85.  
  86. fill(150);
  87.  
  88. quad (100, 50, 50, 100, 50, 400, 100, 350);
  89.  
  90. fill (100);
  91.  
  92. quad(100, 350, 50, 400, 350, 400, 400, 350);
  93.  
  94. fill (50);
  95.  
  96. quad (100, 360, 75, 390, 350, 390, 375, 360);
  97.  
  98. fill (120);
  99.  
  100. quad ( 100, 370, 90, 380, 345, 380, 355, 370);
  101.  
  102. fill (90);
  103.  
  104. quad (90, 70, 60, 100, 60, 375, 90, 345);
  105.  
  106. fill(30);
  107.  
  108. quad (80, 95, 70, 110, 70, 325, 80, 310);
  109. }
  110.  
  111. void drawStars( int x, int y, color c ) {
  112. pushMatrix();
  113. translate(x, y);
  114. fill(c);
  115. beginShape();
  116.  
  117. ellipse( 50,50, 10,10);
  118.  
  119. endShape();
  120. popMatrix();
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement