大魚在 canvas1 上沒有顯示
場景設(shè)置:
#canvas1{
position:absolute;
bottom:0;
left:0;
z-index:1;
}
#canvas2{
position:absolute;
bottom:0;
left:0;
z-index:0;
}
畫布獲?。?/p>
can1=document.getElementById("canvas1");
ctx1=can1.getContext('2d');/* 繪制 2d 場景 */
大魚設(shè)置:
this.x =canWidth * 0.5;
this.y =canHeight * 0.5;
ctx1.drawImage(this.bigEye, -this.bigEye * 0.5, -this.bigEye * 0.5);
ctx1.drawImage(this.bigBody, -this.bigBody * 0.5, -this.bigBody * 0.5);
ctx1.drawImage(this.bigTail, -this.bigTail * 0.5 + 30, -this.bigTail * 0.5);
2016-08-12
可是為什么老師寫的ctx1.drawImage()大魚是能夠出來的呢。
2016-03-16
ctx1.drawImage(this.bigEye, -this.bigEye * 0.5, -this.bigEye * 0.5); ?
寫錯(cuò)了,應(yīng)該是?
ctx2.drawImage(this.bigEye, -this.bigEye.width * 0.5, -this.bigEye.height * 0.5);
2016-02-19
draw()函數(shù)要在mian.js中調(diào)用