Class TweenAnimation

java.lang.Object
com.simsilica.lemur.anim.TweenAnimation
All Implemented Interfaces:
Animation

public class TweenAnimation extends Object implements 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

    Constructors
    Constructor
    Description
    TweenAnimation(boolean loop, Tween... delegates)
     
    TweenAnimation(Tween... delegates)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    animate(double tpf)
    Called by the AnimationState to execute this animation.
    void
    Called by the AnimationState when this animation is canceled.
    void
    fastForward(double t)
    Fast-forwards the animation to the specified time value.
    void
    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
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TweenAnimation

      public TweenAnimation(Tween... delegates)
    • TweenAnimation

      public TweenAnimation(boolean loop, Tween... delegates)
  • 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.
      Specified by:
      animate in interface Animation
    • cancel

      public void cancel()
      Called by the AnimationState when this animation is canceled. Generally user-code should not call this directly.
      Specified by:
      cancel in interface Animation