For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.
Class MaptilerAnimationMaptiler
Constructors
Maptilerconstructor
-
Parameters
- __namedParameters: MaptilerAnimationOptions
Returns MaptilerAnimation
Properties
Readonly Maptilerduration
The duration of the animation in milliseconds (when playbackRate === 1)
Accessors
MaptilerisPlaying
-
get isPlaying(): boolean
Indicates if the animation is currently playing
Returns boolean
- true if the animation is playing, false otherwise
Methods
MaptileraddEventListener
-
Adds an event listener to the animation
Parameters
- type: AnimationEventTypes
The type of event to listen for
- callback: AnimationEventCallback
The callback function to execute when the event occurs
Returns MaptilerAnimation
This animation instance for method chaining
- type: AnimationEventTypes
Maptilerclone
-
Creates a clone of this animation
Returns MaptilerAnimation
A new animation instance with the same properties as this one
Maptilerdestroy
-
Destroys the animation instance, removing all event listeners and stopping playback
Returns void
MaptileremitEvent
-
emitEvent(
event: AnimationEventTypes,
keyframe?: Keyframe | null,
nextKeyframe?: Keyframe | null,
props?: Record<string, number>,
previousProps?: Record<string, number>,
): voidEmits an event to all listeners of a specific type
Parameters
- event: AnimationEventTypes
The type of event to emit
Optionalkeyframe: Keyframe | nullThe keyframe that triggered the event
OptionalnextKeyframe: Keyframe | null- props: Record<string, number> = {}
The interpolated properties at the current delta
OptionalpreviousProps: Record<string, number>
Returns void
- event: AnimationEventTypes
MaptilergetCurrentAndNextKeyFramesAtDelta
-
getCurrentAndNextKeyFramesAtDelta(
delta: number,
): {
current: InterpolatedKeyFrame | null;
next: InterpolatedKeyFrame | null;
}Gets the current and next keyframes at a specific delta value
Parameters
- delta: number
The delta value to query
Returns { current: InterpolatedKeyFrame | null; next: InterpolatedKeyFrame | null }
Object containing current and next keyframes, which may be null
- delta: number
MaptilergetCurrentAndNextKeyFramesAtTime
-
getCurrentAndNextKeyFramesAtTime(
time: number,
): {
current: InterpolatedKeyFrame | null;
next: InterpolatedKeyFrame | null;
}Gets the current and next keyframes at a specific time
Parameters
- time: number
The time position to query
Returns { current: InterpolatedKeyFrame | null; next: InterpolatedKeyFrame | null }
Object containing current and next keyframes, which may be null
- time: number
MaptilergetCurrentDelta
-
Gets the current delta value of the animation
Returns number
The current delta value (normalized progress between 0 and 1)
MaptilergetCurrentTime
-
Gets the current time position of the animation
Returns number
The current time in milliseconds
MaptilergetPlaybackRate
-
Gets the current playback rate
Returns number
The current playback rate
Maptilerpause
Maptilerplay
-
Starts or resumes the animation
Returns MaptilerAnimation
This animation instance for method chaining
MaptilerremoveEventListener
-
removeEventListener(
type: AnimationEventTypes,
callback: AnimationEventCallback,
): MaptilerAnimationRemoves an event listener from the animation
Parameters
- type: AnimationEventTypes
The type of event to remove
- callback: AnimationEventCallback
The callback function to remove
Returns MaptilerAnimation
This animation instance for method chaining
- type: AnimationEventTypes
Maptilerreset
-
Resets the animation to its initial state without stopping
Parameters
- manual: boolean = true
Returns MaptilerAnimation
This animation instance for method chaining
MaptilersetCurrentDelta
-
Sets the current delta value of the animation
Parameters
- delta: number
The delta value to set (normalized progress between 0 and 1)
Returns MaptilerAnimation
This animation instance for method chaining
- delta: number
MaptilersetCurrentTime
-
Sets the current time position of the animation
Parameters
- time: number
The time to set in milliseconds
Returns MaptilerAnimation
This animation instance for method chaining
- time: number
MaptilersetPlaybackRate
-
Sets the playback rate of the animation
Parameters
- rate: number
The playback rate (1.0 is normal speed)
Returns MaptilerAnimation
This animation instance for method chaining
- rate: number
Maptilerstop
-
Stops the animation and resets to initial state
Parameters
- silent: boolean = false
Returns MaptilerAnimation
This animation instance for method chaining
Maptilerupdate
-
Updates the animation state, interpolating between keyframes and emitting events as necessary
Parameters
- manual: boolean = true
- ignoreIteration: boolean = false
Returns MaptilerAnimation
This animation instance for method chaining
MaptilerupdateInternal
-
Updates the animation state if playing, this is used by the AnimationManager to update all animations in the loop
Returns MaptilerAnimation
This animation instance for method chaining
Animation controller for keyframe-based animation sequences.
MaptilerAnimation handles interpolation between keyframes, timing control, and event dispatching during animation playback.
Example
Remarks
The animation supports various playback controls (play, pause, stop, reset), time manipulation, and an event system for tracking animation progress. Properties missing in keyframes will be automatically interpolated.
Animation events include play, pause, stop, timeupdate, iteration, and more.
When not using manualMode, animations are automatically added to the AnimationManager.