Package pi.animation.tweening
Class TweenEngine
java.lang.Object
pi.animation.tweening.TweenEngine
- All Implemented Interfaces:
FrameUpdateListener
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 -
Method Summary
Modifier and TypeMethodDescriptionBegins a new Tween.Attempts to get a previously registeredTweenor registers a new one.Gets the map of registeredTweens.voidonFrameUpdate(double pastTime) Updates all registered Tweens by applying theTweenEquation.voidLooks for a registered Tween instance with the given target and type.Looks for a registered Tween instance with the given target and type.Looks for a registered Tween instance with the given target and type.voidstart()Start.Looks for a registered Tween instance with the given target and type.voidTerminate.
-
Constructor Details
-
TweenEngine
public TweenEngine()Instantiates a newTweenEngine.
-
-
Method Details
-
begin
Begins a new Tween. If a Tween is already registered for theTweenablewith the givenTweenType, it is restarted with the given duration.- Parameters:
target- theTweenabletarget objecttype- theTweenTypedetermining 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 registeredTweenor registers a new one.- Parameters:
target- theTweenabletarget objecttype- theTweenTypedetermining 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 theTweenablevalues to the start values.- Parameters:
target- theTweenabletarget objecttype- theTweenTypedetermining 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- theTweenabletarget objecttype- theTweenTypedetermining which values of the target object will be modified.- Returns:
- the Tween instance
-
start
public void start()Start. -
remove
Looks for a registered Tween instance with the given target and type. Attempts to remove the Tween from the TweenEngine.- Parameters:
target- theTweenabletarget objecttype- theTweenTypedetermining 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- theTweenabletarget objecttype- theTweenTypedetermining which values of the target object will be modified.- Returns:
- the Tween instance
-
terminate
public void terminate()Terminate. -
onFrameUpdate
public void onFrameUpdate(double pastTime) Updates all registered Tweens by applying theTweenEquation.- Specified by:
onFrameUpdatein interfaceFrameUpdateListener- Parameters:
pastTime- Die Zeit in Sekunden, die seit der letzten Aktualisierung vergangen ist.
-