Package com.luciad.animations
Class AnimationManager
java.lang.Object
com.luciad.animations.AnimationManager
- All Implemented Interfaces:
AutoCloseable
Class that starts, updates and stops
IAnimation
objects that are assigned to it.
This class is used by the Map
class. See Map#getAnimationManager
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
This struct represents an animation that has beenstarted
inAnimationManager
and has not beenstopped
yet. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
finalize()
Returns the currently ongoing animation if present ornull
if no animation with that key is ongoing.void
startAnimation
(String key, IAnimation animation) Starts a new animation.void
stopAnimation
(String key) Stops the animation that was added with the given key, if present.
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
startAnimation
public void startAnimation(@NotNull String key, @NotNull IAnimation animation) throws NullPointerException Starts a new animation.Upon starting, the animation manager invokes
IAnimation#onStart
on theIAnimation
.Each animation has a key attached to it. You can stop an animation by invoking
AnimationManager#stopAnimation
with this key or you can replace the animation by invokingAnimationManager#startAnimation
with the same key.- Parameters:
key
- The key attached to that animation. If an animation is already playing with that key, the manager stops it before starting the new animation.animation
- TheIAnimation
object to be played, cannot benull
.- Throws:
NullPointerException
- when the passed animation isnull
.
-
stopAnimation
Stops the animation that was added with the given key, if present.If an animation is currently playing with that key, the manager invokes
IAnimation#onStop
on that animation.- Parameters:
key
- The key attached to the animation that should be removed.
-
getCurrentAnimation
Returns the currently ongoing animation if present ornull
if no animation with that key is ongoing.- Parameters:
key
- The key attached to an animation- Returns:
- the currently ongoing animation if present or
null
if no animation with that key is ongoing.
-