Mengambar Object Sederhana Dengan Aplikasi Processing Latihan 2

Jika dilatihan 1 kita membuat program sederhana dengan processing yaitu berupa object lingkaran yang bisa membuat gambar, dan pada kesempatan kali ini sekaligus sebagai latihan 2 yaitu membuat object sederhana menggunakan aplikasi processing, jika masih ada yang belum tau mengenai aplikasi processing ini silahkan baca lagi pada artikel yang berjudul : Membuat Program Sederhana Dengan Aplikasi Processing Latihan 1 disana ada penjelasan singkat mengenai penggunaan processing.


Sebagai referensi kalian berikut saya mempunyai beberapa script code untuk program sederhana procesing dalam membuat object. berikut scriptnya :

1. Mengambar Object Spongebob



size(430,455);
//backround
   int l=width;
   int t=height;
  background(#F22A2A);


  fill(#4AAAFC);
  quad(l/2,0, l,t/2, l/2,t, 0,t/2);
  fill(#F8FC30);
  quad(l/2,0+t/8*1, l-l/8*1,t/2, l/2,t-t/8*1, 0+l/8*1,t/2);
  fill(#69BC11);
  quad(l/2,0+t/8*2, l-l/8*2,t/2, l/2,t-t/8*2, 0+l/8*2,t/2);


//badan
fill(#FFE40F);
rect(110,150,200,120);
fill(#FFFFFF);
rect(110,150,200,160);
fill(#F0E02E);
rect(110,150,200,120);

//celana
fill(#836309);
rect(110,310, 90, 50);
rect(220,310, 90, 50);
//kaki
fill(#FFE40F);
rect(140, 360, 30, 90);
rect(250, 360, 30, 90);
//sepatu
noStroke();
fill(#080808);
rect(110,420,60,30);
ellipse(127,435,50,40);
fill(#FFFFFF);
ellipse(110,430,10,10);
fill(#080808);
rect(250,420,50,30);
ellipse(290,435,50,40);
fill(#FFFFFF);
ellipse(305,430,10,10);

//mata
stroke(10);
ellipse(170,200,40,40);
ellipse(250,200,40,40);
//mata kecil
fill(#347DD8);
ellipse(175,200,20,20);
ellipse(245,200,20,20);
fill(#080808);
ellipse(175,200,10,10);
ellipse(245,200,10,10);
//bibir
noFill();
arc(210,230,100,50, (0*PI)/180,(180*PI)/180);
//gigi
fill(#FFFFFF);
rect(200,255,10,10);
rect(210,255,10,10);
//hidung
fill(#F0D400);
arc(210,220,10,30, (0*PI)/180,(180*PI)/180);
//dasi
fill(#D30202);
ellipse(230,290,30,20);
ellipse(190,290,30,20);
fill(#050505);
noStroke();
ellipse(210,290,20,20);
//tangan
stroke(5);
fill(#FFFFFF);
rect(85,260,25,30);
rect(310,260,25,30);
fill(#FFE40F);
rect(90,290,10,50);
rect(319,290,10,50);
ellipse(95,340,30,30);
ellipse(325,340,30,30);
//Alis
stroke(#0F0101);
strokeWeight(3);
line(155,187, 145,170);
line(165,180, 165,165);
line(179,181, 184,165);
line(240,183, 230, 167);
line(250,179, 250, 162);
line(262,183, 275,170);
//text
fill(#000000);
text("Nama : Teknoowl", 10,50);
text("Kelas : Teknik Informatika", 10,65);
text("Gambar Patrick", 10,80);

2. Mengambar Object Doraemon


size (600,600);
background(5,249,74);

strokeWeight(10);
stroke(248,67,71);
line(0,420,420,0);

strokeWeight(10);
stroke(88,67,248);
line(0,480,480,0);

strokeWeight(10);
stroke(244,214,14);
line(0,540,540,0);

strokeWeight(10);
stroke(196,6,224);
line(0,600,600,0);

//kepala
strokeWeight(3);
fill(0,0,255);
stroke(0,0,0);
arc(350,250,250,255,(130*PI)/180,(410*PI)/180);
fill(255,255,255);
arc(350,270,210,200,(130*PI)/180,(410*PI)/180);

fill(255,255,255);
noStroke();
rect(283,300,135,50);

//mata kiri
fill(255,255,255);
stroke(0,0,0);
ellipse (330,170, 50, 60);
fill(0,0,0);
strokeWeight(15);
point(340,185);

 //mata kanan
 strokeWeight(3);
fill(255,255,255);
ellipse (385,170, 50, 60);
fill(0,0,0);
strokeWeight(15);
point(375,185);

strokeWeight(3);
fill(255,0,0); //hidung
ellipse(357,200,25,20);
line(356,210,356,245);

//mulut
arc(350,245,140,180,(0*PI)/180,(180*PI)/180);
arc(350,325,140,115,(215*PI)/180,(325*PI)/180);
line(280,245,420,245);

//kumis kiri
line(330,210,290,200);
line(330,220,290,210);
line(330,230,290,220);

//kumis kanan
line(378,210,418,200);
line(378,220,418,210);
line(378,230,418,220);

//tangan kiri
fill(0,0,255);
strokeWeight(3);
stroke(0,0,0);
ellipse(240,390,40,100);

//telapak kiri
fill(255,255,255);
ellipse(240,440,40,40);

//tangan kanan
fill(0,0,255);
strokeWeight(3);
stroke(0,0,0);
ellipse(460,390,40,100);

//telapak kanan
fill(255,255,255);
ellipse(460,440,40,40);

//badan
fill(0,0,255);
stroke(0,0,0);
strokeWeight(3);
rect(255,350,190,150);

//leher
strokeWeight(9);
stroke(255,0,0);
line(255,345,445,345);

//perut
fill(255,255,255);
strokeWeight(3);
stroke(0,0,0);
arc(350,395,160,170,(330*PI)/180,(570*PI)/180);
noStroke();
rect(283,352,135,50);

//lonceng
fill(255,255,0);
strokeWeight(3);
stroke(0,0,0);
ellipse(350,358,25,25);
ellipse(350,365,10,10);
arc(350,356,25,10,(180*PI)/180,(360*PI)/180);
arc(350,360,25,10,(180*PI)/180,(360*PI)/180);

//kantong
fill(255,255,255);
strokeWeight(3);
stroke(0,0,0);
arc(350,390,140,150,(0*PI)/180,(180*PI)/180);
line(280,390,420,390);

//garis kaki
fill(0,0,255);
arc(340,490,30,20,(280*PI)/180,(420*PI)/180);

//kaki
fill(255,255,255);
ellipse(410,520,120,50);
ellipse(290,520,120,50);

fill(#000000);
text("Nama : Teknoowl", 10,50);
text("Kelas : Teknik Informatika", 10,65);
text("Gambar Jayen", 10,80);

3. Mengambar Object Ulat


void setup(){
size(540,540);
background(#4AAAFC);
}

void draw(){


fill(#000000);
text("Nama : Teknoowl", 10,400);
text("Kelas : Teknik Informatika", 10,415);
text("Gambar Kecebong", 10,430);

fill(255,241,111);
stroke(0,0,0);
ellipse(450,480,100,100);

fill(255,241,111);
stroke(0,0,0);
ellipse(430,400,150,150);

fill(255,241,111);
stroke(0,0,0);
ellipse(400,300,200,200);

//muka dasar
fill(255,235,8);
stroke(0,0,0);
ellipse(300,150,400,400);

//alis
strokeWeight(10);
stroke(10,114,255);
line(100,40,200,40);
line(300,40,400,40);

//matakotak
fill(255,255,255);
noStroke();
rect(100,50,100,50);

fill(255,255,255);
noStroke();
rect(300,50,100,50);

//hidung
fill(255,255,255);
noStroke();
ellipse(200,150,100,50);

//mata bulat
fill(0,0,0);
ellipse(150,75,50,50);

fill(0,0,0);
ellipse(350,75,50,50);

//mulut
fill(255,0,0);
arc(275,225,200,200,0,PI);

//sungut
fill(255,0,0);
arc(240,160,50,50,1, PI/2);
arc(160,160,50,50,1,PI/2);


}

Mungkin dengan 3 buah contoh script  gambar diatas bisa menjadikan referensi kalian untuk membuat object gambar lainnya juga pada software processing, selamat mencoba.

0 Response to "Mengambar Object Sederhana Dengan Aplikasi Processing Latihan 2"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel