日期:2014-05-17 浏览次数:20710 次
<html> <head> <meta charset="gb2312" /> <title></title> <style type="text/css"> canvas { margin-left:200px; border: 1px solid #000; } </style> </head> <body> <canvas id="canvas" width="400" height="400"></canvas> <script type="text/javascript"> window.onload = function(){ var canvas = document.getElementById('canvas'); if( canvas.getContext ){ //alert('支持 Canvas') var ctx = canvas.getContext('2d') var i = 0; var t = setInterval(function(){ if( i >= 360 ){ clearInterval(t); } ctx.clearRect(0,0,400,400); ctx.beginPath(); ctx.arc(200,200,160,(Math.PI/180) * i,Math.PI*2,false); ctx.stroke(); i++ },10) } } </script> </body> </html>