Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Timeline

A Timeline object is a subclass of Animation that manages, syncs and controls multiple animations. All animations within are controlled by a single timeline, resulting in animations being synced across time during playback.

Hierarchy

Implements

Index

Constructors

constructor

  • Initializes a new timeline instance with the provided configuration.

    memberof

    Timeline

    Parameters

    Returns Timeline

Properties

totalIntervals

totalIntervals: number

Accessors

animations

  • get animations(): {}
  • set animations(value: {}): void
  • The animation instances being managed by this timeline.

    memberof

    Timeline

    Returns {}

  • The animation instances being managed by this timeline.

    memberof

    Timeline

    Parameters

    Returns void

currentOffset

  • get currentOffset(): number
  • Returns the current time offset from the beginning of the animation in milliseconds.

    readonly
    memberof

    Animation

    Returns number

currentTime

  • get currentTime(): number
  • Returns the current time of the animation's position in milliseconds.

    readonly
    memberof

    Animation

    Returns number

duration

  • get duration(): number
  • set duration(value: number): void
  • Total time in seconds for the animation to complete. The animation speed will be determined by the duration and total intervals, so a longer duration will result in a slower animation speed for the same number of intervals.

    memberof

    Animation

    Returns number

  • Total time in seconds for the animation to complete. The animation speed will be determined by the duration and total intervals, so a longer duration will result in a slower animation speed for the same number of intervals.

    memberof

    Animation

    Parameters

    • value: number

    Returns void

endDelay

  • get endDelay(): number
  • set endDelay(value: number): void
  • Delay duration in seconds to hold the last interval of the animation before restarting from the beginning.

    memberof

    Animation

    Returns number

  • Delay duration in seconds to hold the last interval of the animation before restarting from the beginning.

    memberof

    Animation

    Parameters

    • value: number

    Returns void

from

  • get from(): number
  • set from(value: number): void
  • Starting Epoch timestamp in milliseconds.

    memberof

    Animation

    Returns number

  • Starting Epoch timestamp in milliseconds.

    memberof

    Animation

    Parameters

    • value: number

    Returns void

increment

  • get increment(): number
  • Returns number

key

  • get key(): string
  • The key associated with the animation, if any.

    readonly
    memberof

    Animation

    Returns string

now

  • get now(): Date
  • set now(value: Date): void
  • Current time value that represents now. This value is used to determine past/future time periods within the full time range.

    memberof

    Animation

    Returns Date

  • Current time value that represents now. This value is used to determine past/future time periods within the full time range.

    memberof

    Animation

    Parameters

    • value: Date

    Returns void

position

  • get position(): number
  • set position(value: number): void
  • The animation's current position in the range of 0 to 1.0, where 0 is the beginning and 1.0 is the end.

    memberof

    Animation

    Returns number

  • The animation's current position in the range of 0 to 1.0, where 0 is the beginning and 1.0 is the end.

    memberof

    Animation

    Parameters

    • value: number

    Returns void

timeline

  • Parent timeline managing this animation, if any.

    memberof

    Animation

    Returns Timeline

  • Parent timeline managing this animation, if any.

    memberof

    Animation

    Parameters

    Returns void

to

  • get to(): number
  • set to(value: number): void
  • Ending Epoch timestamp in milliseconds.

    memberof

    Animation

    Returns number

  • Ending Epoch timestamp in milliseconds.

    memberof

    Animation

    Parameters

    • value: number

    Returns void

totalTime

  • get totalTime(): number
  • Returns the total time, in milliseconds, of the animation based on the start and end timestamps.

    readonly
    memberof

    Animation

    Returns number

Methods

add

  • add(key: string, animation: Animation): void
  • Adds an animation instance to the timeline for the specified key.

    memberof

    Timeline

    Parameters

    Returns void

alwaysShow

  • alwaysShow(): boolean
  • Returns whether the animation should be shown regardless of time.

    memberof

    Animation

    Returns boolean

canAnimate

  • canAnimate(): boolean
  • Returns whether or not the animation can animation.

    This method will return false if the animation's from and to values are the same, or if the animation is disabled.

    memberof

    Animation

    Returns boolean

canShow

  • canShow(time?: number): boolean
  • Returns whether the animation should be visible for the specified time.

    This method will return false if the animation is specified as a future animation and the time is in the past, or if the animation is not specified as a future animation and the time is in the future.

    memberof

    Animation

    Parameters

    • Optional time: number

    Returns boolean

containsFuture

  • containsFuture(): boolean
  • Returns whether the animation's time range extends into the future.

    memberof

    Animation

    Returns boolean

containsPast

  • containsPast(): boolean
  • Returns whether the animation's time range extends into the past.

    memberof

    Animation

    Returns boolean

currentDate

  • currentDate(): Date
  • Returns the current time interval as a Date.

    memberof

    Animation

    Returns Date

currentInterval

  • currentInterval(): number
  • Returns the current time interval in milliseconds.

    memberof

    Animation

    Returns number

enabled

  • enabled(enable: boolean): void
  • Sets whether the animation should be enabled.

    memberof

    Animation

    Parameters

    • enable: boolean

    Returns void

endDate

  • endDate(): Date
  • Returns the end date of the animation.

    memberof

    Animation

    Returns Date

endOffset

  • endOffset(): number
  • Returns the current end offset relative to now, in milliseconds.

    memberof

    Animation

    Returns number

endsAtNow

  • endsAtNow(): boolean
  • Returns boolean

get

  • Returns the timeline animation associated with the specified key, if exists.

    memberof

    Timeline

    Parameters

    • key: string

    Returns Animation

goToInit

  • goToInit(): void
  • Called when an animation is first created, stopped or reset and determines the time interval to display for the static position so that it's closest to the current time as possible.

    memberof

    Animation

    Returns void

goToTime

has

  • has(type: string): boolean
  • Returns whether the listeners are registered for the specified event name.

    memberof

    EventDispatcher

    Parameters

    • type: string

    Returns boolean

isAnimating

  • isAnimating(): boolean
  • Returns whether the animation is currently running.

    memberof

    Animation

    Returns boolean

isAutoPlay

  • isAutoPlay(): boolean
  • Returns whether the animation should automatically begin playback after being created.

    memberof

    Animation

    Returns boolean

isEnabled

  • isEnabled(): boolean
  • Returns whether the animation is currently enabled. Disabled animations would not animate during playback.

    memberof

    Animation

    Returns boolean

isFuture

  • isFuture(): boolean
  • Returns whether the animation has been specified as a future-only animation, meaning it's only valid for time intervals into the future.

    memberof

    Animation

    Returns boolean

isLoading

  • isLoading(): boolean
  • Returns whether internal animations are currently loading data required for playback.

    memberof

    Timeline

    Returns boolean

isPaused

  • isPaused(): boolean
  • Returns whether the animation is currently paused.

    memberof

    Animation

    Returns boolean

isReady

  • isReady(): boolean
  • Returns whether the animation is ready for playback.

    Subclasses may override this value to indicate additional data or assets are required to be loaded in order to begin playback.

    memberof

    Animation

    Returns boolean

neededIntervals

  • neededIntervals(): number[]
  • Returns an array of timestamps defining the interval steps that will be rendered during playback.

    Total intervals returned will be evenly distributed across the animations time range based on the value for opts.intervals.

    memberof

    Animation

    Returns number[]

needsData

  • needsData(): boolean
  • Returns boolean

off

  • Removes a registered listener function for the specified event.

    memberof

    EventDispatcher

    Parameters

    • type: string

      Name of the event to remove the listener for.

    • callback: Function

      Handler function to remove so it won't be executed next time the event is triggered.

    • Default value scope: any = null

    Returns EventDispatcher

offAll

on

  • on(type: string, callback: Function, scope?: any, priority?: number): EventDispatcher
  • Registers a listener function to be executed each time an event occurs

    memberof

    EventDispatcher

    Parameters

    • type: string

      Name of the event to listen for. Value can contain multiple event names separated by spaces to trigger the same handler function for each event name.

    • callback: Function

      Handler function to be called when the event occurs

    • Default value scope: any = null
    • Default value priority: number = 0

    Returns EventDispatcher

once

  • once(type: string, callback: Function, scope?: any, priority?: number): EventDispatcher
  • Registers a listener function to be executed the first time an event occurs.

    memberof

    EventDispatcher

    Parameters

    • type: string

      Name of the event to listen for. Value can contain multiple event names separated by spaces to trigger the same handler function for each event name.

    • callback: Function

      Handler function to be called when the event occurs

    • Default value scope: any = null
    • Default value priority: number = 0

    Returns EventDispatcher

opt

  • opt(key: string, value?: any): any
  • Parameters

    • key: string
    • Optional value: any

    Returns any

pause

  • pause(): void
  • Pauses the animation at the current position.

    To resume playback from a paused animation's current position, use resume().

    memberof

    Timeline

    Returns void

play

  • play(): void
  • Begins playing the animation if not currently running.

    Playback will wait for all internal animation instances to become ready, which means each animation will need to load its required animation data before the timeline can begin playback.

    memberof

    Timeline

    Returns void

refresh

  • refresh(): void
  • Updates the animation's start and end times based on the configured offsets and the current time and date.

    memberof

    Timeline

    Returns void

remove

  • Removes an animation instance from the timeline.

    memberof

    Timeline

    Parameters

    Returns void

removeBy

  • removeBy(key: string): void
  • Removes an animation instance from the timeline for the specified key.

    memberof

    Timeline

    Parameters

    • key: string

    Returns void

reset

  • reset(updateTime?: boolean): void
  • Resets the animation to its original state.

    memberof

    Timeline

    Parameters

    • Default value updateTime: boolean = false

    Returns void

restart

  • restart(): void
  • Restarts the animation from the beginning.

    memberof

    Timeline

    Returns void

resume

  • resume(): void
  • Resumes playing the animation from the paused position.

    memberof

    Animation

    Returns void

setEndDate

  • setEndDate(date: Date | number): this
  • Sets the end date of the animation.

    memberof

    Timeline

    Parameters

    • date: Date | number

    Returns this

setEndOffset

  • setEndOffset(offset: number): this
  • Sets the end date of the animation based on the specified offset relative to now, in milliseconds.

    memberof

    Timeline

    Parameters

    • offset: number

    Returns this

setStartDate

  • setStartDate(date: Date | number): this
  • Sets the start date of the animation.

    memberof

    Timeline

    Parameters

    • date: Date | number

    Returns this

setStartOffset

  • setStartOffset(offset: number): this
  • Sets the start date of the animation based on the specified offset relative to now, in milliseconds.

    memberof

    Timeline

    Parameters

    • offset: number

    Returns this

setTimes

  • setTimes(times: (number | Date)[], every?: number): void
  • Parameters

    • times: (number | Date)[]
    • Default value every: number = 1

    Returns void

startDate

  • startDate(): Date
  • Returns the start date of the animation.

    memberof

    Animation

    Returns Date

startOffset

  • startOffset(): number
  • Returns the current start offset relative to now, in milliseconds.

    memberof

    Animation

    Returns number

startsAtNow

  • startsAtNow(): boolean

stop

  • stop(): void
  • Stops playing the animation if currently running.

    Starting the animation again using start() after calling stop() will restart the animation from the beginning.

    memberof

    Timeline

    Returns void

toggle

  • toggle(): void
  • Either plays or stops the animation playback depending on the current state.

    memberof

    Animation

    Returns void

trigger

  • Triggers the specified event so that all registered listeners will be executed with the specified parameters.

    memberof

    EventDispatcher

    Parameters

    • type: any

      Event name to trigger

    • Default value data: any = null

    Returns EventDispatcher

Generated using TypeDoc