Welcome to my Blog.... [~___~]

Coding membuat mobil

Jumat, 05 Desember 2014


 Sekarang saya mau bagi cara membuat mobil dengan menggunakan Notepad++. Berikut codingnya ... silahkan di simak

Codingnya :
<?php
header ("content-type:image/jpeg");
$image =imagecreate(600,600);

$white=imagecolorallocate($image,255,255,255);
$blue=imagecolorallocate($image,0,0,255);
$red=imagecolorallocate($image,255,0,0);
$hitam=imagecolorallocate($image,0,0,0);

//gambar1
//membuat bagian atas mobil
$value = array(
                                                50,80, //A
                                                150,50, //B
                                                150,160, //C
                                                50,130  //D
                                               
);
imagefilledpolygon($image,$value,4,$blue);
imagefilledrectangle($image,150,50,450,160,$blue);

imagestring($image,300,200,180,"MOBIL TAMPAK ATAS", $blue);

//gambar 2
//body
imagefilledrectangle($image,150,350,450,225,$blue);
imagefilledrectangle($image,50,350,150,300,$blue);

//jendela
imagefilledrectangle($image,150,290,220,240,$red);
imagefilledrectangle($image,300,290,225,240,$red);
imagefilledrectangle($image,305,290,420,240,$red);

//roda belakang
imagefilledellipse($image,375,350,50,50,$red);
imagefilledellipse($image,375,350,35,35,$white);
imagefilledellipse($image,375,350,20,20,$hitam);

//roda depan
imagefilledellipse($image,120,350,50,50,$red);
imagefilledellipse($image,120,350,35,35,$white);
imagefilledellipse($image,120,350,20,20,$hitam);

//data titik pertemuan poligon

$value = array (
                                                                        50,300,//titik 1
                                                                        150,300,//titik 2
                                                                        150,225,//titik 3
            );
imagefilledpolygon($image,$value,3,$blue);

imagestring($image,200,180,400,"MOBIL TAMPAK SAMPING", $red);

imagejpeg($image);
imagedestroy($image)
?>

Hasilnya:

 
 Semoga bermanfaat .... !!

0 komentar:

Posting Komentar