setInterval(()=>{ //this.TsDuration = 0.5; //this.TsDuration = 1; const duration = 0.5; //let str = ' '; //for(let i = 0; i < this.TsTimerBasedTweenSequnceses_Lower_FPS.length; ++i){ for (let i = this.TsTimerBasedTweenSequnceses_Lower_FPS.length - 1; i >= 0; --i) { let tweenObj = this.TsTimerBasedTweenSequnceses_Lower_FPS[i]; if (IsNullOrEmpty(tweenObj) || tweenObj.IsDestroied) { this.TsTimerBasedTweenSequnceses_Lower_FPS.splice(i, 1); continue; } //str += ` ${i}=${tweenObj.ID}`; try { tweenObj.selfUpdate(duration); } catch (error) { LogWarning('[simpletween]--TsTimerBasedTweenSequnceses_Lower_FPS error: ' + error); tweenObj.Destroy(); } } //LogInfo('lower fps length = ' + this.TsTimerBasedTweenSequnceses_Lower_FPS.length + str); }, 500);
时间: 2024-02-14 08:21:33 浏览: 104
这段代码是一个定时器,每500毫秒执行一次,遍历一个数组中的Tween对象,对每个Tween对象进行更新。如果Tween对象已经被销毁,则将其从数组中移除。更新的过程由Tween对象的selfUpdate方法完成,传入的参数为0.5秒。如果更新过程中出现错误,则会通过LogWarning函数记录错误信息,并销毁Tween对象。最后,将数组长度和Tween对象的ID信息记录到日志中。
阅读全文