Module technology.sola.engine
Class TransformAnimatorComponent
java.lang.Object
technology.sola.engine.graphics.components.animation.TransformAnimatorComponent
- All Implemented Interfaces:
technology.sola.ecs.Component
@NullMarked
public class TransformAnimatorComponent
extends Object
implements technology.sola.ecs.Component
TransformAnimatorComponent is a
Component that contains properties for defining an animation that is applied
to an Entitys TransformComponent.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAnimationCompleteCallback is aFunctionalInterfacefor defining functionality that happens when aTransformAnimatorComponentanimation completes. -
Constructor Summary
ConstructorsConstructorDescriptionTransformAnimatorComponent(EasingFunction easingFunction, long duration) Creates a newTransformAnimatorComponentwith required parameters set. -
Method Summary
Modifier and TypeMethodDescriptionreset()Resets the elapsed time of the animation back to 0.setAnimationCompleteCallback(TransformAnimatorComponent.AnimationCompleteCallback animationCompleteCallback) Sets theTransformAnimatorComponent.AnimationCompleteCallbackfor thisTransformAnimatorComponent.setScale(float scale) Sets the x and y scale values to animate to.setScale(float x, float y) Sets the scale x and scale y values to animate to.setScaleX(float x) Sets the scale x value to animate to.setScaleY(float y) Sets the scale y value to animate to.setTranslate(float x, float y) Sets the x and y values to animate to.setTranslateX(float x) Sets the x value to animate to.setTranslateY(float y) Sets the y value to animate to.voidtickAnimation(TransformComponent transformComponent, float deltaTime) Ticks the animation state by a delta time updating the desiredTransformComponent.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface technology.sola.ecs.Component
afterDeserialize
-
Constructor Details
-
TransformAnimatorComponent
Creates a newTransformAnimatorComponentwith required parameters set.- Parameters:
easingFunction- theEasingFunctionduration- the duration of the animation
-
-
Method Details
-
setAnimationCompleteCallback
public TransformAnimatorComponent setAnimationCompleteCallback(TransformAnimatorComponent.AnimationCompleteCallback animationCompleteCallback) Sets theTransformAnimatorComponent.AnimationCompleteCallbackfor thisTransformAnimatorComponent.- Parameters:
animationCompleteCallback- the callback for when the animation finishes- Returns:
- this
-
setTranslateX
Sets the x value to animate to.- Parameters:
x- the x value to animate to- Returns:
- this
-
setTranslateY
Sets the y value to animate to.- Parameters:
y- the y value to animate to- Returns:
- this
-
setTranslate
Sets the x and y values to animate to.- Parameters:
x- the x value to animate toy- the y value to animate to- Returns:
- this
-
setScaleX
Sets the scale x value to animate to.- Parameters:
x- the scale x value to animate to- Returns:
- this
-
setScaleY
Sets the scale y value to animate to.- Parameters:
y- the scale y value to animate to- Returns:
- this
-
setScale
Sets the x and y scale values to animate to.- Parameters:
scale- the scale value to animate to- Returns:
- this
-
setScale
Sets the scale x and scale y values to animate to.- Parameters:
x- the scale x value to animate toy- the scale y value to animate to- Returns:
- this
-
reset
Resets the elapsed time of the animation back to 0.- Returns:
- this
-
tickAnimation
Ticks the animation state by a delta time updating the desiredTransformComponent.- Parameters:
transformComponent- theTransformComponentto updatedeltaTime- the time elapsed since previous update
-