Package com.jme3.anim.tween
Class AbstractTween
java.lang.Object
com.jme3.anim.tween.AbstractTween
- All Implemented Interfaces:
Tween,JmeCloneable,Cloneable
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidcloneFields(Cloner cloner, Object original) Callback fromClonerto convert this shallow-cloned tween into a deep-cloned one, using the specified cloner and original to resolve copied fields.protected abstract voiddoInterpolate(double t) doubleReturns the length of the tween.booleaninterpolate(double t) Default implementation clamps the time value, converts it to 0 to 1.0 based on getLength(), and calls doInterpolate().jmeClone()Create a shallow clone for the JME cloner.voidsetLength(double length)
-
Constructor Details
-
AbstractTween
protected AbstractTween(double length)
-
-
Method Details
-
getLength
public double getLength()Description copied from interface:TweenReturns 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. -
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:
interpolatein interfaceTween- Parameters:
t- animation time (in de-scaled seconds)- Returns:
- true if t>length(), otherwise false
-
doInterpolate
protected abstract void doInterpolate(double t) -
jmeClone
Create a shallow clone for the JME cloner.- Specified by:
jmeClonein interfaceJmeCloneable- Returns:
- a new tween (not null)
-
cloneFields
Callback fromClonerto convert this shallow-cloned tween into a deep-cloned one, using the specified cloner and original to resolve copied fields.- Specified by:
cloneFieldsin interfaceJmeCloneable- Parameters:
cloner- the cloner that's cloning this tween (not null)original- the tween from which this tween was shallow-cloned (unused)
-