✌️ A spring physics based React animation library
✌️ A spring physics based React animation library
react-spring is a cross-platform spring-physics first animation library.
It's as simple as:
const styles = useSpring({
from: {
opacity: 0
},
to: {
opacity: 1
}
})
<animated.div style={styles} />Just a small bit about us:
react-dom and react-three-fiber.There's a lot more to be had! Give it a try and find out.
# Install the target you need
npm install @react-spring/web
# or, for react-three-fiber
npm install @react-spring/threeimport { animated, useSpring } from '@react-spring/web'
const FadeIn = ({ isVisible, children }) => {
const styles = useSpring({
opacity: isVisible ? 1 : 0,
y: isVisible ? 0 : 24,
})
return <animated.div style={styles}>{children}</animated.div>
}It's as simple as that to create scroll-in animations when value of isVisible is toggled.
More documentation on the project can be found here.
Pages contain their own examples which you can check out there, or open in codesandbox for a more in-depth view!
And many others...
Thank you to all our backers! 🙏 If you want to join them here, then consider contributing to our Opencollective.
This project exists thanks to all the people who contribute.
Dependency Dashboard
RFC: Reject unknown top-level props in spring hooks
three and web are incompatible
Remove `any` from public types
useTransition API rewrite
Physics-level spring coupling
[feat]: Create an animation abstraction for spring and gesture
FLIP-style animations
[bug]: SpringValue.set doesn't schedule update to interpolation on first render
[bug]: Immediate does not work when to is an array