Package com.jme3.anim.tween.action
Class Action
java.lang.Object
com.jme3.anim.tween.action.Action
- All Implemented Interfaces:
Tween,JmeCloneable,Cloneable
- Direct Known Subclasses:
BaseAction,BlendableAction
Wraps an array of Tween actions into an action object.
The sequence of tweens is determined by
This implementation mimics the
Created by Nehon.
Notes :
Tweens utility class and the BaseAction interpolates that sequence. AbstractTween, but it delegates the interpolation method Tween.interpolate(double)
to the BlendableAction class. - See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloneFields(Cloner cloner, Object original) Callback fromClonerto convert this shallow-cloned action into a deep-cloned one, using the specified cloner and original to resolve copied fields.doubleRetrieves the length (the duration) of the current action.getMask()Retrieves the animation mask for this action.doublegetSpeed()Retrieves the speedup factor applied by the layer for this action.protected booleanTests whether the Action is running in the "forward" mode.jmeClone()Creates a shallow clone for the JME cloner.protected voidsetForward(boolean forward) Adjusts the forward flag which controls the animation action directionality.voidsetLength(double length) Alters the length (duration) of this Action.voidsetMask(AnimationMask mask) Meant for internal use only.voidsetSpeed(double speed) Alters the speedup factor applied by the layer running this action.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jme3.anim.tween.Tween
interpolate
-
Field Details
-
actions
A sequence of actions which wraps given tween actions.
-
-
Constructor Details
-
Action
Instantiates an action object that wraps a tween actions array by extracting their actions to the collectionactions.Notes :
- If intentions are to wrap some tween actions, then subclasses have to call this constructor, examples :
BlendableActionandBlendAction.- If intentions are to make an implementation of
Actionthat shouldn't wrap tweens of actions, then subclasses shouldn't call this constructor, examples :ClipActionandBaseAction.- Parameters:
tweens- the tween actions to be wrapped (not null).
- If intentions are to wrap some tween actions, then subclasses have to call this constructor, examples :
-
-
Method Details
-
getLength
public double getLength()Retrieves the length (the duration) of the current action. -
setLength
public void setLength(double length) Alters the length (duration) of this Action. This can be used to extend or truncate an Action.- Parameters:
length- the desired length (in unscaled seconds, default=0)
-
getSpeed
public double getSpeed()Retrieves the speedup factor applied by the layer for this action.- Returns:
- the speed of frames.
- See Also:
-
setSpeed
public void setSpeed(double speed) Alters the speedup factor applied by the layer running this action.Notes:
- This factor controls the animation direction, if the speed is a positive value then the animation will run forward and vice versa.
- The speed factor gets applied, inside the
AnimLayer, on each interpolation step by this formula : time += tpf * action.getSpeed() * composer.globalSpeed.- Default speed is 1.0, it plays the animation clips at their normal speed.
- Setting the speed factor to Zero will stop the animation, while setting it to a negative number will play the animation in a backward fashion.
- Parameters:
speed- the speed of frames.
-
getMask
Retrieves the animation mask for this action. The animation mask controls which part of the model would be animated. A model part can be registered using aJoint.- Returns:
- the animation mask instance, or null if this action will animate the entire model
- See Also:
-
setMask
Meant for internal use only.Note: This method can be invoked from the user code only if this Action is wrapped by a
BaseActionand theBaseAction.isMaskPropagationEnabled()is false.- Parameters:
mask- an animation mask to be applied to this action.- See Also:
-
jmeClone
Creates a shallow clone for the JME cloner.- Specified by:
jmeClonein interfaceJmeCloneable- Returns:
- a new action (not null)
-
cloneFields
Callback fromClonerto convert this shallow-cloned action 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 action (not null)original- the action from which this action was shallow-cloned (unused)
-
isForward
protected boolean isForward()Tests whether the Action is running in the "forward" mode.- Returns:
- true if the animation action is running forward, false otherwise.
-
setForward
protected void setForward(boolean forward) Adjusts the forward flag which controls the animation action directionality.- Parameters:
forward- true to run the animation forward, false otherwise.- See Also:
-