SpringAnimation is an animation that is driven by a
SpringForce. The spring force defines
the spring's stiffness, damping ratio, as well as the rest position. Once the SpringAnimation is
started, on each frame the spring force will update the animation's value and velocity.
The animation will continue to run until the spring force reaches equilibrium. If the spring used
in the animation is undamped, the animation will never reach equilibrium. Instead, it will
To create a simple
SpringAnimation that uses the default
// Create an animation to animate view's X property, set the rest position of the
// default spring to 0, and start the animation with a starting velocity of 5000 (pixel/s).
final SpringAnimation anim = new SpringAnimation(view, DynamicAnimation.X, 0)
SpringAnimation can take a pre-configured
use that to drive the animation.
// Create a low stiffness, low bounce spring at position 0.
SpringForce spring = new SpringForce(0)
// Create an animation to animate view's scaleY property, and start the animation using
// the spring above and a starting value of 0.5. Additionally, constrain the range of value for
// the animation to be non-negative, effectively preventing any spring overshoot.
final SpringAnimation anim = new SpringAnimation(view, DynamicAnimation.SCALE_Y)