added in [version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)   
belongs to Maven artifact com.android.support:support-dynamic-animation:28.0.0-alpha1 Summary: [Inherited Constants](https://developer.android.com/reference/android/support/animation/SpringAnimation#inhconstants) \| [Inherited Fields](https://developer.android.com/reference/android/support/animation/SpringAnimation#inhfields) \| [Ctors](https://developer.android.com/reference/android/support/animation/SpringAnimation#pubctors) \| [Methods](https://developer.android.com/reference/android/support/animation/SpringAnimation#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/support/animation/SpringAnimation#inhmethods) \| [\[Expand All\]](https://developer.android.com/reference/android/support/animation/SpringAnimation#)

# SpringAnimation


`
public

final

class
SpringAnimation
`


`


`

`

extends https://developer.android.com/reference/android/support/animation/DynamicAnimation<https://developer.android.com/reference/android/support/animation/SpringAnimation>


`

`


`

|---|---|---|
| java.lang.Object |||
| ↳ | [android.support.animation.DynamicAnimation](https://developer.android.com/reference/android/support/animation/DynamicAnimation)\<[android.support.animation.SpringAnimation](https://developer.android.com/reference/android/support/animation/SpringAnimation)\> ||
|   | ↳ | android.support.animation.SpringAnimation |

<br />

*** ** * ** ***

SpringAnimation is an animation that is driven by a `https://developer.android.com/reference/android/support/animation/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
oscillate forever.

### Developer Guides

To create a simple `https://developer.android.com/reference/android/support/animation/SpringAnimation` that uses the default `https://developer.android.com/reference/android/support/animation/SpringForce`:

```
 // 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)
         .setStartVelocity(5000);
 anim.start();
 
```

Alternatively, a `https://developer.android.com/reference/android/support/animation/SpringAnimation` can take a pre-configured `https://developer.android.com/reference/android/support/animation/SpringForce`, and
use that to drive the animation.

```
 // Create a low stiffness, low bounce spring at position 0.
 SpringForce spring = new SpringForce(0)
         .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY)
         .setStiffness(SpringForce.STIFFNESS_LOW);
 // 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)
         .setMinValue(0).setSpring(spring).setStartValue(1);
 anim.start();
 
```

<br />

## Summary

### Inherited constants

[![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/animation/SpringAnimation#)From class `
https://developer.android.com/reference/android/support/animation/DynamicAnimation
` `float` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#MIN_VISIBLE_CHANGE_ALPHA`

The minimum visible change in alpha that can be visible to users.


`float` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#MIN_VISIBLE_CHANGE_PIXELS`

The minimum visible change in pixels that can be visible to users.


`float` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#MIN_VISIBLE_CHANGE_ROTATION_DEGREES`

The minimum visible change in degrees that can be visible to users.


`float` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#MIN_VISIBLE_CHANGE_SCALE`

The minimum visible change in scale that can be visible to users.


### Inherited fields

[![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/animation/SpringAnimation#)From class `
https://developer.android.com/reference/android/support/animation/DynamicAnimation
` `
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#ALPHA`

View's alpha property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#ROTATION`

View's rotation property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#ROTATION_X`

View's rotationX property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#ROTATION_Y`

View's rotationY property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#SCALE_X`

View's scaleX property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#SCALE_Y`

View's scaleY property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#SCROLL_X`

View's scrollX property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#SCROLL_Y`

View's scrollY property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#TRANSLATION_X`

View's translationX property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#TRANSLATION_Y`

View's translationY property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#TRANSLATION_Z`

View's translationZ property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#X`

View's x property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#Y`

View's y property.


`
public
static
final
https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty` `https://developer.android.com/reference/android/support/animation/DynamicAnimation#Z`

View's z property.


| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/support/animation/SpringAnimation#SpringAnimation(android.support.animation.FloatValueHolder)(https://developer.android.com/reference/android/support/animation/FloatValueHolder floatValueHolder) ` <br /> This creates a SpringAnimation that animates a `https://developer.android.com/reference/android/support/animation/FloatValueHolder` instance. |
| ` https://developer.android.com/reference/android/support/animation/SpringAnimation#SpringAnimation(K, android.support.animation.FloatPropertyCompat<K>)(K object, https://developer.android.com/reference/android/support/animation/FloatPropertyCompat<K> property) ` This creates a SpringAnimation that animates the property of the given object. |
| ` https://developer.android.com/reference/android/support/animation/SpringAnimation#SpringAnimation(K, android.support.animation.FloatPropertyCompat<K>, float)(K object, https://developer.android.com/reference/android/support/animation/FloatPropertyCompat<K> property, float finalPosition) ` This creates a SpringAnimation that animates the property of the given object. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/support/animation/SpringAnimation#animateToFinalPosition(float)(float finalPosition) ` Updates the final position of the spring. |
| ` boolean` | ` https://developer.android.com/reference/android/support/animation/SpringAnimation#canSkipToEnd()() ` Queries whether the spring can eventually come to the rest position. |
| ` https://developer.android.com/reference/android/support/animation/SpringForce` | ` https://developer.android.com/reference/android/support/animation/SpringAnimation#getSpring()() ` Returns the spring that the animation uses for animations. |
| ` https://developer.android.com/reference/android/support/animation/SpringAnimation` | ` https://developer.android.com/reference/android/support/animation/SpringAnimation#setSpring(android.support.animation.SpringForce)(https://developer.android.com/reference/android/support/animation/SpringForce force) ` Uses the given spring as the force that drives this animation. |
| ` void` | ` https://developer.android.com/reference/android/support/animation/SpringAnimation#skipToEnd()() ` Skips to the end of the animation. |
| ` void` | ` https://developer.android.com/reference/android/support/animation/SpringAnimation#start()() ` Starts an animation. |

### Inherited methods

[![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/animation/SpringAnimation#)From class `

https://developer.android.com/reference/android/support/animation/DynamicAnimation

` `


T` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#addEndListener(android.support.animation.DynamicAnimation.OnAnimationEndListener)(https://developer.android.com/reference/android/support/animation/DynamicAnimation.OnAnimationEndListener listener)
`

Adds an end listener to the animation for receiving onAnimationEnd callbacks.


`


T` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#addUpdateListener(android.support.animation.DynamicAnimation.OnAnimationUpdateListener)(https://developer.android.com/reference/android/support/animation/DynamicAnimation.OnAnimationUpdateListener listener)
`

Adds an update listener to the animation for receiving per-frame animation update callbacks.


`


void` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#cancel()()
`

Cancels the on-going animation.


`


float` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#getMinimumVisibleChange()()
`

Returns the minimum change in the animation property that could be visibly different to
users.


`


boolean` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#isRunning()()
`

Returns whether the animation is currently running.


`


void` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#removeEndListener(android.support.animation.DynamicAnimation.OnAnimationEndListener)(https://developer.android.com/reference/android/support/animation/DynamicAnimation.OnAnimationEndListener listener)
`

Removes the end listener from the animation, so as to stop receiving animation end callbacks.


`


void` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#removeUpdateListener(android.support.animation.DynamicAnimation.OnAnimationUpdateListener)(https://developer.android.com/reference/android/support/animation/DynamicAnimation.OnAnimationUpdateListener listener)
`

Removes the update listener from the animation, so as to stop receiving animation update
callbacks.


`


T` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#setMaxValue(float)(float max)
`

Sets the max value of the animation.


`


T` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#setMinValue(float)(float min)
`

Sets the min value of the animation.


`


T` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#setMinimumVisibleChange(float)(float minimumVisibleChange)
`

This method sets the minimal change of animation value that is visible to users, which helps
determine a reasonable threshold for the animation's termination condition.


`


T` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#setStartValue(float)(float startValue)
`

Sets the start value of the animation.


`


T` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#setStartVelocity(float)(float startVelocity)
`

Start velocity of the animation.


`


void` `
https://developer.android.com/reference/android/support/animation/DynamicAnimation#start()()
`

Starts an animation.


[![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/animation/SpringAnimation#)From class `

java.lang.Object

` `


Object` `
clone()
` `


boolean` `
equals(Object arg0)
` `


void` `
finalize()
` `


final

Class<?>` `
getClass()
` `


int` `
hashCode()
` `


final

void` `
notify()
` `


final

void` `
notifyAll()
` `


String` `
toString()
` `


final

void` `
wait(long arg0, int arg1)
` `


final

void` `
wait(long arg0)
` `


final

void` `
wait()
`

## Public constructors

### SpringAnimation

added in [version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
SpringAnimation (FloatValueHolder floatValueHolder)
```

<br />

This creates a SpringAnimation that animates a `https://developer.android.com/reference/android/support/animation/FloatValueHolder` instance. During
the animation, the `https://developer.android.com/reference/android/support/animation/FloatValueHolder` instance will be updated via
`https://developer.android.com/reference/android/support/animation/FloatValueHolder#setValue(float)` each frame. The caller can obtain the up-to-date
animation value via `https://developer.android.com/reference/android/support/animation/FloatValueHolder#getValue()`.

**Note:** changing the value in the `https://developer.android.com/reference/android/support/animation/FloatValueHolder` via
`https://developer.android.com/reference/android/support/animation/FloatValueHolder#setValue(float)` outside of the animation during an
animation run will not have any effect on the on-going animation.

<br />

| Parameters ||
|---|---|
| `floatValueHolder` | `FloatValueHolder`: the property to be animated <br /> |

### SpringAnimation

added in [version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
SpringAnimation (K object, 
                FloatPropertyCompat<K> property)
```

This creates a SpringAnimation that animates the property of the given object.
Note, a spring will need to setup through `https://developer.android.com/reference/android/support/animation/SpringAnimation#setSpring(android.support.animation.SpringForce)` before
the animation starts.

<br />

| Parameters ||
|---|---|
| `object` | `K`: the Object whose property will be animated <br /> |
| `property` | `FloatPropertyCompat`: the property to be animated <br /> |

### SpringAnimation

added in [version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
SpringAnimation (K object, 
                FloatPropertyCompat<K> property, 
                float finalPosition)
```

This creates a SpringAnimation that animates the property of the given object. A Spring will
be created with the given final position and default stiffness and damping ratio.
This spring can be accessed and reconfigured through `https://developer.android.com/reference/android/support/animation/SpringAnimation#setSpring(android.support.animation.SpringForce)`.

<br />

| Parameters ||
|---|---|
| `object` | `K`: the Object whose property will be animated <br /> |
| `property` | `FloatPropertyCompat`: the property to be animated <br /> |
| `finalPosition` | `float`: the final position of the spring to be created. <br /> |

## Public methods

### animateToFinalPosition

added in [version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
void animateToFinalPosition (float finalPosition)
```

Updates the final position of the spring.

<br />

When the animation is running, calling this method would assume the position change of the spring as a continuous movement since last frame, which yields more accurate results than changing the spring position directly through `https://developer.android.com/reference/android/support/animation/SpringForce#setFinalPosition(float)`.

<br />

If the animation hasn't started, calling this method will change the spring position, and immediately start the animation.

<br />

<br />

| Parameters ||
|---|---|
| `finalPosition` | `float`: rest position of the spring <br /> |

### canSkipToEnd

added in [version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
boolean canSkipToEnd ()
```

Queries whether the spring can eventually come to the rest position.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if the spring is damped, otherwise `false` <br /> |

### getSpring

added in [version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
SpringForce getSpring ()
```

Returns the spring that the animation uses for animations.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/animation/SpringForce` | the spring that the animation uses for animations <br /> |

### setSpring

added in [version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
SpringAnimation setSpring (SpringForce force)
```

Uses the given spring as the force that drives this animation. If this spring force has its
parameters re-configured during the animation, the new configuration will be reflected in the
animation immediately.

<br />

| Parameters ||
|---|---|
| `force` | `SpringForce`: a pre-defined spring force that drives the animation <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/animation/SpringAnimation` | the animation that the spring force is set on <br /> |

### skipToEnd

added in [version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
void skipToEnd ()
```

Skips to the end of the animation. If the spring is undamped, an
`https://developer.android.com/reference/java/lang/IllegalStateException` will be thrown, as the animation would never reach to an end.
It is recommended to check `https://developer.android.com/reference/android/support/animation/SpringAnimation#canSkipToEnd()` before calling this method. This method
should only be called on main thread. If animation is not running, no-op.

<br />

| Throws ||
|---|---|
| `IllegalStateException` | if the spring is undamped (i.e. damping ratio = 0) |
| `https://developer.android.com/reference/android/util/AndroidRuntimeException.html` | if this method is not called on the main thread |

### start

added in [version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
void start ()
```

Starts an animation. If the animation has already been started, no op. Note that calling
`https://developer.android.com/reference/android/support/animation/DynamicAnimation#start()` will not immediately set the property value to start value of the animation.
The property values will be changed at each animation pulse, which happens before the draw
pass. As a result, the changes will be reflected in the next frame, the same as if the values
were set immediately. This method should only be called on main thread.

<br />

-

  ## Interfaces

  - [DynamicAnimation.OnAnimationEndListener](https://developer.android.com/reference/android/support/animation/DynamicAnimation.OnAnimationEndListener)
  - [DynamicAnimation.OnAnimationUpdateListener](https://developer.android.com/reference/android/support/animation/DynamicAnimation.OnAnimationUpdateListener)
-

  ## Classes

  - [DynamicAnimation](https://developer.android.com/reference/android/support/animation/DynamicAnimation)
  - [DynamicAnimation.ViewProperty](https://developer.android.com/reference/android/support/animation/DynamicAnimation.ViewProperty)
  - [FlingAnimation](https://developer.android.com/reference/android/support/animation/FlingAnimation)
  - [FloatPropertyCompat](https://developer.android.com/reference/android/support/animation/FloatPropertyCompat)
  - [FloatValueHolder](https://developer.android.com/reference/android/support/animation/FloatValueHolder)
  - [SpringAnimation](https://developer.android.com/reference/android/support/animation/SpringAnimation)
  - [SpringForce](https://developer.android.com/reference/android/support/animation/SpringForce)