Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. float angleX = 0;
  2. float angleY = 100;
  3. int counter = 1;
  4. void setup()
  5. {
  6. size(200, 200);
  7. background(0,0,0);
  8. }
  9.  
  10. void draw()
  11. {
  12.  
  13. if(counter > 0)
  14. {
  15. angleX++;
  16. }
  17. if(angleX == 146)
  18. {
  19. counter = counter*-1;
  20. }
  21. if(counter < 0)
  22. {
  23. angleX--;
  24. }
  25. if(angleX == -146)
  26. {
  27. counter = counter*-1;
  28. }
  29. pushMatrix();
  30. rotate(radians(45));
  31. translate(141,-50);
  32. pushMatrix();
  33. translate(0,int(angleX));
  34. rectAngleX(0,100,150,75,0);
  35. rectAngleX(0,-400,0,0,255);
  36. for (int i = 0; i < 288; i = i + 16)
  37. {
  38. lineValueXY(0,228-i,255,255,255);
  39. fill(255,255,255);
  40. text((i/16-9)*10,55,244-i+5);
  41. }
  42. text(90,55,-45+5);
  43. strokeWeight(1);
  44. stroke(255,255,255);
  45. line(-200,100,600,100);
  46. noStroke();
  47. popMatrix();
  48. rectAngleX(0,153,150,75,0);
  49. rectAngleX(0,-452,0,0,255);
  50. popMatrix();
  51. pushMatrix();
  52. rotate(radians(45));
  53. translate(20,-100);
  54. degrees();
  55. popMatrix();
  56. fill(255,255,255);
  57. pushMatrix();
  58. translate(100, 50);
  59. triangle(0, -35, -15, -20, 15, -20);
  60. popMatrix();
  61. noFill();
  62. lineAngleXY(0,100,255,255,0);
  63. triangleXY(0,100,255,255,0);
  64.  
  65. }
  66.  
  67. void rectAngleX(int x, int y,int r, int g, int b)
  68. {
  69. fill(r, g, b);
  70. pushMatrix();
  71. translate(x, y);
  72. rect(-200, 0, 600, 500);
  73. popMatrix();
  74. }
  75.  
  76. void lineAngleXY(int x, int y, int r, int g, int b)
  77. {
  78. strokeWeight(4);
  79. stroke(r, g, b);
  80. pushMatrix();
  81. translate(x, y);
  82. line(25,0,50,0);
  83. line(150,0,175,0);
  84. popMatrix();
  85. noStroke();
  86. }
  87.  
  88. void triangleXY(int x, int y, int r, int g, int b)
  89. {
  90. fill(r, g, b);
  91. pushMatrix();
  92. translate(x, y);
  93. triangle(101, 0, 70, 10, 45, 10);
  94. triangle(99, 0, 130, 10, 155, 10);
  95. popMatrix();
  96. }
  97.  
  98. void lineValueXY(int x, int y, int r, int g, int b)
  99. {
  100. strokeWeight(1);
  101. stroke(r, g, b);
  102. pushMatrix();
  103. translate(x, y);
  104. line(75,0,125,0);
  105. line(84,4,116,4);
  106. line(80,8,120,8);
  107. line(84,12,116,12);
  108. line(75,16,125,16);
  109. popMatrix();
  110. noStroke();
  111. }
  112. void degrees()
  113. {
  114. strokeWeight(2);
  115. stroke(255,255,255);
  116. noFill();
  117. arc(100, 50, 100,100,PI, TWO_PI);
  118. noStroke();
  119. ///
  120. pushMatrix();
  121. translate(100, 50);
  122. translate(32, -32);
  123. rotate(radians(-45));
  124. strokeWeight(2);
  125. stroke(255,255,255);
  126. line(0,0,10,0);
  127. noStroke();
  128. popMatrix();
  129. ///
  130. pushMatrix();
  131. translate(100, 50);
  132. strokeWeight(2);
  133. stroke(255,255,255);
  134. line(45,0,55,0);
  135. noStroke();
  136. popMatrix();
  137. ///
  138. pushMatrix();
  139. translate(100, 50);
  140. strokeWeight(2);
  141. stroke(255,255,255);
  142. line(0,-45,0,-55);
  143. noStroke();
  144. popMatrix();
  145. ///
  146. pushMatrix();
  147. translate(100, 50);
  148. translate(-32, -32);
  149. rotate(radians(45));
  150. strokeWeight(2);
  151. stroke(255,255,255);
  152. line(0,0,-10,0);
  153. noStroke();
  154. popMatrix();
  155. ///
  156. pushMatrix();
  157. translate(100, 50);
  158. strokeWeight(2);
  159. stroke(255,255,255);
  160. line(-45,0,-55,0);
  161. noStroke();
  162. popMatrix();
  163. ///
  164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement