当前位置:主页 > 查看内容

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

发布时间:2021-09-11 00:00| 位朋友查看

简介:复制代码 代码如下: 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=……

复制代码
代码如下:

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();

原文链接:https://m.jb51.net/html5/87540.html
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!
上一篇:.cloud域名需要实名认证吗 下一篇:没有了

推荐图文


随机推荐