Class Animation.ExclusiveRunner
- Enclosing class:
Animation
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancels the actual animation that runs in the runner's context.void
Starts the animation and executes the animation in a loop infinitely.void
Starts the animation passed by animation and executes the animation exactly once.
-
Constructor Details
-
ExclusiveRunner
public ExclusiveRunner()
-
-
Method Details
-
run
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.
- Parameters:
animation
- The animation to run.
-
loop
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.
- Parameters:
animation
- The animation to loop.
-
cancel
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.
-