Private
constructorStatic
getReturns the current animation for the passed keys, or undefined if there isn't one. Use this for instance to check if the current animation is yours before removing it.
the objects with which to associate the animation
the current animation for the passed object or undefined.
Static
putStarts the specified animation for the given key. Only one animation can be active for a key at
any given time. Therefore, if another animation is already present for the specified key (and
it is still running), that animation is first stopped and removed.
The Promise returned by putAnimation
will be rejected with an AbortError (for the animation that was aborted).
You should attach a catch()
handler to the putAnimation
Promise to avoid "uncaught promise rejection" errors.
the object with which to associate the animation
the animation to be played back
if true, the animation will run in a loop, thus it will only end when explicitly removed or replaced.
Optional
abortSignal: AbortSignalAn AbortSignal that can be used to abort hthe scheduled animation. When aborted, the putAnimation
promise will be rejected with an AbortError. Make sure to attach a catch()
handler to the putAnimation
Promise to avoid "uncaught promise rejection" errors.
Static
remove
A global manager for animation playback.
Multiple Animation instances can be played back simultaneously. However, each animation must be associated with a particular key. Only one animation can be bound to a single key at the same time, so as to prevent conflicts between animations that try to assign different values to the same parameters of an animated object (e.g. multiple animations that want to modify the camera of the map, cfr. Map.cameraAnimationKey).
This class is a singleton.
An animation is started (Animation.onStart) when being added to the animation manager (putAnimation) and stopped (Animation.onStop) when it has reached the end of its duration, or when it is explicitly removed using removeAnimation. For looping animations the calls on the animation are repeated, thus Animation.onStart will be called each time a new iteration of the animation starts and Animation.onStop after the end of the duration of the animation. This will repeat until the animation is explicitly removed using removeAnimation.
Call order for an animation: