Package com.simsilica.lemur.anim
Class TweenAnimation
java.lang.Object
com.simsilica.lemur.anim.TweenAnimation
- All Implemented Interfaces:
Animation
An Animation implementation that tracks execution time and
calls a delegate Tween object once per frame. The animation
can be fast-forwarded and the current exeuction time can be
queried in various ways.
-
Constructor Summary
ConstructorsConstructorDescriptionTweenAnimation
(boolean loop, Tween... delegates) TweenAnimation
(Tween... delegates) -
Method Summary
Modifier and TypeMethodDescriptionboolean
animate
(double tpf) Called by the AnimationState to execute this animation.void
cancel()
Called by the AnimationState when this animation is canceled.void
fastForward
(double t) Fast-forwards the animation to the specified time value.void
fastForwardPercent
(double t) Fast-forwards the animation to the specified time as a value between 0 and 1.0 that will be scaled to the animation duration.double
Returns the total duration for this animation or the time of a single loop iteration if looping.double
Returns the remaining time as a scaled value between 0 and 1.0.double
Returns the remaining time left for this animation.double
getTime()
Returns the current execution time for this animation, ie: how far it has been run.boolean
Returns true if this is a looping animation.boolean
Returns true if the animation is currently running.
-
Constructor Details
-
TweenAnimation
-
TweenAnimation
-
-
Method Details
-
isLooping
public boolean isLooping()Returns true if this is a looping animation. -
isRunning
public boolean isRunning()Returns true if the animation is currently running. -
getLength
public double getLength()Returns the total duration for this animation or the time of a single loop iteration if looping. -
getTime
public double getTime()Returns the current execution time for this animation, ie: how far it has been run. -
getRemaining
public double getRemaining()Returns the remaining time left for this animation. If the animation is looping then this returns the remaining time for the current loop iteration. -
getPercentRemaining
public double getPercentRemaining()Returns the remaining time as a scaled value between 0 and 1.0. -
fastForwardPercent
public void fastForwardPercent(double t) Fast-forwards the animation to the specified time as a value between 0 and 1.0 that will be scaled to the animation duration. -
fastForward
public void fastForward(double t) Fast-forwards the animation to the specified time value. -
animate
public boolean animate(double tpf) Called by the AnimationState to execute this animation. Generally user-code should not call this directly. -
cancel
public void cancel()Called by the AnimationState when this animation is canceled. Generally user-code should not call this directly.
-