public class

AnimationRunner

extends Object
java.lang.Object
   ↳ com.shinobicontrols.charts.AnimationRunner<T>

Class Overview

Drives an Animation based on time. The progress of the Animation will be related to the elapsed time, since the start, for a specified duration.

The AnimationRunner makes calls to its AnimationRunner.Listeners at the start and end of the animation it is running, as well as when it is cancelled.

Summary

Nested Classes
interface AnimationRunner.Listener<T> Provides a means of being informed about certain events during the course of an Animation
Public Constructors
AnimationRunner(Animation<T> animation, long duration)
Creates a new AnimationRunner with the given Animation and duration.
Public Methods
void addListener(Listener<T> listener)
void cancel()
Cancels the running of the Animation held by this AnimationRunner.
Animation<T> getAnimation()
Returns the Animation this AnimationRunner is set to run.
void removeListener(Listener<T> listener)
Removes the given AnimationRunner.Listener from this AnimationRunner.
void start()
Starts the Animation held by this AnimationRunner.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public AnimationRunner (Animation<T> animation, long duration)

Creates a new AnimationRunner with the given Animation and duration. Negative duration values will be coerced to zero.

Parameters
animation the Animation to run
duration the duration over which to perform the animation, in milliseconds

Public Methods

public void addListener (Listener<T> listener)

Adds an AnimationRunner.Listener to this AnimationRunner. This will be notified of the Animation starting, ending and being cancelled.

Adding a null AnimationRunner.Listener will cause an IllegalArgumentException to be thrown.

Parameters
listener the AnimationRunner.Listener to add, must not be null

public void cancel ()

Cancels the running of the Animation held by this AnimationRunner. If the animation is not running calling this method will do nothing.

public Animation<T> getAnimation ()

Returns the Animation this AnimationRunner is set to run.

Returns

public void removeListener (Listener<T> listener)

Removes the given AnimationRunner.Listener from this AnimationRunner.

Parameters
listener the AnimationRunner.Listener to remove

public void start ()

Starts the Animation held by this AnimationRunner.