Timeline

Timeline

The Timeline mixin. It contains timeline functionality (controls a series of frames).

Mixes In

  • event_emitter

Members

<static> currentFrame

The number of the current frame. Zero-indexed.

<static> isPlaying

Whether the timeline is playing

Methods

<static> emitFrame()

Emits events for the current frame

<static> frames(frames) → {this}

Adds frames to the timeline. Each frame is a function. Existing frames are overwritten. The `newFrames` parameter can be an array where each index represents a frame, or an object, where keys may be a number plus a unit seconds, percents), e.g. `25`, `5s`, `30%`. Percentages relate to the current length of the timeline.
Parameters:
Name Type Description
frames Array | Object The frames to add
Returns:
Type
this

<static> incrementFrame()

Increments the frame

<static> length(numFrames) → {number|this}

Gets or sets the number of frames in the movie.
Parameters:
Name Type Argument Description
numFrames number <optional>
Returns:
Type
number | this

<static> play(frame) → {this}

Continues playback. If frame is passed, jump to that frame before.
Parameters:
Name Type Argument Description
frame number | string <optional>
A frame number or time expression.
Returns:
Type
this

<static> stop(frame) → {this}

Stops playback. If frame is passed, go to that frame before.
Parameters:
Name Type Argument Description
frame number <optional>
A frame number or time expression.
Returns:
Type
this

<static> toFrameNumber(time) → {number}

Converts a seconds or percentages to a frame number.
Parameters:
Name Type Description
time string A duration in seconds (e.g. '5s') or a percentage (e.g. 15%). To parse percentages, the timeline needs to have a length;
Returns:
A frame number
Type
number