Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. //Joshua Liu
  2. //April 17,2019
  3. //Mr.Rosen
  4. //Draws a house with a basketball and a basketball net
  5. void setup(){
  6. size(800,500);
  7. background(255);
  8. smooth();
  9. }
  10. void draw(){
  11. background(255);
  12. house();
  13. backetballNet();
  14. ball();
  15. }
  16. void house(){
  17. //Body or wall of the house
  18. stroke(255,224,0);
  19. fill(255,224,0);
  20. beginShape();
  21. vertex(350,450);
  22. vertex(350,225);
  23. vertex(500,135);
  24. vertex(650,225);
  25. vertex(650,450);
  26. endShape(CLOSE);
  27. //Chimney
  28. stroke(0);
  29. fill(0);
  30. quad(400,100,400,200,450,167,450,100);
  31. //roof
  32. fill(45,11,0);
  33. stroke(45,11,0);
  34. quad(300,225,300,260,500,135,500,100);
  35. quad(500,100,500,135,700,260,700,225);
  36. //Window and shade
  37. fill(255,127,39);
  38. stroke(255,127,39);
  39. ellipse(500,250,80,80);
  40. fill(255,127,39,100);
  41. stroke(255,127,39,100);
  42. ellipse(500,252,75,80);
  43. //Door and shade
  44. rectMode(CORNERS);
  45. fill(10);
  46. stroke(10);
  47. rect(450,450,550,350);
  48. stroke(0);
  49. fill(0);
  50. rect(450,450,540,385);
  51. //Doorknob
  52. fill(255);
  53. stroke(255);
  54. ellipse(470,420,39,39);
  55. //Roof shade
  56. fill(45,11,0,100);
  57. stroke(45,11,0,100);
  58. quad(350,225,350,235,500,145,500,135);
  59. quad(500,135,500,145,700,235,700,225);
  60. }
  61. void backetballNet(){
  62. //Legs and stand
  63. fill(117,131,206);
  64. stroke(117,131,206);
  65. strokeWeight(5);
  66. line(150,350,250,450);
  67. line(180,480,210,320);
  68. line(200,400,200,260);
  69. strokeWeight(1);
  70. //Backboard
  71. fill(207);
  72. stroke(207);
  73. rect(180,260,220,200);
  74. fill(0,0);
  75. stroke(255,127,39);
  76. strokeWeight(2);
  77. rect(195,250,205,240);
  78. //Hoop
  79. stroke(214,32,32);
  80. ellipse(210,260,12,5);
  81. }
  82. //void ball(){
  83. // //Basketball
  84. // fill(206,152,0);
  85. // stroke(206,152,0);
  86. // ellipse(280,430,20,20);
  87. // fill(0,0);
  88. // stroke(0);
  89. // strokeWeight(1);
  90. // arc(270,430,20,20,radians(300),radians(420));
  91. // arc(290,430,20,20,radians(120),radians(240));
  92. // line(280,420,280,440);
  93. // arc(280,440,20,20,radians(210),radians(330));
  94. //}
  95.  
  96. //ANIMATION
  97. float x=280;
  98. float y=430;
  99. void ball(){
  100. x=lerp(x,210,0.05);
  101. y=lerp(y,260,0.05);
  102. fill(206,152,0);
  103. stroke(206,152,0);
  104. ellipse(x,y,20,20);
  105. fill(0,0);
  106. stroke(0);
  107. arc(x-10,y,20,20,radians(300),radians(420));
  108. arc(x+10,y,20,20,radians(120),radians(240));
  109. line(x,y-10,x,y+10);
  110. arc(x,y+10,20,20,radians(210),radians(330));
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement