Package org.vanted.animation
Class Animator
java.lang.Object
org.vanted.animation.Animator
public class Animator extends Object
- Author:
- - Patrick Shaw
-
Constructor Summary
Constructors Constructor Description Animator(Graph graph)Creates an animator will perform a single loop forever.Animator(Graph graph, int noLoops)Creates an animator that will automatically calculate the loop duration to be the same as the animation who's loop duration is largestAnimator(Graph graph, int noLoops, double loopDuration)Creates an animator that needs to have its loop duration manually specified.Animator(Graph graph, int noLoops, int loopDuration, TimeUnit timeUnit)Creates an animator that needs to have its loop duration manually specified.Animator(Graph graph, int noLoops, LoopDuration loopDuration)Creates an animator that needs to have its loop duration manually specified.Animator(Graph graph, NumberOfLoops noLoops)Creates an animator that will automatically calculate the loop duration to be the same as the animation who's loop duration is largest -
Method Summary
Modifier and Type Method Description voidaddAnimation(Animation animation)Call this method any time you want to add an animation.
Can be called while animations are taking place.
Call it whenever you want.voidaddListener(AnimatorListener listener)intgetFPS()Gets the number of times animations are updated per second.booleangetIsAutoLoopDuration()Sets whether the animator is automatically calculating the animator loop duration.doublegetLoopDuration()Get's the loop duration of the animation.intgetNoLoops()Gets the number of times the animator will perform a loop.voidremoveAnimation(Animation animation)Call this method any time you want to remove an animation.
Can be called while animations are taking place.voidremoveListener(AnimatorListener listener)voidreset()Stops the animation and rests it.voidrestart()Resets the animation and starts it again.voidsetFPS(int fps)Sets the number of times animations are updated per second.voidsetIsAutoLoopDuration(boolean isAutoCalculatingLoopDuration)Sets whether the animator is automatically calculating the animator loop duration.voidsetLoopDuration(double loopDuration)Sets the duration of a loop.voidsetLoopDuration(long time, TimeUnit timeUnit)Sets the duration of a loop.voidsetLoopDuration(LoopDuration loopDuration)Sets the duration of a loop.voidsetNoLoops(int noLoops)Sets the number of times the animator will perform a loop.voidsetNoLoops(NumberOfLoops noLoops)The number of times the animator will perform a loop.voidstart()Starts the animatorvoidstop()Stops the animator.
-
Constructor Details
-
Animator
Creates an animator will perform a single loop forever. -
Animator
Creates an animator that will automatically calculate the loop duration to be the same as the animation who's loop duration is largest- Parameters:
noLoops- The number of times the animator will perform.
-
Animator
Creates an animator that will automatically calculate the loop duration to be the same as the animation who's loop duration is largest- Parameters:
noLoops- The number of times the animator will perform.
-
Animator
Creates an animator that needs to have its loop duration manually specified.- Parameters:
noLoops- The number of times the animator will perform.loopDuration- How long each loop in the animator will last.
-
Animator
Creates an animator that needs to have its loop duration manually specified.- Parameters:
noLoops- The number of times the animator will perform.loopDuration- The magnitude of the loop duration.timeUnit- The time unit of the loop duration.
-
Animator
Creates an animator that needs to have its loop duration manually specified.- Parameters:
noLoops- The number of times the animator will perform.loopDuration- How long each loop in the animator will last.
-
-
Method Details
-
setIsAutoLoopDuration
public void setIsAutoLoopDuration(boolean isAutoCalculatingLoopDuration)Sets whether the animator is automatically calculating the animator loop duration.- Parameters:
isAutoCalculatingLoopDuration- If True: The animator will always calculate the loop duration to be the same value as the animation who's loop duration is the largest.
If False: The animator loop duration needs to be set manually.
-
getIsAutoLoopDuration
public boolean getIsAutoLoopDuration()Sets whether the animator is automatically calculating the animator loop duration.- Returns:
- If True: The animator will always calculate the loop duration to be
the same value as the animation who's loop duration is the
largest.
If False: The animator loop duration needs to be set manually.
-
setFPS
public void setFPS(int fps)Sets the number of times animations are updated per second.- Parameters:
fps-
-
getFPS
public int getFPS()Gets the number of times animations are updated per second.- Parameters:
fps-
-
getLoopDuration
public double getLoopDuration()Get's the loop duration of the animation.- Returns:
- The duration of the loop in milliseconds.
-
setLoopDuration
public void setLoopDuration(double loopDuration)Sets the duration of a loop.- Parameters:
duration- The loop duration in milliseconds.
-
setLoopDuration
Sets the duration of a loop. -
setLoopDuration
Sets the duration of a loop.- Parameters:
duration- The time magnitude.The- unit of time being used.
-
getNoLoops
public int getNoLoops()Gets the number of times the animator will perform a loop.- Parameters:
noLoops- -1 = Infinite loop
0 = Doesn't do anything
1 = Will do the animation once
2 = Will do the animation twice
-
setNoLoops
public void setNoLoops(int noLoops)Sets the number of times the animator will perform a loop.- Parameters:
noLoops- -1 = Infinite loop
0 = Doesn't do anything
1 = Will do the animation once
2 = Will do the animation twice
-
setNoLoops
The number of times the animator will perform a loop. -
addAnimation
Call this method any time you want to add an animation.
Can be called while animations are taking place.
Call it whenever you want. -
removeAnimation
Call this method any time you want to remove an animation.
Can be called while animations are taking place. However,
the attribute will not reset to it's original value prior
to the animation if removed. -
addListener
-
removeListener
-
start
public void start()Starts the animator -
stop
public void stop()Stops the animator. -
restart
public void restart()Resets the animation and starts it again. -
reset
public void reset()Stops the animation and rests it.
-