Class Tweens

java.lang.Object
com.jme3.anim.tween.Tweens

public class Tweens extends Object
Static utility methods for creating common generic Tween objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Tween
    callMethod(Object target, String method, Object... args)
    Creates a Tween that will call the specified method and optional arguments whenever supplied a time value greater than or equal to 0.
    static Tween
    callTweenMethod(double length, Object target, String method, Object... args)
    Creates a Tween that will call the specified method and optional arguments, including the time value scaled between 0 and 1.
    static Tween
    cycle(Tween delegate)
    Creates a tween that will cycle back and forth the specified delegate tween.
    static Tween
    delay(double length)
    Creates a tween that will perform a no-op until the length has expired.
    static Tween
    invert(Tween delegate)
    Creates a tween that inverts the specified delegate tween.
    static Tween
    loopCount(int count, Tween... delegates)
    Creates a tween that loops the specified delegate tween or tweens to the desired count.
    static Tween
    loopDuration(double duration, Tween... delegates)
    Creates a tween that loops the specified delegate tween or tweens to the desired duration.
    static Tween
    parallel(Tween... delegates)
    Creates a tween that will interpolate over an entire list of tweens in parallel, ie: all tweens will be run at the same time.
    static Tween
    sequence(Tween... delegates)
    Creates a tween that will interpolate over an entire sequence of tweens in order.
    static Tween
    sineStep(Tween... delegates)
    Creates a tween that uses a sine function to smooth step the time value for the specified delegate tween or tweens.
    static Tween
    smoothStep(Tween... delegates)
    Creates a tween that uses a hermite function to smooth step the time value for the specified delegate tween or tweens.
    static Tween
    stretch(double desiredLength, Tween... delegates)
    Creates a tween that scales the specified delegate tween or tweens to the desired length.

    Methods inherited from class java.lang.Object

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

    • sequence

      public static Tween sequence(Tween... delegates)
      Creates a tween that will interpolate over an entire sequence of tweens in order.
      Parameters:
      delegates - the desired sequence of tweens
      Returns:
      a new instance
    • parallel

      public static Tween parallel(Tween... delegates)
      Creates a tween that will interpolate over an entire list of tweens in parallel, ie: all tweens will be run at the same time.
      Parameters:
      delegates - the tweens to be interpolated
      Returns:
      a new instance
    • delay

      public static Tween delay(double length)
      Creates a tween that will perform a no-op until the length has expired.
      Parameters:
      length - the desired duration (in seconds)
      Returns:
      a new instance
    • stretch

      public static Tween stretch(double desiredLength, Tween... delegates)
      Creates a tween that scales the specified delegate tween or tweens to the desired length. If more than one tween is specified then they are wrapped in a sequence using the sequence() method.
      Parameters:
      desiredLength - the desired duration (in seconds)
      delegates - the desired sequence of tweens
      Returns:
      a new instance
    • sineStep

      public static Tween sineStep(Tween... delegates)
      Creates a tween that uses a sine function to smooth step the time value for the specified delegate tween or tweens. These 'curved' wrappers can be used to smooth the interpolation of another tween.
      Parameters:
      delegates - the desired sequence of tweens
      Returns:
      a new instance
    • smoothStep

      public static Tween smoothStep(Tween... delegates)
      Creates a tween that uses a hermite function to smooth step the time value for the specified delegate tween or tweens. This is similar to GLSL's smoothstep(). These 'curved' wrappers can be used to smooth the interpolation of another tween.
      Parameters:
      delegates - the desired sequence of tweens
      Returns:
      a new instance
    • callMethod

      public static Tween callMethod(Object target, String method, Object... args)
      Creates a Tween that will call the specified method and optional arguments whenever supplied a time value greater than or equal to 0. This creates an "instant" tween of length 0.
      Parameters:
      target - object on which the method is to be invoked
      method - name of the method to be invoked
      args - arguments to be passed to the method
      Returns:
      a new instance
    • callTweenMethod

      public static Tween callTweenMethod(double length, Object target, String method, Object... args)
      Creates a Tween that will call the specified method and optional arguments, including the time value scaled between 0 and 1. The method must take a float or double value as its first or last argument, in addition to whatever optional arguments are specified.

      For example:

      Tweens.callTweenMethod(1, myObject, "foo", "bar")

      Would work for any of the following method signatures:

          void foo(float t, String arg)
          void foo(double t, String arg)
          void foo(String arg, float t)
          void foo(String arg, double t)
       
      Parameters:
      length - the desired duration (in seconds)
      target - object on which the method is to be invoked
      method - name of the method to be invoked
      args - additional arguments to be passed to the method
      Returns:
      a new instance
    • loopCount

      public static Tween loopCount(int count, Tween... delegates)
      Creates a tween that loops the specified delegate tween or tweens to the desired count. If more than one tween is specified then they are wrapped in a sequence using the sequence() method.
      Parameters:
      count - the desired loop count
      delegates - the desired sequence of tweens
      Returns:
      a new instance
    • loopDuration

      public static Tween loopDuration(double duration, Tween... delegates)
      Creates a tween that loops the specified delegate tween or tweens to the desired duration. If more than one tween is specified then they are wrapped in a sequence using the sequence() method.
      Parameters:
      duration - the desired duration
      delegates - the desired sequence of tweens
      Returns:
      a new instance
    • invert

      public static Tween invert(Tween delegate)
      Creates a tween that inverts the specified delegate tween.
      Parameters:
      delegate - the desired tween
      Returns:
      a new instance
    • cycle

      public static Tween cycle(Tween delegate)
      Creates a tween that will cycle back and forth the specified delegate tween. When reaching the end, the tween will play backwards from the end until it reaches the start.
      Parameters:
      delegate - the desired tween
      Returns:
      a new instance