Overview
Creates aMotionValue that, when set, will use a spring animation to animate to its new state.
It can either work as a stand-alone MotionValue by initializing it with a value, or as a subscriber to another MotionValue.
Import
Signatures
Standalone Spring Value
Following Another MotionValue
Parameters
Initial value or a
MotionValue to follow. When a MotionValue is provided, the created spring value will animate towards changes in the source valueSpring configuration options:Physical Properties:
stiffness: Stiffness of the spring (default:100)damping: Strength of opposing force (default:10)mass: Mass of the moving object (default:1)
bounce: Bounciness from0(no bounce) to1(extremely bouncy). Default:0.25when duration is setduration: Duration of the animation in secondsvelocity: Initial velocity of the animation
bounce and duration are overridden if stiffness, damping, or mass are setUsage
Basic Spring Value
Create a standalone spring value:Following Another MotionValue
Create a spring that follows another motion value:Custom Spring Configuration
Fine-tune spring physics:With Duration and Bounce
Use simplified spring configuration:Smooth Scroll Follower
Smooth out scroll-based values:Chained Springs
Create cascading spring effects:String Values
Animate string-based values with springs:Spring Physics Guide
Stiffness
- Higher values create more sudden, snappy movement
- Lower values create slower, more gradual movement
- Default:
100
Damping
- Higher values reduce oscillation (less bouncy)
- Lower values increase oscillation (more bouncy)
0creates infinite oscillation- Default:
10
Mass
- Higher values make the animation feel heavier and slower
- Lower values make the animation feel lighter and faster
- Default:
1
Notes
- Spring animations automatically calculate duration based on physics
- Springs maintain velocity when interrupted by new values
- Use
damping: 0cautiously as it creates infinite oscillation - When following a
MotionValue, springs update automatically as the source changes
Related
- useMotionValue - Create motion values
- useTransform - Transform motion values
- useVelocity - Track velocity
- Spring animations guide - Learn more about springs