TimelineObject
The return object when creating a new timeline.
timelineInfo
timelineInfo: TimelineInfo
Retrieves information about the timeline. Returns the same object that is passed to the update callback.
See: TimelineInfo
animationsInfo
animationsInfo: CallbackInfo
Retrieves information about all animations. Returns the same object that is passed to the the update callback.
See: AnimationInfo
play()
(startFrom?: number | PercentageString, playCount?: number) => void
Plays the timeline.
Accepts an optional startFrom
parameter that can be a time in milliseconds or a percentage value.
Optionally, you can specify a playCount
to seek to a specific repeat count.
startFrom
The point to start from, specified as a time in milliseconds or a percentage value.
playCount
The repeat count to seek to before playing.
playOneFrame()
playOneFrame: () => void
Plays only one frame of the timeline. If the timeline is already playing, this method does nothing.
pause()
pause: () => void
Pauses the timeline. If the timeline is already paused, it remains paused. If the timeline is not playing, it will not be paused.
resume()
resume: () => void
Resumes the timeline from a paused state. If the timeline is not paused, it will start playing from the beginning. If the timeline is already playing, this method does nothing.
stop()
(stopAt?: number | PercentageString, playCount?: number) => void
Stops the timeline from playing. If no parameters are passed, the animation will skip to the end and stop. You can pass parameters to stop at a specific point in the timeline. If the timeline is not currently playing, it plays only one frame at the specified stop point.
stopAt
The point to stop at, specified as a time in milliseconds or a percentage string.
playCount
The repeat count to stop at.
seek()
(seekTo: number | PercentageString, playCount?: number) => void
Seeks the timeline to a specified time or percentage value. If the timeline is not playing, it will seek without playing.
seekTo
The point to seek to, specified as a time
in milliseconds or a percentage value.
playCount
Default: current playCount The repeat count to seek to before playing.
updateValues()
(newValues: Partial<AnimationOptions>[]) => void
Throws
Updates animations values.
The name
property is required to target a specific animation for updating.
See: AnimationOptions
updateTimelineOptions()
(newValues: Partial<TimelineOptions>) => void
Throws
Updates the options of the timeline.
See: TimelineOptions
on()
on: (event: Event, callback: EventCallback) => EventUnsubscribe
Attaches an event listener to the timeline. returns A function to unsubscribe the event listener.
See: Event
once()
once: (event: Event, callback: EventCallback) => EventUnsubscribe
Attaches an event listener to the timeline that will be triggered only once. returns A function to unsubscribe the event listener.
See: Event
clearEvents()
clearEvents: () => void
Removes all attached event listeners.
onCompleteAsync()
onCompleteAsync: () => Promise<void>
Waits until the timeline completes.
onPlayAsync()
onPlayAsync: () => Promise<void>
Waits until the timeline starts playing.
onResumeAsync()
onResumeAsync: () => Promise<void>
Waits until the timeline resumes.
onPauseAsync()
onPauseAsync: () => Promise<void>
Waits until the timeline pauses.
onStopAsync()
onStopAsync: () => Promise<void>
Waits until the timeline stops.
onRepeatAsync()
onRepeatAsync: () => Promise<void>
Waits until the timeline repeats.