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
Modifier and TypeFieldDescriptionprivate final AnimatedNumber
Animator for the x-value.private final AnimatedNumber
Animator for the y-value. -
Constructor Summary
ConstructorDescriptionAnimatedVector2D
(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 TypeMethodDescriptionvoid
Animates the Vector to a new position using the default Duration and Curve.void
Animates the Vector to a new position using the default Curve.void
animateTo
(Vector2D pos, Duration d, AnimationCurve c) Animates the Vector to a new position.Gets the vector at the current time in the animation.float
getX()
Gets the current x-value of the vector.float
getY()
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
-