Package com.jme3.anim.tween.action
Class BaseAction
java.lang.Object
com.jme3.anim.tween.action.Action
com.jme3.anim.tween.action.BaseAction
- All Implemented Interfaces:
Tween
,JmeCloneable
,Cloneable
A simple implementation for the abstract class
Action
to provide a wrapper for a Tween
.
Internally, it is used as a helper class for Action
to extract and gather actions from a tween and interpolate it.
An example showing two clip actions running in parallel at 2x of their ordinary speed by the help of BaseAction on a new Animation Layer :
//create a base action from a tween.
final BaseAction action = new BaseAction(Tweens.parallel(clipAction0, clipAction1));
//set the action properties - utilized within the #Action
class.
baseAction.setSpeed(2f);
//register the action as an observer to the animComposer control.
animComposer.addAction("basicAction", action);
//make a new Layer for a basic armature mask
animComposer.makeLayer(ActionState.class.getSimpleName(), new ArmatureMask());
//run the action within this layer
animComposer.setCurrentAction("basicAction", ActionState.class.getSimpleName());
Created by Nehon.-
Field Summary
-
Constructor Summary
ConstructorDescriptionBaseAction
(Tween tween) Instantiates an action from a tween by extracting the actions from a tween to a list of sub-actions to be interpolated later. -
Method Summary
Modifier and TypeMethodDescriptionboolean
interpolate
(double t) Sets the implementation specific interpolation to the specified 'tween' value as a value in the range from 0 to getLength().boolean
Tests whether the animation mask is applied to the wrapped actionsAction.actions
.void
setMask
(AnimationMask mask) Sets the animation mask which determines which part of the model will be animated by the animation layer.void
setMaskPropagationEnabled
(boolean maskPropagationEnabled) Determines whether to apply the animation mask to the wrapped or child actionsAction.actions
.Methods inherited from class com.jme3.anim.tween.action.Action
cloneFields, getLength, getMask, getSpeed, isForward, jmeClone, setForward, setLength, setSpeed
-
Constructor Details
-
BaseAction
Instantiates an action from a tween by extracting the actions from a tween to a list of sub-actions to be interpolated later.- Parameters:
tween
- a tween to extract the actions from (not null).
-
-
Method Details
-
isMaskPropagationEnabled
public boolean isMaskPropagationEnabled()Tests whether the animation mask is applied to the wrapped actionsAction.actions
.- Returns:
- true if mask propagation to child actions is enabled else returns false.
-
setMaskPropagationEnabled
public void setMaskPropagationEnabled(boolean maskPropagationEnabled) Determines whether to apply the animation mask to the wrapped or child actionsAction.actions
.- Parameters:
maskPropagationEnabled
- If true, then mask set by AnimLayer will be forwarded to all child actions (Default=true).
-
setMask
Sets the animation mask which determines which part of the model will be animated by the animation layer. If theisMaskPropagationEnabled()
is false, setting the mask attribute will not affect the actions under this base action. Setting this to 'null' will animate the entire model. -
interpolate
public boolean interpolate(double t) Description copied from interface:Tween
Sets the implementation specific interpolation to the specified 'tween' value as a value in the range from 0 to getLength(). If the value is greater or equal to getLength() then it is internally clamped and the method returns false. If 't' is still in the tween's range then this method returns true.- Parameters:
t
- animation time (in de-scaled seconds)- Returns:
- true if t>length(), otherwise false
-