vaweGitHub

Spring animation presets as CSS

25 springs from react-spring, Motion, SwiftUI, Jetpack Compose, Material 3 and vawe. Each page has the stiffness and damping read from the library’s own source, the settle time, the overshoot, a live demo and a linear() string to copy.

Stiffness, damping and mass

A spring pulls a value toward its target. Stiffness is how hard it pulls: a higher number is a faster move. Damping is the friction that drains speed: a low number lets the value swing past the target and back, a high number stops the swing. Mass is how heavy the value is. Every preset here has mass 1; if a library sets another mass, divide its stiffness and damping by it.

The damping ratio, d / (2 x sqrt(k)), says which kind of spring it is. Under 1 it overshoots. At 1 it is critically damped, the fastest settle with no overshoot. Over 1 it creeps in. The settle time on each page is the last moment the spring is more than 0.1% away from the end value.

A CSS transition cannot take stiffness and damping. The pages turn each spring into a linear() easing and a duration. In a vawe page, spring(t, k, d) in core/motion/springs.js returns the same curve for any time.

All presets

vawe house springs

The four springs in SPRINGS, from core/motion/springs.js. Page code reads them with spring(t, k, d).

  • vawe snappy

    Stiffness 400, damping 32.

    settles 0.425 s / overshoot 1.5%
  • vawe default

    Stiffness 170, damping 26.

    settles 0.705 s / overshoot 0%
  • vawe heavy

    Stiffness 90, damping 22.

    settles 1.345 s / overshoot 0%
  • vawe playful

    Stiffness 220, damping 12.

    settles 1.04 s / overshoot 24.9%

react-spring

The six presets of the config object in react-spring.

Motion (Framer Motion)

The spring numbers Motion uses when you do not set them.

SwiftUI

Apple spring animations, converted from response and damping fraction to stiffness and damping.

  • SwiftUI spring()

    Stiffness 157.91, damping 20.73.

    settles 0.69 s / overshoot 1%
  • SwiftUI .smooth

    Stiffness 157.91, damping 25.13.

    settles 0.735 s / overshoot 0%
  • SwiftUI .snappy

    Stiffness 157.91, damping 21.36.

    settles 0.7 s / overshoot 0.6%
  • SwiftUI .bouncy

    Stiffness 157.91, damping 17.59.

    settles 0.82 s / overshoot 4.6%

Jetpack Compose

spring() in Compose, from the constants of the Spring object.

Material 3

The spatial springs of the Material 3 motion schemes in Compose.

Compare the numbers

Every preset from the least to the most overshoot.

PresetStiffnessDampingRatioSettleOvershoot
Compose spring() default150077.4610.24 s0%
Compose NoBouncy with StiffnessMediumLow4004010.465 s0%
vawe default170260.9970.705 s0%
react-spring default170260.9970.705 s0%
SwiftUI .smooth157.9125.1310.735 s0%
vawe heavy90221.161.345 s0%
react-spring slow280601.7931.375 s0%
react-spring molasses2801203.5862.915 s0%
Material 3 Standard default spatial70047.620.90.32 s0.2%
SwiftUI .snappy157.9121.360.850.7 s0.6%
SwiftUI spring()157.9120.730.8250.69 s1%
vawe snappy400320.80.425 s1.5%
Material 3 Expressive default spatial38031.190.80.435 s1.5%
Material 3 Expressive slow spatial20022.630.80.6 s1.5%
SwiftUI .bouncy157.9117.590.70.82 s4.6%
react-spring stiff210200.690.715 s5%
Motion scale default550300.640.445 s7.3%
react-spring gentle120140.6390.945 s7.4%
Material 3 Expressive fast spatial80033.940.60.36 s9.5%
Motion x, y and rotate default500250.5590.565 s12%
Compose MediumBouncy with StiffnessLow20014.140.50.9 s16.3%
Motion default spring100100.51.275 s16.3%
react-spring wobbly180120.4471.14 s20.8%
vawe playful220120.4051.04 s24.9%
Compose HighBouncy with StiffnessMediumLow40080.21.655 s52.7%

react-spring default and vawe default are the same spring. SwiftUI and Compose values are converted to stiffness and damping with the formula on each page. For an easing with no spring, see the easing functions.

Use a spring in a film