Package nl.saxion.gameapp.animation
Class Tween
Tween allows you to animate properties of an object over time with GSAP-like chaining.
-
Method Summary
Modifier and TypeMethodDescriptiondelay(float seconds) Set a delay before starting.duration(float duration) Set the duration of this Tween (for all steps).ease(com.badlogic.gdx.math.Interpolation interpolation) Set the easing interpolation for this Tween.floatfloatReturns the total duration including all steps and the start delay.booleanChecks whether the animation or interpolation has finished.static TweenStart tweening a specific object.onComplete(Runnable callback) Callback when this tween finishes.voidreset(boolean reverse) Resets the animation or interpolation to its initial state.Add a property to tween to a target value.toX(float x) Shortcut for X property (example for position).toY(float y) Shortcut for Y property.update(float deltaTime) Update the tween.Methods inherited from class nl.saxion.gameapp.animation.Animatable
reset
-
Method Details
-
on
Start tweening a specific object. -
to
Add a property to tween to a target value. -
toX
Shortcut for X property (example for position). -
toY
Shortcut for Y property. -
duration
Set the duration of this Tween (for all steps). -
ease
Set the easing interpolation for this Tween. -
delay
Set a delay before starting. -
onComplete
Callback when this tween finishes. -
getStartOffset
public float getStartOffset() -
getTotalDuration
public float getTotalDuration()Returns the total duration including all steps and the start delay. -
update
Update the tween. Call every frame with delta time.- Specified by:
updatein classAnimatable<Void>- Parameters:
deltaTime- the time in seconds since the last update- Returns:
-
isFinished
public boolean isFinished()Description copied from class:AnimatableChecks whether the animation or interpolation has finished.For looping animations, this may always return
false.- Specified by:
isFinishedin classAnimatable<Void>- Returns:
trueif the animation or interpolation has completed,falseotherwise
-
reset
public void reset(boolean reverse) Description copied from class:AnimatableResets the animation or interpolation to its initial state.Subclasses may implement the
reverseflag to play the animation backward if desired.- Specified by:
resetin classAnimatable<Void>- Parameters:
reverse- whether to reset in reverse mode (if supported)
-