恩 我覺得上漂動畫的實現(xiàn)是每次循環(huán)都重新畫了背景和果實 原來的果實并沒有清除掉
飄上去的是一條直線的同學可能是沒有把drawbackground 函數(shù)放入循環(huán)中 于是多個果實疊加出現(xiàn)了直線
也可以用clearRect不斷清屏再重畫來實現(xiàn)動畫效果
飄上去的是一條直線的同學可能是沒有把drawbackground 函數(shù)放入循環(huán)中 于是多個果實疊加出現(xiàn)了直線
也可以用clearRect不斷清屏再重畫來實現(xiàn)動畫效果
2016-12-21
最新回答 / 慕粉13685516540
如果和老師寫的一樣的話,我是通過把canWidth和canHeight換成800,600就可以了,我打印canWidth出來的結(jié)果是NaN,所以我猜那個canWidth可能是帶有px那個吧你可以試試
2016-12-15
果實不出來的同學。注意構(gòu)造函數(shù)、記得申明x和y
var fruitObj = function()
{
this.alive = [];//bool
this.x = [];//
this.y = [];//
this.orange = new Image();
this.blue = new Image();
}
var fruitObj = function()
{
this.alive = [];//bool
this.x = [];//
this.y = [];//
this.orange = new Image();
this.blue = new Image();
}
2016-12-12
var type=Math.random()<0.3?blue:orange;
this.fruitType[i]=type;
this.fruitType[i]=type;
2016-12-11