public static class Animation.ExclusiveRunner
extends java.lang.Object
The ExclusiveRunner class ensures that only exactly one animation is running at the same time in its context. This means if the runner is instructed to run a new animation and there is still an animation running in his context, the already running animation will be stopped before the new one is started.
Constructor and Description |
---|
ExclusiveRunner() |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the actual animation that runs in the runner's context.
|
void |
loop(Animation animation)
Starts the animation and executes the animation in a loop infinitely.
|
void |
run(Animation animation)
Starts the animation passed by animation and executes the animation exactly once.
|
public void run(Animation animation)
Starts the animation passed by animation and executes the animation exactly once. If there is already an animation running in this instance, the animation will be canceled first and then the new animation will be started.
animation
- The animation to run.public void loop(Animation animation)
Starts the animation and executes the animation in a loop infinitely. If there is already an animation running in this instance, the animation will be canceled first and then the new passed animation will be looped until either the method cancel() will be called or a new animation is set.
animation
- The animation to loop.public void cancel()
Cancels the actual animation that runs in the runner's context. The animation is stopped and destroyed. In order to continue a new animation has to be restarted by using either the run() or the loop() method.