bgPic.onload = function drawBg(){
ctx2.drawImage(bgPic,0,0,canWidth,canHeight);
}
ctx2.drawImage(bgPic,0,0,canWidth,canHeight);
}
如果,你跟着老师的打而且没有错误的话,老师在main.js里面的fruit = new fruitObj();下一行加个fruit.init();,果实就能出来了。
2017-04-26
ctx1 = can1.context();报错,context() is not a function.
我改成 ctx1 = can1.getContext(); 测试OK
我改成 ctx1 = can1.getContext(); 测试OK