
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-move-fork
Advanced tools
$ yarn add react-move
# or
$ npm install react-move --only=dev
<script src='https://npmcdn.com/react-move@latest/react-move.js'></script>
A component for animating any single object.
data={ Object } | Required
ignore prop)default={ Object }
duration={ Number } | 500
easing={ string | function } | easeCubicOut
onRest={ Function } | () => null
ignore={ []String } | false
flexDuration={ Boolean } | false
immutable={ Boolean } | true
=== between the old data and new data is used to detect when an animation should occur. If you wish, you can disable immutable mode which falls back to using JSON.stringify to determine if an animation should occur.import React from 'react'
import { Animate } from 'react-move'
<Animate
// Set some default data
default={{
scale: 0,
color: 'blue'
}}
// Update your data to whatever you want
data={{
scale: Math.random() * 1,
color: _.sample(['red', 'blue', 'yellow']),
}}
duration={800}
easing='easeQuadIn' // anything from https://github.com/d3/d3-ease
>
{data => (
<div
style={{
transform: `scale(${data.scale})`,
background: data.color
}}
>
{data.scale * 100}
</div>
)}
</Animate>
A component that enables animating multiple elements, including enter and exit animations.
data={ []Objects } | [] | Required
getKey={ function } | (item, i) => i
enter, update and leave states/groups.update={ function } | Required
entering or leaving the list of items.enter={ function } | () => null
entering the list of items. If nothing is returned, the update state is used.leave={ function } | () => null
leaving the list of items. If nothing is returned, the update state is used.duration={ Number } | 500
easing={ String | Function } | easeCubicOut
getDuration={ Function } | (item, key) => null
item and its key and returns the duration in milliseconds for the item to animateduration prop.getEasing={ Function } | (item, key) => null
item and its key and returns either:
easing prop.stagger={ Number } | 0
staggerGroups={ Boolean } | true
entering, updating and leaving.onRest={ Function } | (item, key) => null
ignore={ []String } | false
flexDuration={ Boolean } | false
import React from 'react'
import { Transition } from 'react-move'
const items = _.filter(items, (d, i) => i > Math.random() * 10)
<Transition
// pass an array of items to "data"
data={items}
// use "getKey" to return a unique ID for each item
getKey={(item, index) => index}
// the "update" function returns the items normal state to animate
update={item => ({
translate: 1,
opacity: 1,
color: 'grey'
})}
// the "enter" function returns the items origin state when entering
enter={item => ({
translate: 0,
opacity: 0,
color: 'blue'
})}
// the "leave" function returns the items destination state when leaving
leave={item => ({
translate: 2,
opacity: 0,
color: 'red'
})}
//
duration={800}
easing='easeQuadIn' // anything from https://github.com/d3/d3-ease
stagger={200} // you can also stagger by a percentage of the animation
staggerGroup // use this prop to stagger by enter/exit/update group index instead of by overall index
>
{data => ( // the child function is passed an array of itemStates
<div>
{data.map(item => {
// data[0] === { key: 0, data: 0, state: {...} }
return (
<div
key={item.key}
style={{
transform: `translateX(${100 * item.state.translate}px)`,
opacity: item.state.opacity,
color: item.state.color
}}
>
{item.data} - {Math.round(item.percentage * 100)}
</div>
)
})}
</div>
)}
</Transition>
If you would rather use a different easing function or just build your own, you can! Simply pass a function to the easing prop and you're off!
<Animate
easing={(t) => { // This is Chart.js's easeOutBounce function :)
if ((t /= 1) < (1 / 2.75)) {
return 1 * (7.5625 * t * t)
} else if (t < (2 / 2.75)) {
return 1 * (7.5625 * (t -= (1.5 / 2.75)) * t + 0.75)
} else if (t < (2.5 / 2.75)) {
return 1 * (7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375)
}
return 1 * (7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375)
}}
>
Using one of our favorite tools called Springer, you can effortlessly build your own realistic spring-based easing functions, and achieve a look and feel similar that of React-Motion.
import React from 'react'
import { Animate } from 'react-move'
import Springer from 'springer'
const normalSpring = Springer()
const hardSpring = Springer(0.9, 0.3)
const wobblySpring = Springer(0.5, 0.9)
<Animate
easing={wobblySpring}
/>
Notes: Springer does not deliver eventual and interruptible animation. For animations requiring those characteristics, we suggest using React-Motion.
Want to change the defaults for either Animate or Transition?
import { Animate, Transition } from 'react-move'
// Before using either component, change any property in the Component's 'defaults' object
Object.assign(Animate.defaults, {
duration: 3000,
easing: 'easeElasticOut'
})
Object.assign(Transition.defaults, {
stagger: 100
})
// Or create your own wrapped versions!
class MyAnimate extends React.Component {
render () {
return (
<Animate
duration={3000}
easing='easeElasticOut'
{...this.props}
/>
)
}
}
class MyTransition extends React.Component {
render () {
return (
<Transition
stagger={100}
{...this.props}
/>
)
}
}
To suggest a feature, create an issue if it does not already exist. If you would like to help develop a suggested feature follow these steps:
$ yarn$ yarn run watchsrc/ directory$ yarn run docsdocs/src,$ yarn run watch Watches files and builds via babel$ yarn run docs Runs the storybook server$ yarn run test Runs the test suite
FAQs
Beautifully animate anything in react with interia or time + easing.
We found that react-move-fork demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.