Class AnimatedVector2D

java.lang.Object
yearreview.app.animation.AnimatedVector2D

public class AnimatedVector2D extends Object
A Vector that is animated using two AnimatedNumbers for the x- and y-values.
Author:
ColdSotne37
  • Field Details

  • Constructor Details

    • AnimatedVector2D

      public AnimatedVector2D(Vector2D initialVector)
      Constructs a new AnimatedVector2D from an initial position.
      Parameters:
      initialVector - initial position of the AnimatedVector
    • AnimatedVector2D

      public AnimatedVector2D(Vector2D initialVector, AnimationCurve defaultCurve)
      Constructs a new AnimatedVector2D from an initial position and a Curve to use for animation.
      Parameters:
      initialVector - initial position of the AnimatedVector
      defaultCurve - default curve for all animations
  • Method Details

    • animateTo

      public void animateTo(Vector2D pos)
      Animates the Vector to a new position using the default Duration and Curve.
      Parameters:
      pos - new position to animate to
    • animateTo

      public void animateTo(Vector2D pos, Duration d)
      Animates the Vector to a new position using the default Curve.
      Parameters:
      pos - new position to animate to
      d - duration of the animation
    • animateTo

      public void animateTo(Vector2D pos, Duration d, AnimationCurve c)
      Animates the Vector to a new position.
      Parameters:
      pos - new position to animate to
      d - duration of the animation
      c - Curve to use for the animation
    • getVector

      public Vector2D getVector()
      Gets the vector at the current time in the animation.
      Returns:
      animated vector
    • getX

      public float getX()
      Gets the current x-value of the vector.
      Returns:
      animated x-value
    • getY

      public float getY()
      Gets the current y-value of the vector.
      Returns:
      animated y-value