Top Related Projects
Open source, production-ready animation and gesture library for React
A spring that solves your animation problems.
✌️ A spring physics based React animation library
🇨🇭 A React renderer for Three.js
🎊 A collection of animations for inline style libraries
An easy way to perform animations when a React component enters or leaves the DOM
Quick Overview
React Overdrive is a React component library that provides smooth animations for transitioning elements between different pages or states. It creates the illusion of continuity by animating an element from its position on one page to its new position on another page, enhancing the user experience with fluid transitions.
Pros
- Easy to implement with minimal configuration required
- Provides smooth, visually appealing transitions between pages or states
- Works well with React Router and other routing solutions
- Lightweight and has no external dependencies
Cons
- Limited to animating single elements at a time
- May not be suitable for complex animations or transitions
- Requires careful planning of component structure to achieve desired effects
- Not actively maintained (last update was in 2018)
Code Examples
- Basic usage with React Router:
import Overdrive from 'react-overdrive'
const PageOne = () => (
<Overdrive id="unique-id">
<img src="image.jpg" />
</Overdrive>
)
const PageTwo = () => (
<Overdrive id="unique-id">
<img src="image.jpg" className="large" />
</Overdrive>
)
- Customizing animation duration:
<Overdrive id="custom-duration" duration={500}>
<div>Animated content</div>
</Overdrive>
- Using with custom easing function:
import { easeInOutQuad } from 'react-overdrive'
<Overdrive id="custom-easing" easing={easeInOutQuad}>
<span>Smoothly animated text</span>
</Overdrive>
Getting Started
-
Install the package:
npm install react-overdrive
-
Import and use in your React components:
import React from 'react' import Overdrive from 'react-overdrive' const MyComponent = () => ( <Overdrive id="my-element"> <div>Content to animate</div> </Overdrive> ) export default MyComponent
-
Ensure you use the same
id
prop for elements you want to transition between different pages or states.
Competitor Comparisons
Open source, production-ready animation and gesture library for React
Pros of Motion
- More comprehensive animation library with a wider range of features
- Better documentation and community support
- Supports gestures and drag interactions out of the box
Cons of Motion
- Larger bundle size due to more features
- Steeper learning curve for beginners
- May be overkill for simple transition effects
Code Comparison
Motion:
import { motion } from "framer-motion"
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
>
Content
</motion.div>
React-Overdrive:
import Overdrive from 'react-overdrive'
<Overdrive id="uniqueId">
<img src="image.jpg" />
</Overdrive>
Summary
Motion is a more feature-rich animation library suitable for complex animations and interactions. It offers better documentation and community support but comes with a larger bundle size and steeper learning curve.
React-Overdrive, on the other hand, is focused specifically on creating simple, performant transitions between routes or views. It has a smaller footprint and is easier to implement for basic use cases, but lacks the extensive features and flexibility of Motion.
Choose Motion for comprehensive animation needs and React-Overdrive for straightforward route transitions in React applications.
A spring that solves your animation problems.
Pros of react-motion
- More flexible and customizable animation system
- Supports physics-based animations with spring configurations
- Larger community and ecosystem with more examples and resources
Cons of react-motion
- Steeper learning curve due to its more complex API
- Requires more code to set up basic animations
- Performance can be an issue with complex animations or many animated elements
Code Comparison
react-motion:
import { Motion, spring } from 'react-motion';
<Motion defaultStyle={{x: 0}} style={{x: spring(100)}}>
{({x}) => <div style={{transform: `translateX(${x}px)`}} />}
</Motion>
react-overdrive:
import Overdrive from 'react-overdrive';
<Overdrive id="uniqueId">
<div>Animated content</div>
</Overdrive>
Summary
react-motion offers a more powerful and flexible animation system, but comes with a steeper learning curve and potentially more complex implementation. react-overdrive provides a simpler API for specific use cases, such as shared element transitions, but may be less versatile for complex animations. The choice between the two depends on the specific requirements of your project and the level of animation complexity needed.
✌️ A spring physics based React animation library
Pros of react-spring
- More comprehensive animation library with a wider range of animation types and capabilities
- Better performance due to its use of spring physics for smoother animations
- Larger community and more frequent updates
Cons of react-spring
- Steeper learning curve due to its more complex API
- Potentially overkill for simple animation needs
Code Comparison
react-overdrive:
<Overdrive id="uniqueId">
<img src="image.jpg" />
</Overdrive>
react-spring:
import { useSpring, animated } from 'react-spring'
const props = useSpring({ opacity: 1, from: { opacity: 0 } })
return <animated.div style={props}>I will fade in</animated.div>
Summary
react-spring offers a more powerful and flexible animation solution, making it suitable for complex animation needs. It provides better performance and has a larger community. However, it comes with a steeper learning curve and may be excessive for simple animations.
react-overdrive, on the other hand, is more focused on specific transition animations between routes, making it easier to use for its intended purpose but less versatile overall.
The choice between the two depends on the project's specific animation requirements and the developer's familiarity with animation concepts.
🇨🇭 A React renderer for Three.js
Pros of react-three-fiber
- Provides a powerful 3D rendering library for React applications
- Offers a declarative approach to creating complex 3D scenes
- Integrates seamlessly with the React ecosystem and component lifecycle
Cons of react-three-fiber
- Steeper learning curve due to 3D graphics concepts
- Potentially higher performance overhead for complex scenes
- May require additional libraries for advanced 3D features
Code Comparison
react-three-fiber:
import { Canvas } from '@react-three/fiber'
function App() {
return (
<Canvas>
<mesh>
<boxGeometry args={[1, 1, 1]} />
<meshStandardMaterial color="hotpink" />
</mesh>
</Canvas>
)
}
react-overdrive:
import Overdrive from 'react-overdrive'
function App() {
return (
<Overdrive id="uniqueId">
<img src="image.jpg" alt="Animated element" />
</Overdrive>
)
}
While react-three-fiber focuses on creating 3D scenes in React applications, react-overdrive is designed for simple animations between different views. react-three-fiber offers more complex rendering capabilities but requires more setup and knowledge of 3D graphics. react-overdrive, on the other hand, provides an easier way to add basic transitions to React applications with minimal configuration.
🎊 A collection of animations for inline style libraries
Pros of react-animations
- Provides a wide range of pre-defined animations
- Easy integration with CSS-in-JS libraries like styled-components
- Lightweight and focused solely on animation keyframes
Cons of react-animations
- Requires additional setup with CSS-in-JS libraries or custom CSS
- Limited to keyframe animations, lacking advanced features
- No built-in components for common animation scenarios
Code Comparison
react-animations:
import { fadeIn } from 'react-animations';
import styled, { keyframes } from 'styled-components';
const fadeInAnimation = keyframes`${fadeIn}`;
const FadeInDiv = styled.div`animation: 1s ${fadeInAnimation};`;
react-overdrive:
import Overdrive from 'react-overdrive';
<Overdrive id="uniqueId">
<img src="image.jpg" alt="Animated element" />
</Overdrive>
Key Differences
- react-animations focuses on providing animation keyframes, while react-overdrive offers a component-based approach
- react-overdrive specializes in shared element transitions, whereas react-animations covers a broader range of animation types
- react-animations requires integration with CSS-in-JS libraries, while react-overdrive works out of the box with minimal setup
Use Cases
- Choose react-animations for flexible, customizable animations across various scenarios
- Opt for react-overdrive when implementing shared element transitions between routes or components
An easy way to perform animations when a React component enters or leaves the DOM
Pros of react-transition-group
- More comprehensive and flexible animation system
- Supports both CSS and JavaScript animations
- Widely adopted and maintained by the React core team
Cons of react-transition-group
- Steeper learning curve due to more complex API
- Requires more boilerplate code for simple animations
Code Comparison
react-transition-group:
<CSSTransition
in={inProp}
timeout={300}
classNames="fade"
unmountOnExit
>
<div>I'm a fade transition!</div>
</CSSTransition>
react-overdrive:
<Overdrive id="uniqueId">
<div>I'm an animated element!</div>
</Overdrive>
Key Differences
- react-transition-group offers more control over animation stages (enter, exit, etc.)
- react-overdrive focuses on simplicity and ease of use for specific transition effects
- react-transition-group requires manual CSS class definitions, while react-overdrive handles animations internally
Use Cases
- react-transition-group: Complex, multi-stage animations and transitions
- react-overdrive: Quick implementation of smooth transitions between routes or states
Community and Maintenance
- react-transition-group: Larger community, more frequent updates
- react-overdrive: Smaller community, less frequent updates but still maintained
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
react-overdrive
Super easy magic-move transitions for React apps.
Demos
Install
$ npm install react-overdrive --save
Usage
Example with routing
Wrap any element (not just images) in a <Overdrive id=""></Overdrive>
component. Add the same id
to create a transition between the elements.
On page1.js
:
import Overdrive from 'react-overdrive'
const pageA = (props) => (
<div>
<h1>Page A</h1>
<Overdrive id="bender-to-big-fry">
<img src="bender.png" width="100" height="100"/>
</Overdrive>
</div>
);
On page2.js
:
import Overdrive from 'react-overdrive'
const pageB = (props) => (
<div>
<h1>Page B</h1>
<Overdrive id="bender-to-big-fry">
<img src="fry.png" width="300" height="300"/>
</Overdrive>
</div>
);
Now route between the pages.
Example without routing
On page.js
:
import Overdrive from 'react-overdrive'
const page = (props) => (
<div>
{props.loading && <Overdrive id="content"><Loader/></Overdrive>}
{!props.loading && <Overdrive id="content"><Content/></Overdrive>}
</div>
);
API
Prop | Description | Default Value |
---|---|---|
id | Required. A unique string to identify the component. | |
element | Wrapping element type. | 'div' |
duration | Animation duration (in milliseconds). | 200 |
easing | Animation easing function. | '' |
animationDelay | Add delay of calculating the mounted component position. Setting to 1 usually helps avoiding issues with window scrolling. | null |
onAnimationEnd | Event dispatched when the animation has finished. | null |
How does it work?
A transition is made when an <Overdrive id="example"/>
component is unmounted and another <Overdrive id="example"/>
is mounted not later than 100ms.
The transition is made by cloning the unmounted and mounted components, adding them with absolute
position and CSS transformed from the source to the target position.
Sponsors
Thanks to the following companies for generously providing their services/products to help improve this project:
Thanks to BrowserStack for providing cross-browser testing.
Who made this?
Tal Bereznitskey. Find me on Twitter as @ketacode.
Top Related Projects
Open source, production-ready animation and gesture library for React
A spring that solves your animation problems.
✌️ A spring physics based React animation library
🇨🇭 A React renderer for Three.js
🎊 A collection of animations for inline style libraries
An easy way to perform animations when a React component enters or leaves the DOM
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot