Class AnimationFactory

java.lang.Object
com.jme3.animation.AnimationFactory

@Deprecated public class AnimationFactory extends Object
Deprecated.
A convenience class to easily set up a spatial keyframe animation. You can add some keyFrames for a given time or a given keyFrameIndex, for translation, rotation, and scale. The animationFactory will then generate an appropriate SpatialAnimation by interpolating values between the keyFrames.

Usage is :
- Create the AnimationFactory
- add some keyFrames
- call the buildAnimation() method that will return a new Animation
- add the generated Animation to any existing AnimationControl


Note that the first keyFrame (index 0) is defaulted with the identity transform. If you want to change that you have to replace this keyFrame with the transform you want.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
    Deprecated.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected float
    Deprecated.
    Animation duration in seconds
    protected int
    Deprecated.
    frames per seconds
    Deprecated.
     
    protected Vector3f[]
    Deprecated.
     
    protected Vector3f[]
    Deprecated.
    The map of keyFrames to compute the animation.
    protected String
    Deprecated.
    Name of the animation
    protected Quaternion[]
    Deprecated.
    rotation array for this animation
    protected Vector3f[]
    Deprecated.
    scales array for this animation
    protected float[]
    Deprecated.
    Time array for this animation
    protected int
    Deprecated.
    total number of frames
    protected float
    Deprecated.
    time per frame
    protected Vector3f[]
    Deprecated.
    Translation array for this animation
  • Constructor Summary

    Constructors
    Constructor
    Description
    AnimationFactory(float duration, String name)
    Deprecated.
    Creates an AnimationFactory
    AnimationFactory(float duration, String name, int fps)
    Deprecated.
    Creates an AnimationFactory
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addKeyFrameRotation(int keyFrameIndex, Quaternion rotation)
    Deprecated.
    Adds a key frame for the given rotation at the given keyFrame index
    This can't be used if the interpolated angle is higher than PI (180°)
    Use addKeyFrameRotationAngles(int keyFrameIndex, float x, float y, float z) instead that uses Euler angle rotations.
    void
    addKeyFrameRotationAngles(int keyFrameIndex, float x, float y, float z)
    Deprecated.
    Adds a key frame for the given rotation at the given key frame index.
    Rotation is expressed by Euler angles in radians.
    Note that the generated rotation will be stored as a quaternion and interpolated using a spherical linear interpolation (slerp)
    Hence, this method may create intermediate keyFrames if the interpolation angle is higher than PI to ensure continuity in animation
    void
    addKeyFrameScale(int keyFrameIndex, Vector3f scale)
    Deprecated.
    Adds a key frame for the given scale at the given keyFrame index
    void
    addKeyFrameTransform(int keyFrameIndex, Transform transform)
    Deprecated.
    Adds a key frame for the given Transform at the given keyFrame index
    void
    addKeyFrameTranslation(int keyFrameIndex, Vector3f translation)
    Deprecated.
    Adds a key frame for the given translation at the given keyFrame index
    void
    addTimeRotation(float time, Quaternion rotation)
    Deprecated.
    Adds a key frame for the given rotation at the given time
    This can't be used if the interpolated angle is higher than PI (180°)
    Use addTimeRotationAngles(float time, float x, float y, float z) instead that uses Euler angle rotations.
    void
    addTimeRotationAngles(float time, float x, float y, float z)
    Deprecated.
    Adds a key frame for the given rotation at the given time.
    Rotation is expressed by Euler angles in radians.
    Note that the generated rotation will be stored as a quaternion and interpolated using a spherical linear interpolation (slerp)
    Hence, this method may create intermediate keyFrames if the interpolation angle is higher than PI to ensure continuity in animation
    void
    addTimeScale(float time, Vector3f scale)
    Deprecated.
    Adds a key frame for the given scale at the given time
    void
    addTimeTransform(float time, Transform transform)
    Deprecated.
    Adds a key frame for the given Transform at the given time
    void
    addTimeTranslation(float time, Vector3f translation)
    Deprecated.
    Adds a key frame for the given translation at the given time
    Deprecated.
    Creates an Animation based on the keyFrames previously added to the factory.

    Methods inherited from class java.lang.Object

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

    • name

      protected String name
      Deprecated.
      Name of the animation
    • fps

      protected int fps
      Deprecated.
      frames per seconds
    • duration

      protected float duration
      Deprecated.
      Animation duration in seconds
    • totalFrames

      protected int totalFrames
      Deprecated.
      total number of frames
    • tpf

      protected float tpf
      Deprecated.
      time per frame
    • times

      protected float[] times
      Deprecated.
      Time array for this animation
    • translations

      protected Vector3f[] translations
      Deprecated.
      Translation array for this animation
    • rotations

      protected Quaternion[] rotations
      Deprecated.
      rotation array for this animation
    • scales

      protected Vector3f[] scales
      Deprecated.
      scales array for this animation
    • keyFramesTranslation

      protected Vector3f[] keyFramesTranslation
      Deprecated.
      The map of keyFrames to compute the animation. The key is the index of the frame
    • keyFramesScale

      protected Vector3f[] keyFramesScale
      Deprecated.
    • keyFramesRotation

      protected AnimationFactory.Rotation[] keyFramesRotation
      Deprecated.
  • Constructor Details

    • AnimationFactory

      public AnimationFactory(float duration, String name)
      Deprecated.
      Creates an AnimationFactory
      Parameters:
      duration - the desired duration for the resulting animation
      name - the name of the resulting animation
    • AnimationFactory

      public AnimationFactory(float duration, String name, int fps)
      Deprecated.
      Creates an AnimationFactory
      Parameters:
      duration - the desired duration for the resulting animation
      name - the name of the resulting animation
      fps - the number of frames per second for this animation (default is 30)
  • Method Details

    • addTimeTransform

      public void addTimeTransform(float time, Transform transform)
      Deprecated.
      Adds a key frame for the given Transform at the given time
      Parameters:
      time - the time at which the keyFrame must be inserted
      transform - the transform to use for this keyFrame
    • addKeyFrameTransform

      public void addKeyFrameTransform(int keyFrameIndex, Transform transform)
      Deprecated.
      Adds a key frame for the given Transform at the given keyFrame index
      Parameters:
      keyFrameIndex - the index at which the keyFrame must be inserted
      transform - the transform to use for this keyFrame
    • addTimeTranslation

      public void addTimeTranslation(float time, Vector3f translation)
      Deprecated.
      Adds a key frame for the given translation at the given time
      Parameters:
      time - the time at which the keyFrame must be inserted
      translation - the translation to use for this keyFrame
    • addKeyFrameTranslation

      public void addKeyFrameTranslation(int keyFrameIndex, Vector3f translation)
      Deprecated.
      Adds a key frame for the given translation at the given keyFrame index
      Parameters:
      keyFrameIndex - the index at which the keyFrame must be inserted
      translation - the translation to use for this keyFrame
    • addTimeRotation

      public void addTimeRotation(float time, Quaternion rotation)
      Deprecated.
      Adds a key frame for the given rotation at the given time
      This can't be used if the interpolated angle is higher than PI (180°)
      Use addTimeRotationAngles(float time, float x, float y, float z) instead that uses Euler angle rotations.
      Parameters:
      time - the time at which the keyFrame must be inserted
      rotation - the rotation Quaternion to use for this keyFrame
      See Also:
    • addKeyFrameRotation

      public void addKeyFrameRotation(int keyFrameIndex, Quaternion rotation)
      Deprecated.
      Adds a key frame for the given rotation at the given keyFrame index
      This can't be used if the interpolated angle is higher than PI (180°)
      Use addKeyFrameRotationAngles(int keyFrameIndex, float x, float y, float z) instead that uses Euler angle rotations.
      Parameters:
      keyFrameIndex - the index at which the keyFrame must be inserted
      rotation - the rotation Quaternion to use for this keyFrame
      See Also:
    • addTimeRotationAngles

      public void addTimeRotationAngles(float time, float x, float y, float z)
      Deprecated.
      Adds a key frame for the given rotation at the given time.
      Rotation is expressed by Euler angles in radians.
      Note that the generated rotation will be stored as a quaternion and interpolated using a spherical linear interpolation (slerp)
      Hence, this method may create intermediate keyFrames if the interpolation angle is higher than PI to ensure continuity in animation
      Parameters:
      time - the time at which the keyFrame must be inserted
      x - the rotation around the x axis (aka yaw) in radians
      y - the rotation around the y axis (aka roll) in radians
      z - the rotation around the z axis (aka pitch) in radians
    • addKeyFrameRotationAngles

      public void addKeyFrameRotationAngles(int keyFrameIndex, float x, float y, float z)
      Deprecated.
      Adds a key frame for the given rotation at the given key frame index.
      Rotation is expressed by Euler angles in radians.
      Note that the generated rotation will be stored as a quaternion and interpolated using a spherical linear interpolation (slerp)
      Hence, this method may create intermediate keyFrames if the interpolation angle is higher than PI to ensure continuity in animation
      Parameters:
      keyFrameIndex - the index at which the keyFrame must be inserted
      x - the rotation around the x axis (aka yaw) in radians
      y - the rotation around the y axis (aka roll) in radians
      z - the rotation around the z axis (aka pitch) in radians
    • addTimeScale

      public void addTimeScale(float time, Vector3f scale)
      Deprecated.
      Adds a key frame for the given scale at the given time
      Parameters:
      time - the time at which the keyFrame must be inserted
      scale - the scale to use for this keyFrame
    • addKeyFrameScale

      public void addKeyFrameScale(int keyFrameIndex, Vector3f scale)
      Deprecated.
      Adds a key frame for the given scale at the given keyFrame index
      Parameters:
      keyFrameIndex - the index at which the keyFrame must be inserted
      scale - the scale to use for this keyFrame
    • buildAnimation

      public Animation buildAnimation()
      Deprecated.
      Creates an Animation based on the keyFrames previously added to the factory.
      Returns:
      the generated animation