php趣味编程 - php 打印奥运五环

php趣味,php 奥运五环

<?php
//画出奥运五环旗
$img_width = 600;
$img_height = 400;
 
header("Content-type: image/gif");
$img = imagecreate($img_width,$img_height);//创建图片
$bg_color = imagecolorallocate($img,124,14,14);//设置图片背景
//奥运五环颜色 蓝 黄 黑 绿 红
$blue = imagecolorallocate($img,0,255,255);
$yello = imagecolorallocate($img,255,255,0);
$black = imagecolorallocate($img,0,0,0);
$green = imagecolorallocate($img,0,255,0);
$red = imagecolorallocate($img,255,0,0);
$color = array($blue,$black,$red,$yello,$green);
 
//奥运圆圈的半径为70. 2个圆的圆心距离为半径*2-10 第一个圆的圆心坐标(100,100)
//
$x = array(100,100+130,100+130+130,(100+(100+130))/2,(100+(100+130))/2+130);
$y = array(100,100,100,100+65,100+65);
for($i=0;$i<5;$i++){
imagearc($img,$x[$i],$y[$i],140,140,0,360,$color[$i]);
}
 
imagegif($img);
imagedestroy($img);
?>

问题 & 评论

    共有 0 评论

写个评论或者问题

该视频目前没有评论。

如果有任何关于网站的意见,可以QQ联系或者发邮箱。

tags - tags - tags - tags - tags - tags - tags - tags - tags - tags - tags - tags - tags - tags - tags -