直接修改curShowTimeSeconds為什么不出效果,不明白
function?update(){
????var?nextTime?=?getCurrentShowTimeSeconds()
????if(nextTime!=curShowTimeSeconds)
????????curShowTimeSeconds?=?nextTime;
}curShowTimeSeconds
就會改變,然后下一次setInterval,render就會把時間改變,沒啥錯誤的呀
function?update(){
????var?nextTime?=?getCurrentShowTimeSeconds()
????if(nextTime!=curShowTimeSeconds)
????????curShowTimeSeconds?=?nextTime;
}curShowTimeSeconds
就會改變,然后下一次setInterval,render就會把時間改變,沒啥錯誤的呀
2016-02-29
舉報
2016-02-29
最開始我自己寫的時候,是用定時器來改變時間的,確實能實現;
但是后邊的動畫 還是需要?nextHours 等之類的參數 來 判斷是否要 添加小球,所以我覺得老師的結構還是好的,update時間和小球放在了一起,使用同一批參數;
2016-04-06
主要為后面的動畫做鋪墊的
2016-02-29
function?update(){ ????var?nextShowTimeSeconds?=?getCurrentShowTimeSeconds() ?????var?nextHours?=?parseInt(nextShowTimeSeconds??/?3600) ????var?nextMinutes?=?parseInt(?(nextShowTimeSeconds??-?nextHours?*?3600)/60) ????var?nextSeconds?=?nextShowTimeSeconds?%?60 ??? ?????var?curHours?=?parseInt(curShowTimeSeconds?/?3600) ????var?curMinutes?=?parseInt(?(curShowTimeSeconds?-?curHours?*?3600)/60) ????var?curSeconds?=?curShowTimeSeconds?%?60 ????if(nextSeconds!=curSeconds){ ????????curShowTimeSeconds?=?nextShowTimeSeconds; ????} }這是視頻里講的,像那些nextHours和curMinutes之類的有啥用,不如不用寫,但像我問題里那樣寫就不行?
2016-02-29
倒計時結束時間 是不是小于當前時間了?