php编程输出心形图案_利用php输出不同的心形图案,php心形图案_PHP教程
利用php輸出不同的心形圖案,php心形圖案
首先為大家分享php輸出心形曲線的代碼,代碼如下
效果如下:
利用php輸出笛卡爾心形圖案,代碼如下
復制代碼 代碼如下:$width = 600; $height = 650; header("Content-type: image/gif"); $img = imagecreate($width,$height);//創建一張圖片 $bg color = imagecolorallocate($img,0,0,0); $red = imagecolorallocate($img,255,0,0); for($i=0;$i<=100;$i++){ for($j=0;$j<=100;$j++){ $r = M PI/50 $i * (1-sin(M_PI/50 $j)) 40; $x = $r cos(M PI/50 $j) sin(M PI/50 $i)+$width/2; $y = -$r sin(M_PI/50*$j)+$height/6; imagesetpixel($img,$x,$y,$red); } } imagegif($img); imagedestroy($img);
$width = 600;$height = 650;header("Content-type: image/gif");$img = imagecreate($width,$height);//創建一張圖片$bg_color = imagecolorallocate($img,0,0,0);$red = imagecolorallocate($img,255,0,0);for($i=0;$i<=100;$i++){for($j=0;$j<=100;$j++){ $r = M_PI/50*$i * (1-sin(M_PI/50*$j))*40;$x = $r *cos(M_PI/50*$j)*sin(M_PI/50*$i)+$width/2;$y = -$r*sin(M_PI/50*$j)+$height/6;imagesetpixel($img,$x,$y,$red);}}imagegif($img);imagedestroy($img);
以上就是本文的全部內容,希望對大家的學習有所幫助。
http://www.bkjia.com/PHPjc/1122890.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1122890.htmlTechArticle利用php輸出不同的心形圖案,php心形圖案 首先為大家分享 php輸出心形曲線 的代碼,代碼如下 phpfor($t=0;$t360;$t++){ $y=2*cos($t)-cos(2*$t); //笛卡爾...
總結
以上是生活随笔為你收集整理的php编程输出心形图案_利用php输出不同的心形图案,php心形图案_PHP教程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sas数据集怎么导出_[求助]如何导出s
- 下一篇: python输入三角形三边处理成三个实数