SpringForce
class SpringForce
kotlin.Any  
↳  androidx.dynamicanimation.animation.SpringForce 
Spring Force defines the characteristics of the spring being used in the animation.
By configuring the stiffness and damping ratio, callers can create a spring with the look and feel suits their use case. Stiffness corresponds to the spring constant. The stiffer the spring is, the harder it is to stretch it, the faster it undergoes dampening.
Spring damping ratio describes how oscillations in a system decay after a disturbance. When damping ratio > 1* (i.e. overdamped), the object will quickly return to the rest position without overshooting. If damping ratio equals to 1 (i.e. critically damped), the object will return to equilibrium within the shortest amount of time. When damping ratio is less than 1 (i.e. underdamped), the mass tends to overshoot, and return, and overshoot again. Without any damping (i.e. damping ratio = 0), the mass will oscillate forever.
Summary
Constants  

static Float 
Damping ratio for a very bouncy spring. 
static Float 
Damping ratio for a spring with low bounciness. 
static Float 
Damping ratio for a medium bouncy spring. 
static Float 
Damping ratio for a spring with no bounciness. 
static Float 
Stiffness constant for extremely stiff spring. 
static Float 
Stiffness constant for a spring with low stiffness. 
static Float 
Stiffness constant for medium stiff spring. 
static Float 
Stiffness constant for a spring with very low stiffness. 
Public constructors  

<init>() Creates a spring force. 

Creates a spring with a given final rest position. 
Public methods  

SpringForce! 
setDampingRatio(dampingRatio: Float) Spring damping ratio describes how oscillations in a system decay after a disturbance. 
Float 
Gets the stiffness of the spring. 
SpringForce! 
setFinalPosition(finalPosition: Float) Sets the rest position of the spring. 
Float 
Returns the rest position of the spring. 
SpringForce! 
setStiffness(stiffness: Float) Sets the stiffness of a spring. 
Float 
Returns the damping ratio of the spring. 
Constants
DAMPING_RATIO_HIGH_BOUNCY
static val DAMPING_RATIO_HIGH_BOUNCY: Float
Damping ratio for a very bouncy spring. Note for underdamped springs (i.e. damping ratio < 1), the lower the damping ratio, the more bouncy the spring.
Value: 0.2f
DAMPING_RATIO_LOW_BOUNCY
static val DAMPING_RATIO_LOW_BOUNCY: Float
Damping ratio for a spring with low bounciness. Note for underdamped springs (i.e. damping ratio < 1), the lower the damping ratio, the higher the bounciness.
Value: 0.75f
DAMPING_RATIO_MEDIUM_BOUNCY
static val DAMPING_RATIO_MEDIUM_BOUNCY: Float
Damping ratio for a medium bouncy spring. This is also the default damping ratio for spring force. Note for underdamped springs (i.e. damping ratio < 1), the lower the damping ratio, the more bouncy the spring.
Value: 0.5f
DAMPING_RATIO_NO_BOUNCY
static val DAMPING_RATIO_NO_BOUNCY: Float
Damping ratio for a spring with no bounciness. This damping ratio will create a critically damped spring that returns to equilibrium within the shortest amount of time without oscillating.
Value: 1.0f
STIFFNESS_HIGH
static val STIFFNESS_HIGH: Float
Stiffness constant for extremely stiff spring.
Value: 10000.0f
STIFFNESS_LOW
static val STIFFNESS_LOW: Float
Stiffness constant for a spring with low stiffness.
Value: 200.0f
STIFFNESS_MEDIUM
static val STIFFNESS_MEDIUM: Float
Stiffness constant for medium stiff spring. This is the default stiffness for spring force.
Value: 1500.0f
STIFFNESS_VERY_LOW
static val STIFFNESS_VERY_LOW: Float
Stiffness constant for a spring with very low stiffness.
Value: 50.0f
Public constructors
<init>
SpringForce()
Creates a spring force. Note that final position of the spring must be set through #setFinalPosition(float)
before the spring animation starts.
<init>
SpringForce(finalPosition: Float)
Creates a spring with a given final rest position.
Parameters  

finalPosition 
Float: final position of the spring when it reaches equilibrium 
Public methods
setDampingRatio
fun setDampingRatio(dampingRatio: Float): SpringForce!
Spring damping ratio describes how oscillations in a system decay after a disturbance.
When damping ratio > 1 (overdamped), the object will quickly return to the rest position without overshooting. If damping ratio equals to 1 (i.e. critically damped), the object will return to equilibrium within the shortest amount of time. When damping ratio is less than 1 (i.e. underdamped), the mass tends to overshoot, and return, and overshoot again. Without any damping (i.e. damping ratio = 0), the mass will oscillate forever.
Default damping ratio is #DAMPING_RATIO_MEDIUM_BOUNCY
.
Parameters  

dampingRatio 
Float: damping ratio of the spring, it should be nonnegative 
Return  

SpringForce!: the spring force that the given damping ratio is set on 
Exceptions  

IllegalArgumentException 
if the {@param dampingRatio} is negative. 
getStiffness
fun getStiffness(): Float
Gets the stiffness of the spring.
Return  

Float: the stiffness of the spring 
setFinalPosition
fun setFinalPosition(finalPosition: Float): SpringForce!
Sets the rest position of the spring.
Parameters  

finalPosition 
Float: rest position of the spring 
Return  

SpringForce!: the spring force that the given final position is set on 
getFinalPosition
fun getFinalPosition(): Float
Returns the rest position of the spring.
Return  

Float: rest position of the spring 
setStiffness
fun setStiffness(stiffness: Float): SpringForce!
Sets the stiffness of a spring. The more stiff a spring is, the more force it applies to the object attached when the spring is not at the final position. Default stiffness is #STIFFNESS_MEDIUM
.
Parameters  

stiffness 
Float: nonnegative stiffness constant of a spring 
Return  

SpringForce!: the spring force that the given stiffness is set on 
Exceptions  

IllegalArgumentException 
if the given spring stiffness is not positive 