Mobil-mobilannya mba agnes :p
Berikut sourcenya :
void setup(){
size (600, 600);
//latar belakang
}
void draw ()
{
noStroke();
fill(176, 244, 230);
rect(0,0,600,200);
int d;
d=second();
noStroke();
//matahari
pushMatrix();
translate(80, 60);
rotate(radians(0));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(15));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(30));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(45));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(60));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(75));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(90));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(105));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(120));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(135));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(0));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(150));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(165));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(180));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(195));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(210));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(225));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(240));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(255));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(270));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(285));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(300));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(315));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(330));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(345));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(360));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
fill (255, 165, 0);
ellipse(80,60,75,75);
fill (255, 255, 0);
ellipse(80,60,25,25);
//awan
fill(255);
pushMatrix();
translate(10+5*d,0);
ellipse(100,20,50,30);
ellipse(120,30,70,30);
ellipse(80,30,70,40);
ellipse(220,70,50,30);
ellipse(240,80,70,30);
ellipse(200,80,70,40);
popMatrix();
// gunung
beginShape(TRIANGLE_STRIP);
noStroke();
fill(30,144,255);
vertex(100, 200);
vertex(340, 50);
vertex(500, 200);
vertex(0, 200);
vertex(240, 50);
vertex(500, 200);
//pohon
beginShape(TRIANGLE_STRIP);
noStroke();
fill(30,144,255);
vertex(100, 200);
vertex(340, 50);
fill(128,64,0);
rect(580,75,80,127);
fill(0,128,64);
ellipse(500,30,50,50);
ellipse(510,50,50,50);
ellipse(540,20,50,50);
ellipse(550,60,50,50);
ellipse(560,10,50,50);
ellipse(510,20,50,50);
ellipse(580,30,100,100);
ellipse(590,40,100,100);
ellipse(620,40,100,100);
ellipse(590,60,50,50);
ellipse(570,70,80,80);
ellipse(560,100,50,50);
ellipse(520,100,50,50);
ellipse(530,80,50,50);
//laut
noStroke();
fill(0, 191, 255);
rect(0,250,600,75);
fill(30, 144, 255);
rect(0,325,600,25);
fill(100, 149, 237);
rect(0,350,600,75);
fill(0);
rect(0,425,600,25);
fill(255, 222, 173);
rect(0,200,600,100);
fill(255, 222, 173);
rect(0,450,600,100);
//air
fill(255); rect(0,360,100,2);
fill(255); rect(70,380,70,2);
fill(255); rect(210,410,120,2);
fill(255); rect(270,380,70,2);
fill(255); rect(480,380,200,2);
//bendera Indonesia vs Jepang
fill (0); rect (80, 125, 10, 140);
fill (0); rect (65, 265, 40, 30);
fill (255, 0, 0); rect (90, 125, 70, 25);
fill (255); rect (90, 150, 70, 25);
fill (0); rect (505, 125, 10, 140);
fill (0); rect (490, 265, 40, 30);
fill (255, 0, 0); rect (515, 125, 70,50);
fill (255, 255, 0); ellipse ( 550, 150, 30, 30);
// tugu
fill (0); rect (240, 85, 110, 20);
fill (255); rect (240, 105, 110, 20);
stroke(255,0,0);
fill (0); rect (230, 85, 10, 120);
fill (0); rect (350, 85, 10, 120);
fill (0); rect (220, 180, 150, 30);
fill (0); rect (195, 200, 200, 30);
fill (0); rect (168, 225, 255, 30);
fill (0); rect (148, 245, 295, 30);
// ekor hiu
noStroke();
fill(0); arc(100,405,70,120,3,4.5);
fill(0); arc(250,355,70,120,3,4.5);
fill(105); ellipse (200, 355, 120, 60);
fill(0); ellipse (200, 355, 110, 50);
fill(255); ellipse (160, 350, 5, 5);
fill(0);
arc(450,405,70,120,3,4.5);
//pagar
fill(128,64,0);
stroke(0);
rect(13,370,29,130);
rect(160,370,29,130);
rect(360,370,29,130);
rect(560,370,29,130);
rect(0,400,195,50);
rect(355,400,255,50);
noStroke();
triangle(28,350,5,370,50,370);
triangle(175,350,153,370,195,370);
triangle(375,350,353,370,395,370);
triangle(575,350,553,370,595,370);
fill(0);
arc(27,428,10,10,(0*PI)/180,(360*PI)/180);
arc(177,428,10,10,(0*PI)/180,(360*PI)/180);
arc(375,428,10,10,(0*PI)/180,(360*PI)/180);
arc(575,428,10,10,(0*PI)/180,(360*PI)/180);
// jalan
fill(69);
noStroke();
rect(0,510,600,100); fill(169,82,45);
rect(0,501,600,20);
fill(255);
rect(0,585,80,20);
rect(130,585,120,20);
rect(290,585,120,20);
rect(500,585,120,20);
//mobil 1
translate(10+5*d,30);
pushMatrix();
fill (0);
beginShape();
vertex(75,500);
vertex(125,450);
vertex(225,450);
vertex(275,500);
vertex(325,500);
vertex(365,520);
vertex(365,520);
vertex(365,550);
vertex(75,550);
endShape(CLOSE);
fill(0);
ellipse(140,550,50,50);
ellipse(280,550,50,50);
fill (255);
rect(120,470,40,40);
rect(190,470,40,40);
popMatrix();
// mobil 2
translate(10+5*d,30);
pushMatrix();
fill (221, 0 , 0);
beginShape();
vertex(75,500);
vertex(125,450);
vertex(225,450);
vertex(275,500);
vertex(325,500);
vertex(365,520);
vertex(365,520);
vertex(365,550);
vertex(75,550);
endShape(CLOSE);
fill(0);
ellipse(140,550,50,50);
ellipse(280,550,50,50);
fill (0);
rect(120,470,40,40);
rect(190,470,40,40);
popMatrix();
}
size (600, 600);
//latar belakang
}
void draw ()
{
noStroke();
fill(176, 244, 230);
rect(0,0,600,200);
int d;
d=second();
noStroke();
//matahari
pushMatrix();
translate(80, 60);
rotate(radians(0));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(15));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(30));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(45));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(60));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(75));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(90));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(105));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(120));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(135));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(0));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(150));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(165));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(180));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(195));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(210));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(225));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(240));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(255));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(270));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(285));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(300));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(315));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(330));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(345));
fill(255, 215, 0);
rect(0, 0, 10, 50);
popMatrix();
pushMatrix();
translate(80, 60);
rotate(radians(360));
fill(255, 255, 0);
rect(0, 0, 10, 50);
popMatrix();
fill (255, 165, 0);
ellipse(80,60,75,75);
fill (255, 255, 0);
ellipse(80,60,25,25);
//awan
fill(255);
pushMatrix();
translate(10+5*d,0);
ellipse(100,20,50,30);
ellipse(120,30,70,30);
ellipse(80,30,70,40);
ellipse(220,70,50,30);
ellipse(240,80,70,30);
ellipse(200,80,70,40);
popMatrix();
// gunung
beginShape(TRIANGLE_STRIP);
noStroke();
fill(30,144,255);
vertex(100, 200);
vertex(340, 50);
vertex(500, 200);
vertex(0, 200);
vertex(240, 50);
vertex(500, 200);
//pohon
beginShape(TRIANGLE_STRIP);
noStroke();
fill(30,144,255);
vertex(100, 200);
vertex(340, 50);
fill(128,64,0);
rect(580,75,80,127);
fill(0,128,64);
ellipse(500,30,50,50);
ellipse(510,50,50,50);
ellipse(540,20,50,50);
ellipse(550,60,50,50);
ellipse(560,10,50,50);
ellipse(510,20,50,50);
ellipse(580,30,100,100);
ellipse(590,40,100,100);
ellipse(620,40,100,100);
ellipse(590,60,50,50);
ellipse(570,70,80,80);
ellipse(560,100,50,50);
ellipse(520,100,50,50);
ellipse(530,80,50,50);
//laut
noStroke();
fill(0, 191, 255);
rect(0,250,600,75);
fill(30, 144, 255);
rect(0,325,600,25);
fill(100, 149, 237);
rect(0,350,600,75);
fill(0);
rect(0,425,600,25);
fill(255, 222, 173);
rect(0,200,600,100);
fill(255, 222, 173);
rect(0,450,600,100);
//air
fill(255); rect(0,360,100,2);
fill(255); rect(70,380,70,2);
fill(255); rect(210,410,120,2);
fill(255); rect(270,380,70,2);
fill(255); rect(480,380,200,2);
//bendera Indonesia vs Jepang
fill (0); rect (80, 125, 10, 140);
fill (0); rect (65, 265, 40, 30);
fill (255, 0, 0); rect (90, 125, 70, 25);
fill (255); rect (90, 150, 70, 25);
fill (0); rect (505, 125, 10, 140);
fill (0); rect (490, 265, 40, 30);
fill (255, 0, 0); rect (515, 125, 70,50);
fill (255, 255, 0); ellipse ( 550, 150, 30, 30);
// tugu
fill (0); rect (240, 85, 110, 20);
fill (255); rect (240, 105, 110, 20);
stroke(255,0,0);
fill (0); rect (230, 85, 10, 120);
fill (0); rect (350, 85, 10, 120);
fill (0); rect (220, 180, 150, 30);
fill (0); rect (195, 200, 200, 30);
fill (0); rect (168, 225, 255, 30);
fill (0); rect (148, 245, 295, 30);
// ekor hiu
noStroke();
fill(0); arc(100,405,70,120,3,4.5);
fill(0); arc(250,355,70,120,3,4.5);
fill(105); ellipse (200, 355, 120, 60);
fill(0); ellipse (200, 355, 110, 50);
fill(255); ellipse (160, 350, 5, 5);
fill(0);
arc(450,405,70,120,3,4.5);
//pagar
fill(128,64,0);
stroke(0);
rect(13,370,29,130);
rect(160,370,29,130);
rect(360,370,29,130);
rect(560,370,29,130);
rect(0,400,195,50);
rect(355,400,255,50);
noStroke();
triangle(28,350,5,370,50,370);
triangle(175,350,153,370,195,370);
triangle(375,350,353,370,395,370);
triangle(575,350,553,370,595,370);
fill(0);
arc(27,428,10,10,(0*PI)/180,(360*PI)/180);
arc(177,428,10,10,(0*PI)/180,(360*PI)/180);
arc(375,428,10,10,(0*PI)/180,(360*PI)/180);
arc(575,428,10,10,(0*PI)/180,(360*PI)/180);
// jalan
fill(69);
noStroke();
rect(0,510,600,100); fill(169,82,45);
rect(0,501,600,20);
fill(255);
rect(0,585,80,20);
rect(130,585,120,20);
rect(290,585,120,20);
rect(500,585,120,20);
//mobil 1
translate(10+5*d,30);
pushMatrix();
fill (0);
beginShape();
vertex(75,500);
vertex(125,450);
vertex(225,450);
vertex(275,500);
vertex(325,500);
vertex(365,520);
vertex(365,520);
vertex(365,550);
vertex(75,550);
endShape(CLOSE);
fill(0);
ellipse(140,550,50,50);
ellipse(280,550,50,50);
fill (255);
rect(120,470,40,40);
rect(190,470,40,40);
popMatrix();
// mobil 2
translate(10+5*d,30);
pushMatrix();
fill (221, 0 , 0);
beginShape();
vertex(75,500);
vertex(125,450);
vertex(225,450);
vertex(275,500);
vertex(325,500);
vertex(365,520);
vertex(365,520);
vertex(365,550);
vertex(75,550);
endShape(CLOSE);
fill(0);
ellipse(140,550,50,50);
ellipse(280,550,50,50);
fill (0);
rect(120,470,40,40);
rect(190,470,40,40);
popMatrix();
}
Berikut tampilannya :
## Semoga Bermanfaat ##
0 komentar:
Post a Comment