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 Entity
s TransformComponent
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
AnimationCompleteCallback is aFunctionalInterface
for defining functionality that happens when aTransformAnimatorComponent
animation completes. -
Constructor Summary
ConstructorsConstructorDescriptionTransformAnimatorComponent
(EasingFunction easingFunction, long duration) Creates a newTransformAnimatorComponent
with required parameters set. -
Method Summary
Modifier and TypeMethodDescriptionreset()
Resets the elapsed time of the animation back to 0.setAnimationCompleteCallback
(TransformAnimatorComponent.AnimationCompleteCallback animationCompleteCallback) Sets theTransformAnimatorComponent.AnimationCompleteCallback
for 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.void
tickAnimation
(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, wait
Methods inherited from interface technology.sola.ecs.Component
afterDeserialize
-
Constructor Details
-
TransformAnimatorComponent
Creates a newTransformAnimatorComponent
with required parameters set.- Parameters:
easingFunction
- theEasingFunction
duration
- the duration of the animation
-
-
Method Details
-
setAnimationCompleteCallback
public TransformAnimatorComponent setAnimationCompleteCallback(TransformAnimatorComponent.AnimationCompleteCallback animationCompleteCallback) Sets theTransformAnimatorComponent.AnimationCompleteCallback
for 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
- theTransformComponent
to updatedeltaTime
- the time elapsed since previous update
-