Package yearreview.app.animation
Class AnimatedVector2D
java.lang.Object
yearreview.app.animation.AnimatedVector2D
A Vector that is animated using two
AnimatedNumbers for the x- and y-values.- Author:
- ColdSotne37
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AnimatedNumberAnimator for the x-value.private final AnimatedNumberAnimator for the y-value. -
Constructor Summary
ConstructorsConstructorDescriptionAnimatedVector2D(Vector2D initialVector) Constructs a new AnimatedVector2D from an initial position.AnimatedVector2D(Vector2D initialVector, AnimationCurve defaultCurve) Constructs a new AnimatedVector2D from an initial position and a Curve to use for animation. -
Method Summary
Modifier and TypeMethodDescriptionvoidAnimates the Vector to a new position using the default Duration and Curve.voidAnimates the Vector to a new position using the default Curve.voidanimateTo(Vector2D pos, Duration d, AnimationCurve c) Animates the Vector to a new position.Gets the vector at the current time in the animation.floatgetX()Gets the current x-value of the vector.floatgetY()Gets the current y-value of the vector.
-
Field Details
-
x
Animator for the x-value. -
y
Animator for the y-value.
-
-
Constructor Details
-
AnimatedVector2D
Constructs a new AnimatedVector2D from an initial position.- Parameters:
initialVector- initial position of the AnimatedVector
-
AnimatedVector2D
Constructs a new AnimatedVector2D from an initial position and a Curve to use for animation.- Parameters:
initialVector- initial position of the AnimatedVectordefaultCurve- default curve for all animations
-
-
Method Details
-
animateTo
Animates the Vector to a new position using the default Duration and Curve.- Parameters:
pos- new position to animate to
-
animateTo
Animates the Vector to a new position using the default Curve.- Parameters:
pos- new position to animate tod- duration of the animation
-
animateTo
Animates the Vector to a new position.- Parameters:
pos- new position to animate tod- duration of the animationc- Curve to use for the animation
-
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
-