Class: FrameTimer

system.process. FrameTimer


new FrameTimer()

A FrameTimer let you run code on a specified time sequence and use the requestAnimationFrame method.

A FrameTimer let you run code on a specified time sequence and use the requestAnimationFrame method.

See:
Example
var finish = function( action )
{
    trace( action + " finish" ) ;
}

var resume = function( action )
{
    trace( action + " resume" ) ;
}

var start = function( action )
{
    trace( action + " start" ) ;
}

var stop = function( action )
{
    trace( action + " stop" ) ;
}

var progress = function( action )
{
    trace( action + " progress" ) ;
    if( count++ === 100 )
    {
        action.stop() ;
    }
}

var count  = 0 ;
var action = new system.process.FrameTimer() ;

action.finishIt.connect( finish ) ;
action.progressIt.connect( progress ) ;
action.resumeIt.connect( resume ) ;
action.startIt.connect( start ) ;
action.stopIt.connect( stop ) ;

action.run() ;

Extends

Members


<constant> changeIt :system.signals.Signal

The signal emit when the task is changed.

Type:
Inherited From:

<constant> clearIt :system.signals.Signal

The signal emit when the task is cleared.

Type:
Inherited From:

deltaTime :number

Scalar time value from last frame to this frame. This value is capped by setting minFPS and is scaled with "speed".

Type:
  • number
Default Value:
  • 1

elapsedMS :number

Time elapsed in milliseconds from last frame to this frame. Opposed to what the scalar FrameTimer#deltaTime is based, this value is neither capped nor scaled. If the platform supports DOMHighResTimeStamp, this value will have a precision of 1 µs.

Type:
  • number
Default Value:
  • 1 / FPMS

<constant> finishIt :system.signals.Signal

This signal emit when the action is finished.

Type:
Inherited From:

<readonly> fps

The frames per second at which this timer is running. The default is approximately 60 in most modern browsers. Note: This does not factor in the value of FrameTimer#speed, which is specific to scaling FrameTimer#deltaTime.


<constant> infoIt :system.signals.Signal

The signal emit when the task emit a message.

Type:
Inherited From:

lastTime :number

The last time the next method was invoked. This value is also reset internally outside of invoking update, but only when a new animation frame is requested. If the platform supports DOMHighResTimeStamp, this value will have a precision of 1 µs.

Type:
  • number
Default Value:
  • 0

looping :boolean

The flag to determinate if the task must be looped.

Type:
  • boolean
Inherited From:
Default Value:
  • false

<constant> loopIt :system.signals.Signal

The signal emit when the task is looped.

Type:
Inherited From:

minFPS :number

Manages the maximum amount of milliseconds allowed to elapse between invoking FrameTimer#next. This value is used to cap FrameTimer#deltaTime, but does not effect the measured value of FrameTimer#fps. When setting this property it is clamped to a value between 0 and FPMS * 1000.

Type:
  • number

<constant> pauseIt :system.signals.Signal

The signal emit when the task is paused.

Type:
Inherited From:

<readonly> phase :string

Indicates the current phase.

Type:
  • string
Inherited From:
See:

<constant> progressIt :system.signals.Signal

The signal emit when the task is in progress.

Type:
Inherited From:

<constant> resumeIt :system.signals.Signal

The signal emit when the task is resumed.

Type:
Inherited From:

<readonly> running :boolean

Indicates action is running.

Type:
  • boolean
Inherited From:

speed :number

Factor of current deltaTime.

Type:
  • number
Default Value:
  • 1
Example

Scales deltaTime to what would be the equivalent of approximately 120 FPS

var timer = new FrameTimer() ;
timer.speed = 2;

<constant> startIt :system.signals.Signal

This signal emit when the action is started.

Type:
Inherited From:

<constant> stopIt :system.signals.Signal

This signal emit when the task is stopped.

Type:
Inherited From:

<readonly> stopped

Indicates true if the timer is stopped.


<constant> timeoutIt :system.signals.Signal

The signal emit when the task is out of time.

Type:
Inherited From:

Methods


clone()

Returns a shallow copy of this object.

Overrides:
Returns:

a shallow copy of this object.


isLocked()

Returns true if the object is locked.

Inherited From:
Implements:
Returns:

true if the object is locked.


lock()

Locks the object.

Inherited From:
Implements:

notifyChanged()

Notify when the process is changed.

Inherited From:

notifyCleared()

Notify when the process is cleared.

Inherited From:

notifyFinished()

Notify when the process is finished.

Inherited From:

notifyInfo()

Notify a specific information when the process is changed.

Inherited From:

notifyLooped()

Notify when the process is looped.

Inherited From:

notifyPaused()

Notify when the process is paused.

Inherited From:

notifyProgress()

Notify when the process is progress.

Inherited From:

notifyResumed()

Notify when the process is resumed.

Inherited From:

notifyStarted()

Notify when the process is started.

Inherited From:

notifyStopped()

Notify when the process is stopped.

Inherited From:

notifyTimeout()

Notify when the process is out of time.

Inherited From:

reset()

Reset the timer and stop it before if it's running.

Overrides:

resume()

Restarts the timer. The timer is stopped, and then started.

Overrides:

run()

Run the timer.

Overrides:

start()

Starts the task.

Inherited From:
Implements:

stop()

Stops the timer.

Overrides:

toString()

Returns the string representation of this instance.

Returns:

the string representation of this instance.


unlock()

Unlocks the object.

Inherited From:
Implements: