您的位置:首页 > Web前端 > HTML5

利用HTML5画出一个坦克的形状具体实现代码

2013-06-20 11:14 711 查看
var canvas=document.getElementById('myCanvas'); 
var ctx= canvas.getContext('2d'); 
ctx.fillStyle="#99FF66"; 
ctx.fillRect(10,10,15,80); 
//ctx.fillRect(10,80,15,80); 
var canvas=document.getElementById('myCanvas'); 
var ctx= canvas.getContext('2d'); 
ctx.fillStyle="#99FF66"; 
ctx.fillRect(60,10,15,80); 
var canvas=document.getElementById('myCanvas'); 
var ctx= canvas.getContext('2d'); 
ctx.fillStyle="#0033CC"; 
ctx.fillRect(26,27,33,50); 
ctx.fillStyle="red"; 
ctx.beginPath(); 
ctx.arc(43,52,17,0,Math.PI*2,true); 
ctx.closePath(); 
ctx.fill(); 
ctx.strokeTyle="#CCCC00"; 
ctx.lineWidth=2; 
ctx.moveTo(43,52); 
ctx.lineTo(43,10); 
ctx.stroke();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐