Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Joshua Liu
- //April 17,2019
- //Mr.Rosen
- //Draws a house with a basketball and a basketball net
- void setup(){
- size(800,500);
- background(255);
- smooth();
- }
- void draw(){
- background(255);
- house();
- backetballNet();
- ball();
- }
- void house(){
- //Body or wall of the house
- stroke(255,224,0);
- fill(255,224,0);
- beginShape();
- vertex(350,450);
- vertex(350,225);
- vertex(500,135);
- vertex(650,225);
- vertex(650,450);
- endShape(CLOSE);
- //Chimney
- stroke(0);
- fill(0);
- quad(400,100,400,200,450,167,450,100);
- //roof
- fill(45,11,0);
- stroke(45,11,0);
- quad(300,225,300,260,500,135,500,100);
- quad(500,100,500,135,700,260,700,225);
- //Window and shade
- fill(255,127,39);
- stroke(255,127,39);
- ellipse(500,250,80,80);
- fill(255,127,39,100);
- stroke(255,127,39,100);
- ellipse(500,252,75,80);
- //Door and shade
- rectMode(CORNERS);
- fill(10);
- stroke(10);
- rect(450,450,550,350);
- stroke(0);
- fill(0);
- rect(450,450,540,385);
- //Doorknob
- fill(255);
- stroke(255);
- ellipse(470,420,39,39);
- //Roof shade
- fill(45,11,0,100);
- stroke(45,11,0,100);
- quad(350,225,350,235,500,145,500,135);
- quad(500,135,500,145,700,235,700,225);
- }
- void backetballNet(){
- //Legs and stand
- fill(117,131,206);
- stroke(117,131,206);
- strokeWeight(5);
- line(150,350,250,450);
- line(180,480,210,320);
- line(200,400,200,260);
- strokeWeight(1);
- //Backboard
- fill(207);
- stroke(207);
- rect(180,260,220,200);
- fill(0,0);
- stroke(255,127,39);
- strokeWeight(2);
- rect(195,250,205,240);
- //Hoop
- stroke(214,32,32);
- ellipse(210,260,12,5);
- }
- //void ball(){
- // //Basketball
- // fill(206,152,0);
- // stroke(206,152,0);
- // ellipse(280,430,20,20);
- // fill(0,0);
- // stroke(0);
- // strokeWeight(1);
- // arc(270,430,20,20,radians(300),radians(420));
- // arc(290,430,20,20,radians(120),radians(240));
- // line(280,420,280,440);
- // arc(280,440,20,20,radians(210),radians(330));
- //}
- //ANIMATION
- float x=280;
- float y=430;
- void ball(){
- x=lerp(x,210,0.05);
- y=lerp(y,260,0.05);
- fill(206,152,0);
- stroke(206,152,0);
- ellipse(x,y,20,20);
- fill(0,0);
- stroke(0);
- arc(x-10,y,20,20,radians(300),radians(420));
- arc(x+10,y,20,20,radians(120),radians(240));
- line(x,y-10,x,y+10);
- arc(x,y+10,20,20,radians(210),radians(330));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement