Ticker


Module hilo/util/Ticker Requires hilo/core/Class, hilo/util/browser Source Ticker.js
Ticker is a Timer. It can run the code at specified framerate.

Methods

Method Defined
Ticker(fps:Number)
Constructor
Ticker
addTick(tickObject:Object)
Add tickObject.
Ticker
Get the fps.
Ticker
interval(callback:Function, duration:Number):tickObj
指定的时间周期来调用函数, 类似setInterval
Ticker
nextTick(callback:Function):tickObj
下次tick时回调
Ticker
Pause the ticker.
Ticker
removeTick(tickObject:Object)
Remove the tickObject
Ticker
Resume the ticker.
Ticker
start(userRAF:Boolean)
Start the ticker.
Ticker
stop()
Stop the ticker.
Ticker
timeout(callback:Function, duration:Number):tickObj
延迟指定的时间后调用回调, 类似setTimeout
Ticker

Constructor

Ticker(fps:Number)
parameters
fps:Number — The fps of ticker.Default is 60.

Method Detail

addTick(tickObject:Object)
Add tickObject. The tickObject must implement the tick method.
parameters
tickObject:Object — The tickObject to add.It must implement the tick method.
getMeasuredFPS()
Get the fps.
interval(callback:Function, duration:Number):tickObj
指定的时间周期来调用函数, 类似setInterval
parameters
callback:Function
duration:Number — 时间周期,单位毫秒
return
tickObj
nextTick(callback:Function):tickObj
下次tick时回调
parameters
callback:Function
return
tickObj
pause()
Pause the ticker.
removeTick(tickObject:Object)
Remove the tickObject
parameters
tickObject:Object — The tickObject to remove.
resume()
Resume the ticker.
start(userRAF:Boolean)
Start the ticker.
parameters
userRAF:Boolean — Whether or not use requestAnimationFrame, default is true.
stop()
Stop the ticker.
timeout(callback:Function, duration:Number):tickObj
延迟指定的时间后调用回调, 类似setTimeout
parameters
callback:Function
duration:Number — 延迟的毫秒数
return
tickObj