Package com.jme3.anim.tween
Class Tweens
java.lang.Object
com.jme3.anim.tween.Tweens
Static utility methods for creating common generic Tween objects.
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
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
Creates a tween that inverts the specified delegate tween.static Tween
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
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
Creates a tween that will interpolate over an entire sequence of tweens in order.static Tween
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
Creates a tween that scales the specified delegate tween or tweens to the desired length.
-
Method Details
-
sequence
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
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
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
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
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
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
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 invokedmethod
- name of the method to be invokedargs
- arguments to be passed to the method- Returns:
- a new instance
-
callTweenMethod
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 invokedmethod
- name of the method to be invokedargs
- additional arguments to be passed to the method- Returns:
- a new instance
-
loopCount
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 countdelegates
- the desired sequence of tweens- Returns:
- a new instance
-
loopDuration
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 durationdelegates
- the desired sequence of tweens- Returns:
- a new instance
-
invert
Creates a tween that inverts the specified delegate tween.- Parameters:
delegate
- the desired tween- Returns:
- a new instance
-
cycle
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
-