老師講的不錯,跟著做覺得挺有意思的,雖然有時候出現(xiàn)和教程的不一樣效果,但是通過自己思考,自己改,還是有收獲的,階段一代碼歡迎fork,適合谷歌瀏覽器,順便給個star啦
https://github.com/zhongshanxian/SUM/tree/master/fish
https://github.com/zhongshanxian/SUM/tree/master/fish
2017-08-05
繪制果實偏移的原因是因為lineWidth和lineCap兩個屬性,指定lineWidth,canvas繪制邏輯是是指定x坐標(biāo)左右各8px的寬度這樣繪制,lineCap屬性會增加8px的高度 所以果實的位置x和y各偏移了8px
2017-07-21
原background.js:
function drawBackground(){
bgPic.onload=function(){
ctx2.drawImage(bgPic,0,0,canWidth,canHeight);
}
}
修改后的:
function drawBackground(){
ctx2.drawImage(bgPic,0,0,canWidth,canHeight);
}
解決了??该鞫葐栴}和漂浮直線問題
function drawBackground(){
bgPic.onload=function(){
ctx2.drawImage(bgPic,0,0,canWidth,canHeight);
}
}
修改后的:
function drawBackground(){
ctx2.drawImage(bgPic,0,0,canWidth,canHeight);
}
解決了??该鞫葐栴}和漂浮直線問題
2017-07-11