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.
  • Constructor Details

    • TransformAnimatorComponent

      public TransformAnimatorComponent(EasingFunction easingFunction, long duration)
      Creates a new TransformAnimatorComponent with required parameters set.
      Parameters:
      easingFunction - the EasingFunction
      duration - the duration of the animation
  • Method Details

    • setAnimationCompleteCallback

      public TransformAnimatorComponent setAnimationCompleteCallback(TransformAnimatorComponent.AnimationCompleteCallback animationCompleteCallback)
      Parameters:
      animationCompleteCallback - the callback for when the animation finishes
      Returns:
      this
    • setTranslateX

      public TransformAnimatorComponent setTranslateX(float x)
      Sets the x value to animate to.
      Parameters:
      x - the x value to animate to
      Returns:
      this
    • setTranslateY

      public TransformAnimatorComponent setTranslateY(float y)
      Sets the y value to animate to.
      Parameters:
      y - the y value to animate to
      Returns:
      this
    • setTranslate

      public TransformAnimatorComponent setTranslate(float x, float y)
      Sets the x and y values to animate to.
      Parameters:
      x - the x value to animate to
      y - the y value to animate to
      Returns:
      this
    • setScaleX

      public TransformAnimatorComponent setScaleX(float x)
      Sets the scale x value to animate to.
      Parameters:
      x - the scale x value to animate to
      Returns:
      this
    • setScaleY

      public TransformAnimatorComponent setScaleY(float y)
      Sets the scale y value to animate to.
      Parameters:
      y - the scale y value to animate to
      Returns:
      this
    • setScale

      public TransformAnimatorComponent setScale(float scale)
      Sets the x and y scale values to animate to.
      Parameters:
      scale - the scale value to animate to
      Returns:
      this
    • setScale

      public TransformAnimatorComponent setScale(float x, float y)
      Sets the scale x and scale y values to animate to.
      Parameters:
      x - the scale x value to animate to
      y - the scale y value to animate to
      Returns:
      this
    • reset

      Resets the elapsed time of the animation back to 0.
      Returns:
      this
    • tickAnimation

      public void tickAnimation(TransformComponent transformComponent, float deltaTime)
      Ticks the animation state by a delta time updating the desired TransformComponent.
      Parameters:
      transformComponent - the TransformComponent to update
      deltaTime - the time elapsed since previous update