Constructors
constructor
- new Ticker(targetFps?: number): Ticker
Parameters
Optional targetFps: number
Properties
Private _Time
_Time: any
Private _animationId
_animationId: any
Private _interval
_interval: any
Private _lastTime
_lastTime: any
Private _paused
_paused: any
Private _raf
_raf: any
Private _realFPS
_realFPS: any
Private _targetFPS
_targetFPS: any
Private _tick
_tick: any
Private _tickCount
_tickCount: any
Private _tickTime
_tickTime: any
Private _tickers
_tickers: any
Private _timeoutId
_timeoutId: any
Accessors
realFPS
Returns number
targetFPS
- set targetFPS(val: number): void
Parameters
Returns void
Methods
addTick
- addTick(ticker: any): void
Parameters
Returns void
clearTickers
Returns void
destroy
Returns void
interval
- interval(callback: any, delay: any): ((delta: any) => void)
Parameters
Returns ((delta: any) => void)
nextTick
- nextTick(callback: any): void
Parameters
Returns void
pause
Returns void
removeTick
- removeTick(tick: any): void
Parameters
Returns void
resume
Returns void
start
- start(raf?: boolean): void
Parameters
Returns void
stop
Returns void
timeout
- timeout(callback: any, delay: any): ((delta: any) => void)
Parameters
Returns ((delta: any) => void)
Ticker 可以按指定帧率重复运行,从而按计划执行代码。
中包含每一帧需要执行的回调
暂停
Time 实例,用于计算时间, 单位为毫秒
是否使用 requestAnimation
用于清除定时器
用于清除定时器
初始化FPS
_targetFPS 下每帧的时间
执行了帧次 ( 值为 0~_targetFPS)
_tickCount的执行时间总和
真实FPS(执行_targetFPS次的帧频) _realFPS = 1000 /(_tickTime / _tickCount) 调用方式 ticker = new Ticker(60); ticker.addTick((delta)=>scene.render()); ticker.addTick((delta)=>Animation.tick(delta)); ticker.start();