新浪微博 登陆  注册   设为首页 加入收藏

学PHP >> HTML5专题 >> 关于HTML5 的canvas

关于HTML5 的canvas

查看次数34014 发表时间2012-11-26 22:38:29

<!DOCTYPE HTML>
<html>
<body>

<canvas id="myCanvas" width="200" height="100" style="border:1px solid #c3c3c3;">
Your browser does not support the canvas element.
</canvas>

<script type="text/javascript">

var c=document.getElementById("myCanvas");
var cxt=c.getContext("2d");
cxt.fillStyle="#FF0000";
cxt.beginPath();
cxt.arc(70,18,15,0,Math.PI*2,true);//画了一个圆形
cxt.closePath();
cxt.fill();
cxt.moveTo(70,32);//这是一条线,这个坐标表示 线段开始的 x,y
cxt.lineTo(70,50);//这是线段结束的x,y坐标
cxt.stroke();//绘制图形的边线
cxt.moveTo(70,50);
cxt.lineTo(50,80);

cxt.stroke();
cxt.moveTo(70,50);
cxt.lineTo(90,80);
cxt.stroke();
cxt.moveTo(70,32);
cxt.lineTo(50,60);
cxt.stroke();
cxt.moveTo(70,32);
cxt.lineTo(90,60);
cxt.stroke();
</script>

</body>
</html>


(转发请注明转自:学PHP)    


  相关推荐



1楼 Anderson说: 2013-04-14 22:57:12
You've magaend a first class post
2楼 Lissa说: 2016-12-11 13:05:05
You've got to be kidding me-it's so trrlnpaaestny clear now!
3楼 Jacoby说: 2016-12-21 20:07:04
Never would have thunk I would find this so insespindable.

  发表评论
昵称:
(不超过20个字符或10个汉字)
内容: