<!DOCTYPE html> <html> <script type="text/javascript"> window.onload = function(){ var canvas = document.getElementById('canvas'); var context = canvas.getContext('2d'); if(context){ context.lineWidth = 5; context.strokeStyle = "#005588"; for (var i = 0; i < 10; i++) { context.beginPath(); context.arc(50 + i*100,60,40,0,2*Math.PI*(i+1)/10); context.closePath(); context.stroke(); } for (var i = 0; i < 10; i++) { context.beginPath(); context.arc(50 + i*100,180,40,0,2*Math.PI*(i+1)/10); context.stroke(); } for (var i = 0; i < 10; i++) { context.beginPath(); context.arc(50 + i*100,300,40,0,2*Math.PI*(i+1)/10,true); context.stroke(); } context.fillStyle = "red"; for (var i = 0; i < 10; i++) { context.beginPath(); context.arc(50 + i*100,500,40,0,2*Math.PI*(i+1)/10,true); context.fill(); } }else{ alert('当前浏览器不支持Canvas,请更换浏览器后再试'); } } </script> <body> <canvas id="canvas" width="1000" height="800" style="border:1px solid #aaa;display:block;margin:0 auto;"> 当前浏览器不支持Canvas,请更换浏览器后再试 </canvas> </body> </html>
跌落尘层的王者
2014-10-19
0 回答
举报
0/150
提交
取消