canvas的自动画图

<!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.moveTo(10,10);
cxt.lineTo(10,50);
var dddd=50;
cxt.lineTo(50,50);
cxt.stroke();
ss();
function ss(){

dddd=dddd+1;
cxt.lineTo(dddd,50);
cxt.stroke();
var t1=setTimeout(ss,1);

}
</script>

posted on 2015-05-07 17:47  liuwenbohhh  阅读(205)  评论(0编辑  收藏  举报