Optional bouncebounce determines the "bounciness" of a spring animation.
0 is no bounce, and 1 is extremely bouncy.
If duration is set, this defaults to 0.25.
Note: bounce and duration will be overridden if stiffness, damping or mass are set.
<motion.div
animate={{ x: 100 }}
transition={{ type: "spring", bounce: 0.25 }}
/>
Optional dampingStrength of opposing force. If set to 0, spring will oscillate
indefinitely. Set to 10 by default.
<motion.a
animate={{ rotate: 180 }}
transition={{ type: 'spring', damping: 300 }}
/>
Optional durationThe duration of the animation, defined in seconds. Spring animations can be a maximum of 10 seconds.
If bounce is set, this defaults to 0.8.
Note: duration and bounce will be overridden if stiffness, damping or mass are set.
<motion.div
animate={{ x: 100 }}
transition={{ type: "spring", duration: 0.8 }}
/>
Optional fromThe value to animate from. By default, this is the initial state of the animating value.
<motion.div
animate={{ rotate: 180 }}
transition={{ type: 'spring', from: 90 }}
/>
Optional massMass of the moving object. Higher values will result in more lethargic
movement. Set to 1 by default.
<motion.feTurbulence
animate={{ baseFrequency: 0.5 } as any}
transition={{ type: "spring", mass: 0.5 }}
/>
Optional repeatThe number of times to repeat the transition. Set to Infinity for perpetual repeating.
Without setting repeatType, this will loop the animation.
<motion.div
animate={{ rotate: 180 }}
transition={{ repeat: Infinity, duration: 2 }}
/>
Optional repeatWhen repeating an animation, repeatDelay will set the
duration of the time to wait, in seconds, between each repetition.
<motion.div
animate={{ rotate: 180 }}
transition={{ repeat: Infinity, repeatDelay: 1 }}
/>
Optional repeatHow to repeat the animation. This can be either:
"loop": Repeats the animation from the start
"reverse": Alternates between forward and backwards playback
"mirror": Switches from and to alternately
<motion.div
animate={{ rotate: 180 }}
transition={{
repeat: 1,
repeatType: "reverse",
duration: 2
}}
/>
Optional restEnd animation if distance is below this value and speed is below
restSpeed. When animation ends, spring gets “snapped” to. Set to
0.01 by default.
<motion.div
animate={{ rotate: 180 }}
transition={{ type: 'spring', restDelta: 0.5 }}
/>
Optional restEnd animation if absolute speed (in units per second) drops below this
value and delta is smaller than restDelta. Set to 0.01 by default.
<motion.div
animate={{ rotate: 180 }}
transition={{ type: 'spring', restSpeed: 0.5 }}
/>
Optional stiffnessStiffness of the spring. Higher values will create more sudden movement.
Set to 100 by default.
<motion.section
animate={{ rotate: 180 }}
transition={{ type: 'spring', stiffness: 50 }}
/>
Set type to "spring" to animate using spring physics for natural
movement. Type is set to "spring" by default.
<motion.div
animate={{ rotate: 180 }}
transition={{ type: 'spring' }}
/>
Optional velocityThe initial velocity of the spring. By default this is the current velocity of the component.
<motion.div
animate={{ rotate: 180 }}
transition={{ type: 'spring', velocity: 2 }}
/>
Generated using TypeDoc
An animation that simulates spring physics for realistic motion. This is the default animation for physical values like
x,y,scaleandrotate.