JS绘画几个图片有无简单的方法??????
像以下代码,绘画几个图,十烦锁,有无简洁的写洁啦???????var conx = document.getElementById("canvas_id");
var gg = conx.getContext("2d");
var left = [];
left[0]= new Image();
left[1]= new Image();
left[2]= new Image();
left[0].src="left0.png"
left[1].src="left1.png"
left[2].src="left2.png"
left[0].onload=function(){
gg.drawImage(left[0],0,0,32,32);
}
left[1].onload=function(){
gg.drawImage(left[1],0,100,32,32);
}
left[2].onload=function(){
gg.drawImage(left[2],0,200,32,32);
[此贴子已经被作者于2017-11-8 19:06编辑过]