Namespace: loop

syngen.loop

Provides an event-driven main loop for the application. Systems can subscribe to each frame and respond to state changes. Beware that the loop remains running while paused, which they must choose to respect.

Implements:
Source:

Methods

(static) delta() → {Number}

Returns the time elapsed since the previous frame.

Source:
Returns:
Type
Number

(static) frame() → {Number}

Returns the current frame number since the loop began.

Source:
Returns:
Type
Number

(static) isPaused() → {Boolean}

Returns whether the loop is currently paused.

Source:
Returns:
Type
Boolean

(static) isRunning() → {Boolean}

Returns whether the loop is currently running.

Source:
Returns:
Type
Boolean

(static) pause()

Pauses the loop.

Source:
Fires:

(static) resume()

Resumes the loop.

Source:
Fires:

(static) start()

Starts the loop.

Source:
Fires:

(static) stop()

Stops the loop.

Source:
Fires:

(static) time() → {Number}

Returns the time elapsed since the loop began.

Source:
Returns:
Type
Number

Events

event:frame

Fired every loop frame.

Type:
  • Object
Properties:
Name Type Description
delta Number

Time elapsed since last frame

frame Number

Current frame count of loop

paused Boolean

Whether the loop is paused

time Number

Total elapsed time of loop

Source:
Listeners of This Event:

event:pause

Fired when the loop is paused.

Source:

event:resume

Fired when the loop is resumed.

Source:

event:start

Fired when the loop starts.

Source:

event:stop

Fired when the loop stops.

Source: