Class TweenEngine
java.lang.Object
de.gurkenlabs.litiengine.tweening.TweenEngine
- All Implemented Interfaces:
ILaunchable
,IUpdateable
public class TweenEngine
extends java.lang.Object
implements IUpdateable, ILaunchable
The TweenEngine is the central manager for Tweens. It tracks all current Tween instances and applies their
TweenEquation
with every GameLoop
update.Constructor Summary
Constructors Constructor Description TweenEngine()
Instantiates a newTweenEngine
.Method Summary
Modifier and Type Method Description Tween
begin(Tweenable target, TweenType type, int duration)
Begins a new Tween.Tween
getTween(Tweenable target, TweenType type)
Attempts to get a previously registeredTween
or registers a new one.java.util.Map<Tweenable,java.util.Map<TweenType,Tween>>
getTweens()
Gets the map of registeredTweens
.void
remove(Tweenable target, TweenType type)
Looks for a registered Tween instance with the given target and type.Tween
reset(Tweenable target, TweenType type)
Looks for a registered Tween instance with the given target and type.Tween
resume(Tweenable target, TweenType type)
Looks for a registered Tween instance with the given target and type.void
start()
Start.Tween
stop(Tweenable target, TweenType type)
Looks for a registered Tween instance with the given target and type.void
terminate()
Terminate.void
update()
Updates all registered Tweens by applying theTweenEquation
.
Constructor Details
TweenEngine
public TweenEngine()Instantiates a newTweenEngine
.
Method Details
begin
Begins a new Tween. If a Tween is already registered for theTweenable
with the givenTweenType
, it is restarted with the given duration.- Parameters:
target
- theTweenable
target objecttype
- theTweenType
determining which values of the target object will be modified.duration
- the duration of the Tween in milliseconds.- Returns:
- the Tween instance
getTween
Attempts to get a previously registeredTween
or registers a new one.- Parameters:
target
- theTweenable
target objecttype
- theTweenType
determining which values of the target object will be modified.- Returns:
- the Tween instance
getTweens
Gets the map of registeredTweens
.- Returns:
- the map of registered
Tweens
.
reset
Looks for a registered Tween instance with the given target and type. Attempts to stop the Tween and reset theTweenable
values to the start values.- Parameters:
target
- theTweenable
target objecttype
- theTweenType
determining which values of the target object will be modified.- Returns:
- the Tween instance
resume
Looks for a registered Tween instance with the given target and type. Attempts to resume the Tween if it was stopped.- Parameters:
target
- theTweenable
target objecttype
- theTweenType
determining which values of the target object will be modified.- Returns:
- the Tween instance
start
public void start()Start.- Specified by:
start
in interfaceILaunchable
remove
Looks for a registered Tween instance with the given target and type. Attempts to remove the Tween from the TweenEngine.- Parameters:
target
- theTweenable
target objecttype
- theTweenType
determining which values of the target object will be modified.
stop
Looks for a registered Tween instance with the given target and type. Attempts to stop the Tween.- Parameters:
target
- theTweenable
target objecttype
- theTweenType
determining which values of the target object will be modified.- Returns:
- the Tween instance
terminate
public void terminate()Terminate.- Specified by:
terminate
in interfaceILaunchable
update
public void update()Updates all registered Tweens by applying theTweenEquation
.- Specified by:
update
in interfaceIUpdateable
- See Also:
ClientConfiguration.setMaxFps(int)