Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Animates opacity and horizontal movement together.
# react_motion/demo/OpacityPosition.jsx
import React from 'react';
import { Motion, spring } from 'react-motion';
function OpacityPosition() {
return (
<Motion defaultStyle={{ x: 0, opacity: 0 }} style={{ x: spring(300), opacity: spring(1) }}>
{style => (
<div style={{ width: 100, height: 100, background: 'lime', transform: `translateX(${style.x}px)`, opacity: style.opacity }} />
)}
</Motion>
)
}
export default OpacityPositionReact Motion is a popular animation library for React that uses physics-based animations to create smooth and natural transitions. It provides a simple API to animate components’ styles over time using spring dynamics rather than fixed durations.
Origin & Creator
React Motion was created by Cheng Lou and open-sourced in 2015, becoming widely adopted for physics-based React animations.
Industrial Note
React Motion is used in web apps, dashboards, interactive UIs, and websites where smooth, physics-based motion improves user experience, such as sliding panels, accordions, loaders, and transitions.