Class AbstractTween

java.lang.Object
com.jme3.anim.tween.AbstractTween
All Implemented Interfaces:
Tween, JmeCloneable, Cloneable

public abstract class AbstractTween extends Object implements JmeCloneable, Tween
Base implementation of the Tween interface that provides default implementations of the getLength() and interpolate() methods that provide common tween clamping and bounds checking. Subclasses need only override the doInterpolate() method and the rest is handled for them.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractTween(double length)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cloneFields(Cloner cloner, Object original)
    Callback from Cloner to convert this shallow-cloned tween into a deep-cloned one, using the specified cloner and original to resolve copied fields.
    protected abstract void
    doInterpolate(double t)
     
    double
    Returns the length of the tween.
    boolean
    interpolate(double t)
    Default implementation clamps the time value, converts it to 0 to 1.0 based on getLength(), and calls doInterpolate().
    Create a shallow clone for the JME cloner.
    void
    setLength(double length)
     

    Methods inherited from class java.lang.Object

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

    • AbstractTween

      protected AbstractTween(double length)
  • Method Details

    • getLength

      public double getLength()
      Description copied from interface: Tween
      Returns the length of the tween. If 't' represents time in seconds then this is the notional time in seconds that the tween will run. Note: all the caveats are because tweens may be externally scaled in such a way that 't' no longer represents actual time.
      Specified by:
      getLength in interface Tween
      Returns:
      the duration (in de-scaled seconds)
    • setLength

      public void setLength(double length)
    • interpolate

      public boolean interpolate(double t)
      Default implementation clamps the time value, converts it to 0 to 1.0 based on getLength(), and calls doInterpolate().
      Specified by:
      interpolate in interface Tween
      Parameters:
      t - animation time (in de-scaled seconds)
      Returns:
      true if t>length(), otherwise false
    • doInterpolate

      protected abstract void doInterpolate(double t)
    • jmeClone

      public AbstractTween jmeClone()
      Create a shallow clone for the JME cloner.
      Specified by:
      jmeClone in interface JmeCloneable
      Returns:
      a new tween (not null)
    • cloneFields

      public void cloneFields(Cloner cloner, Object original)
      Callback from Cloner to convert this shallow-cloned tween into a deep-cloned one, using the specified cloner and original to resolve copied fields.
      Specified by:
      cloneFields in interface JmeCloneable
      Parameters:
      cloner - the cloner that's cloning this tween (not null)
      original - the tween from which this tween was shallow-cloned (unused)