Class Action

java.lang.Object
com.jme3.anim.tween.action.Action
All Implemented Interfaces:
Tween, JmeCloneable, Cloneable
Direct Known Subclasses:
BaseAction, BlendableAction

public abstract class Action extends Object implements JmeCloneable, Tween
Wraps an array of Tween actions into an action object.

Notes :

  • The sequence of tweens is determined by Tweens utility class and the BaseAction interpolates that sequence.
  • This implementation mimics the AbstractTween, but it delegates the interpolation method Tween.interpolate(double) to the BlendableAction class.
  • Created by Nehon.
    See Also:
    • Field Summary

      Fields
      Modifier and Type
      Field
      Description
      protected Action[]
      A sequence of actions which wraps given tween actions.
    • Constructor Summary

      Constructors
      Modifier
      Constructor
      Description
      protected
      Action(Tween... tweens)
      Instantiates an action object that wraps a tween actions array by extracting their actions to the collection actions.
    • Method Summary

      Modifier and Type
      Method
      Description
      void
      cloneFields(Cloner cloner, Object original)
      Callback from Cloner to convert this shallow-cloned action into a deep-cloned one, using the specified cloner and original to resolve copied fields.
      double
      Retrieves the length (the duration) of the current action.
      Retrieves the animation mask for this action.
      double
      Retrieves the speedup factor applied by the layer for this action.
      protected boolean
      Tests whether the Action is running in the "forward" mode.
      Creates a shallow clone for the JME cloner.
      protected void
      setForward(boolean forward)
      Adjusts the forward flag which controls the animation action directionality.
      void
      setLength(double length)
      Alters the length (duration) of this Action.
      void
      Meant for internal use only.
      void
      setSpeed(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, wait

      Methods inherited from interface com.jme3.anim.tween.Tween

      interpolate
    • Field Details

      • actions

        protected Action[] actions
        A sequence of actions which wraps given tween actions.
    • Constructor Details

      • Action

        protected Action(Tween... tweens)
        Instantiates an action object that wraps a tween actions array by extracting their actions to the collection actions.

        Notes :

      • If intentions are to wrap some tween actions, then subclasses have to call this constructor, examples : BlendableAction and BlendAction.
      • If intentions are to make an implementation of Action that shouldn't wrap tweens of actions, then subclasses shouldn't call this constructor, examples : ClipAction and BaseAction.
      • Parameters:
        tweens - the tween actions to be wrapped (not null).
    • Method Details

      • getLength

        public double getLength()
        Retrieves the length (the duration) of the current action.
        Specified by:
        getLength in interface Tween
        Returns:
        the length of the action in seconds.
      • 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

        public AnimationMask 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 a Joint.
        Returns:
        the animation mask instance, or null if this action will animate the entire model
        See Also:
      • setMask

        public void setMask(AnimationMask mask)
        Meant for internal use only.

        Note: This method can be invoked from the user code only if this Action is wrapped by a BaseAction and the BaseAction.isMaskPropagationEnabled() is false.

        Parameters:
        mask - an animation mask to be applied to this action.
        See Also:
      • jmeClone

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

        public void cloneFields(Cloner cloner, Object original)
        Callback from Cloner to convert this shallow-cloned action 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 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: