com.annahid.libs.artenus.graphics.animation
SpringAnimation
Performs a spring-like animation on an entity. This animation is NOT a complete physical
simulation of a spring, and is just a loose visual effect that can be used for various screen
elements such as menus and buttons.
public final class SpringAnimation implements AnimationHandler
Field Summary
Modifier and Type | Field and Description |
---|---|
public static final | ROTATION Specifies the spring animation should affect the entity's rotational angle. |
public static final | SCALE Specifies the spring animation should affect the entity's scale. |
public static final | X Specifies the animation should affect the x component of the entity's position. |
public static final | Y Specifies the spring animation should affect the y component of the entity's position. |
Constructor Summary
Modifier and Type | Constructor and Description |
---|---|
public | SpringAnimation(int type, float initial, float target) Creates a SpringAnimation with the give type and values. |
public | SpringAnimation(int type, float initial, float target, float kValue, float decayFactor) Creates a SpringAnimation with the give type and values. |
Method Summary
Modifier and Type | Method and Description |
---|---|
public final void | advance(Animatable animatable, float elapsedTime) Called whenever the animation should update the animatable based on elapsed time. |
public float | getCurrentValue() Gets the current value of the property used in the animation. |
public float | getTargetValue() Gets the target value of the property used in the animation. |
public final int | getType() Gets the spring animation type of this SpringAnimation object. |
public final void | setTargetValue(float value) Gets the target value of the property used in the animation. |
Methods inherited from java.lang.Object
clone
, equals
, finalize
, getClass
, hashCode
, notify
, notifyAll
, toString
, wait
, wait
, wait
Field Detail
ROTATION |
---|
public static final ROTATION Specifies the spring animation should affect the entity's rotational angle. |
SCALE |
---|
public static final SCALE Specifies the spring animation should affect the entity's scale. |
X |
---|
public static final X Specifies the animation should affect the x component of the entity's position. |
Y |
---|
public static final Y Specifies the spring animation should affect the y component of the entity's position. |
Constructor Detail
SpringAnimation | ||||||
---|---|---|---|---|---|---|
public SpringAnimation( int type, float initial, float target )Creates a SpringAnimation with the give type and values. The animation will involve the selected component bounce back and forth centered on the target value in a spring motion. For more control over the spring motion, use SpringAnimation(int, float, float, float, float) .Parameters:
See Also:
|
SpringAnimation | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
public SpringAnimation( int type, float initial, float target, float kValue, float decayFactor )Creates a SpringAnimation with the give type and values. The animation will involve the selected component oscillate centered on the target value in a spring motion. You can also specify the K value of the spring and a decay factor to make the motion slow down gradually. Parameters:
|
Method Detail
advance |
---|
public final void advance( Animatable animatable, float elapsedTime ) Called whenever the animation should update the animatable based on elapsed time. Specified By:
|
getCurrentValue |
---|
public float getCurrentValue() Gets the current value of the property used in the animation. Returns:
The value of the selected property; selected property is determined by animation type See Also:
|
getTargetValue |
---|
public float getTargetValue() Gets the target value of the property used in the animation. The target value can be viewed
as the center of oscillation. Returns:
The target value of the selected property; selected property is determined by
animation type See Also:
|
getType |
---|
public final int getType() Gets the spring animation type of this SpringAnimation object. Returns:
The type of spring, which indicates the property of the entity that is affected
by the animation See Also:
|
setTargetValue | ||
---|---|---|
public final void setTargetValue( float value ) Gets the target value of the property used in the animation. The target value can be viewed
as the center of oscillation. Parameters:
See Also:
|