Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.26 KB | None | 0 0
  1. // This calls the drawTree function, the major function of it all
  2. drawTree();
  3.  
  4.  
  5.  
  6. //
  7. function drawTree() {
  8. // Draws the stump of the tree
  9. drawStump();
  10. drawStump2();
  11. // This adds detail to the stump of the tree (bumps)
  12. drawBump();
  13. drawBump2();
  14. // Draws the multiple branches of the tree
  15. drawLeftBranch();
  16. drawRightBranch();
  17. // Draws the cherryblossom leaves
  18. drawLeftLeaves();
  19. drawRightLeaves();
  20. // Drawing stump command
  21. }
  22.  
  23.  
  24. // Stump of the left tree
  25. function drawStump() {
  26. penUp();
  27. moveTo(-10, 455);
  28. penColor("#3F250B");
  29. penWidth(80);
  30. penDown();
  31. moveForward(175);
  32. turnRight(90);
  33. penWidth(30);
  34. turnTo(45);
  35. arcLeft(90, 25);
  36. turnTo(0);
  37. penUp();
  38. }
  39.  
  40. // Stump of the right tree
  41. function drawStump2() {
  42. penUp();
  43. moveTo(330, 465);
  44. penColor("#3F250B");
  45. penWidth(80);
  46. penDown();
  47. moveForward(175);
  48. turnRight(90);
  49. penWidth(30);
  50. turnTo(45);
  51. arcLeft(90, 25);
  52. turnTo(0);
  53. penUp();
  54. }
  55.  
  56. // Bump of the left tree
  57. function drawBump() {
  58. penUp();
  59. turnTo(0);
  60. moveTo(15, 450);
  61. dot(25);
  62. for (var i = 0; i < 10; i++) {
  63. moveForward(20);
  64. penDown();
  65. dot(20);
  66. }
  67. penUp();
  68. }
  69.  
  70.  
  71. // Bump of the right tree
  72. function drawBump2() {
  73. penUp();
  74. turnTo(0);
  75. moveTo(305, 450);
  76. dot(25);
  77. for (var i = 0; i < 10; i++) {
  78. moveForward(20);
  79. penDown();
  80. dot(20);
  81. }
  82. penUp();
  83. }
  84.  
  85. // All four branches of the tree
  86. function drawLeftBranch() {
  87. drawLeftBranch1();
  88. drawLeftBranch2();
  89. drawLeftBranch3();
  90. drawLeftBranch4();
  91. }
  92. function drawRightBranch() {
  93. drawRightBranch1();
  94. drawRightBranch2();
  95. drawRightBranch3();
  96. }
  97.  
  98. // First branch of left tree
  99. function drawLeftBranch1(){
  100. var branchWidth = 20;
  101. penUp();
  102. penColor("#3F250B");
  103. moveTo(25, 230);
  104. penWidth(branchWidth);
  105. turnTo(20);
  106. penDown();
  107. moveForward(70);
  108. turnRight(45);
  109. penWidth(branchWidth-3);
  110. moveForward(60);
  111. turnRight(-10);
  112. penWidth(branchWidth-5);
  113. moveForward(40);
  114. penUp();
  115. }
  116.  
  117. // First branch of the right tree
  118. function drawRightBranch1(){
  119. var branchWidth = 20;
  120. penUp();
  121. penColor("#3F250B");
  122. moveTo(300, 228);
  123. penWidth(branchWidth);
  124. turnTo(-20);
  125. penDown();
  126. moveForward(70);
  127. turnRight(-45);
  128. penWidth(branchWidth-3);
  129. moveForward(60);
  130. turnRight(-10);
  131. penWidth(branchWidth-5);
  132. moveForward(40);
  133. penUp();
  134. }
  135.  
  136. // Second branch of the left tree
  137. function drawLeftBranch2() {
  138. var branchWidth = 20;
  139. penUp();
  140. penColor("#3F250B");
  141. moveTo(15, 240);
  142. penWidth(branchWidth);
  143. turnTo(40);
  144. penDown();
  145. moveForward(70);
  146. turnRight(45);
  147. penWidth(branchWidth-3);
  148. moveForward(60);
  149. turnRight(-10);
  150. penWidth(branchWidth-5);
  151. moveForward(35);
  152. penUp();
  153. }
  154.  
  155. // Second branch of the right tree
  156. function drawRightBranch2() {
  157. var branchWidth = 20;
  158. penUp();
  159. penColor("#3F250B");
  160. moveTo(285, 235);
  161. penWidth(branchWidth);
  162. turnTo(-40);
  163. penDown();
  164. moveForward(70);
  165. turnRight(45);
  166. penWidth(branchWidth-3);
  167. moveForward(60);
  168. turnRight(-10);
  169. penWidth(branchWidth-5);
  170. moveForward(35);
  171. penUp();
  172. }
  173.  
  174. // Third branch of the left tree
  175. function drawLeftBranch3() {
  176. var branchWidth = 20;
  177. penUp();
  178. penColor("#3F250B");
  179. moveTo(12, 230);
  180. penWidth(branchWidth);
  181. turnTo(10);
  182. penDown();
  183. moveForward(70);
  184. turnRight(45);
  185. penWidth(branchWidth-3);
  186. moveForward(60);
  187. turnRight(-10);
  188. penWidth(branchWidth-5);
  189. moveForward(40);
  190. penUp();
  191. }
  192.  
  193. // Third branch of the right tree
  194. function drawRightBranch3() {
  195. var branchWidth = 20;
  196. penUp();
  197. penColor("#3F250B");
  198. moveTo(313, 235);
  199. penWidth(branchWidth);
  200. turnTo(10);
  201. penDown();
  202. moveForward(70);
  203. turnRight(45);
  204. penWidth(branchWidth-3);
  205. moveForward(60);
  206. turnRight(-10);
  207. penWidth(branchWidth-5);
  208. moveForward(40);
  209. penUp();
  210. }
  211.  
  212. // Fourth branch of the left tree ONLY
  213. function drawLeftBranch4() {
  214. var branchWidth = 20;
  215. penUp();
  216. penColor("#3F250B");
  217. moveTo(8, 230);
  218. penWidth(branchWidth);
  219. turnTo(0);
  220. penDown();
  221. moveForward(70);
  222. turnRight(45);
  223. penWidth(branchWidth-3);
  224. moveForward(60);
  225. turnRight(-10);
  226. penWidth(branchWidth-5);
  227. moveForward(40);
  228. penUp();
  229. }
  230.  
  231.  
  232. // The cherry blossom leaves of left tree!!
  233. function drawLeftLeaves() {
  234. penUp();
  235. moveTo(25, 244);
  236. penWidth(23);
  237. penDown();
  238. for (var i = 0; i < 125; i++) {
  239. drawColor1();
  240. drawColor2();
  241. drawColor3();
  242. penUp();
  243. turnTo(randomNumber(5, 179));
  244. moveTo(randomNumber(-10, 135), randomNumber(67, 230));
  245. penDown();
  246. }
  247. penUp();
  248. }
  249.  
  250. // The cherry blossom trees of the right tree!!
  251. function drawRightLeaves() {
  252. penUp();
  253. moveTo(299, 255);
  254. penWidth(23);
  255. penDown();
  256. for (var i = 0; i < 100; i++) {
  257. drawColor1();
  258. drawColor2();
  259. drawColor3();
  260. penUp();
  261. turnTo(randomNumber(5, 179));
  262. moveTo(randomNumber(195, 320), randomNumber(65, 240));
  263. penDown();
  264. }
  265. penUp();
  266. }
  267.  
  268. // First cherry blossom leaf color
  269. function drawColor1() {
  270. penColor("#ba808b");
  271. arcRight(90, 20);
  272. turnRight(90);
  273. arcRight(90, 20);
  274. }
  275.  
  276. // Second cherry blossom leaf color
  277. function drawColor2() {
  278. penColor("d498a3");
  279. arcRight(90, 20);
  280. turnRight(90);
  281. arcRight(90, 20);
  282. }
  283.  
  284. // Third cherry blossom leaf color
  285. function drawColor3() {
  286. penColor("#f2b9c4");
  287. arcRight(90, 20);
  288. turnRight(90);
  289. arcRight(90, 20);
  290. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement