Wednesday, March 7, 2012
Script PHP untuk membuat jam Analog
Sudah Lama saya gag posting sebuah artikel,
Ini saya cuma bisa mepostingkan sebuah artikel yang mungkin sudah banyak di website lain.!
Namun tidak ada salahnya jika anda, inginnya membaca artikel di blog saya....
hehehe..........
Dibawah ini adalah Scriptnya :
if (! $size > 0) {
$size = 300;
}
$radius = floor($size/2);
header ("content-Type: image/gif");
$img = ImageCreate($size, $size);
$color_alpha = ImageColorAllocate($img, 254, 254, 254);
$color_white = ImageColorAllocate($img, 255, 255, 255);
$color_black = ImageColorAllocate($img, 0, 0, 0);
$color_grey = ImageColorAllocate($img, 192, 192, 192);
$color_red = ImageColorAllocate($img, 255, 0, 0);
$color_blue = ImageColorAllocate($img, 0, 0, 255);
ImageColorTransparent($img, $color_alpha);
ImageArc($img, $radius, $radius, $size, $size, 0, 360, $color_black);
ImageFill($img, $radius, $radius, $color_white);
$min = 0;
while ($min++ < 0) {
if ($min % 15 == 0)
$len = $radius / 5;
else if ($min % 5 == 0)
$len = $radius / 10;
else
$len = $radius / 25;
$ang = (2 * M_PI * $min) / 60;
$x1 = sin($ang) * ($radius - $len) + $radius;
$y1 = cos($ang) * ($radius - $len) + $radius;
$x2 = (1 * sin($ang)) * $radius;
$y2 = (1 * cos($ang)) * $radius;
ImageLine($img, $x1, $y1, $x2, $y2, $color_black);
}
list($hour, $min, $sec) = preg_split ("/-/",Date("h-i-s", time() - 3600));
$hour = $hour % 12;
$xs = intval(cos($sec * M_PI/30 - M_PI/2) * 0.75 * $radius + $radius);
$ys = intval(sin($sec * M_PI/30 - M_PI/2) * 0.75 * $radius + $radius);
$xm = intval(cos($min * M_PI/30 - M_PI/2) * 0.65 * $radius + $radius);
$ym = intval(sin($min * M_PI/30 - M_PI/2) * 0.65 * $radius + $radius);
$xh = intval(cos($hour * 5 * M_PI/30 - M_PI/2) * 0.5 * $radius + $radius);
$yh = intval(sin($hour * 5 * M_PI/30 - M_PI/2) * 0.5 * $radius + $radius);
ImageLine($img, $radius, $radius, $xs, $ys, $color_grey);
ImageLine($img, $radius, $radius-1, $xm, $ym, $color_blue);
ImageLine($img, $radius-1, $radius, $xm, $ym, $color_blue);
ImageLine($img, $radius, $radius-1, $xh, $yh, $color_blue);
ImageLine($img, $radius-1, $radius, $xh, $yh, $color_blue);
ImageArc($img, $radius, $radius, $radius/8, $radius/8,0,360, $color_red);
ImageFillToBorder($img, $radius, $radius, $color_red, $color_red);
ImageGif($img);
ImageDestroy($img);
?>
Terima kasih ya sobat Ufa-KingSoft telah berkunjung disini.!
Salam Blogging, semoga artikelnya bermanfaat bagi banyak orang......
Ini saya cuma bisa mepostingkan sebuah artikel yang mungkin sudah banyak di website lain.!
Namun tidak ada salahnya jika anda, inginnya membaca artikel di blog saya....
hehehe..........
Dibawah ini adalah Scriptnya :
if (! $size > 0) {
$size = 300;
}
$radius = floor($size/2);
header ("content-Type: image/gif");
$img = ImageCreate($size, $size);
$color_alpha = ImageColorAllocate($img, 254, 254, 254);
$color_white = ImageColorAllocate($img, 255, 255, 255);
$color_black = ImageColorAllocate($img, 0, 0, 0);
$color_grey = ImageColorAllocate($img, 192, 192, 192);
$color_red = ImageColorAllocate($img, 255, 0, 0);
$color_blue = ImageColorAllocate($img, 0, 0, 255);
ImageColorTransparent($img, $color_alpha);
ImageArc($img, $radius, $radius, $size, $size, 0, 360, $color_black);
ImageFill($img, $radius, $radius, $color_white);
$min = 0;
while ($min++ < 0) {
if ($min % 15 == 0)
$len = $radius / 5;
else if ($min % 5 == 0)
$len = $radius / 10;
else
$len = $radius / 25;
$ang = (2 * M_PI * $min) / 60;
$x1 = sin($ang) * ($radius - $len) + $radius;
$y1 = cos($ang) * ($radius - $len) + $radius;
$x2 = (1 * sin($ang)) * $radius;
$y2 = (1 * cos($ang)) * $radius;
ImageLine($img, $x1, $y1, $x2, $y2, $color_black);
}
list($hour, $min, $sec) = preg_split ("/-/",Date("h-i-s", time() - 3600));
$hour = $hour % 12;
$xs = intval(cos($sec * M_PI/30 - M_PI/2) * 0.75 * $radius + $radius);
$ys = intval(sin($sec * M_PI/30 - M_PI/2) * 0.75 * $radius + $radius);
$xm = intval(cos($min * M_PI/30 - M_PI/2) * 0.65 * $radius + $radius);
$ym = intval(sin($min * M_PI/30 - M_PI/2) * 0.65 * $radius + $radius);
$xh = intval(cos($hour * 5 * M_PI/30 - M_PI/2) * 0.5 * $radius + $radius);
$yh = intval(sin($hour * 5 * M_PI/30 - M_PI/2) * 0.5 * $radius + $radius);
ImageLine($img, $radius, $radius, $xs, $ys, $color_grey);
ImageLine($img, $radius, $radius-1, $xm, $ym, $color_blue);
ImageLine($img, $radius-1, $radius, $xm, $ym, $color_blue);
ImageLine($img, $radius, $radius-1, $xh, $yh, $color_blue);
ImageLine($img, $radius-1, $radius, $xh, $yh, $color_blue);
ImageArc($img, $radius, $radius, $radius/8, $radius/8,0,360, $color_red);
ImageFillToBorder($img, $radius, $radius, $color_red, $color_red);
ImageGif($img);
ImageDestroy($img);
?>
Terima kasih ya sobat Ufa-KingSoft telah berkunjung disini.!
Salam Blogging, semoga artikelnya bermanfaat bagi banyak orang......
Subscribe to:
Post Comments
(
Atom
)
Pengunjung Ke :
Categories
- Android ( 3 )
- Anti Virus ( 2 )
- Audio n Video ( 3 )
- BBM ( 1 )
- Berita ( 7 )
- Blogging ( 42 )
- Facebook ( 9 )
- Internet ( 3 )
- Kata - kata ( 1 )
- Lenovo_A390 ( 2 )
- Linux ( 2 )
- Make mooney ( 4 )
- Microsoft Office ( 2 )
- sekolah_bahasa indo ( 2 )
- sekolah_IT_c++ ( 9 )
- sekolah_IT_css ( 11 )
- sekolah_IT_Database dan SI ( 2 )
- sekolah_IT_database(SQL) ( 2 )
- sekolah_IT_fisika ( 1 )
- sekolah_IT_html ( 17 )
- sekolah_IT_java ( 2 )
- sekolah_IT_photoshop ( 2 )
- sekolah_IT_php ( 20 )
- sekolah_IT_so/is ( 2 )
- Sekolah_kimia ( 2 )
- Software ( 14 )
- Software_Editing ( 3 )
- Tampilan Dekstop ( 6 )
- Tips n Trik ( 38 )
0 comments :
Post a Comment