React Transition Component
React.js component that will apply transitions on any prop change. Uses D3 interpolator functions underneath.
Was created to be used on drawing SVG charts with D3, but can be used for anything.
It is available as an UMD, having support for AMD, CommonJS and globals.
Check the live demo and source code.
Usage
Install with Bower:
bower install react-transition
With NPM:
npm install react-transition
Or simply dowload the react-transition.js file and add as a script tag in your HTML (it will expose a ReactTransition
global variable):
<script src='react-transition.js'></script>
Here is an example usage as a CommonJS module:
/** @jsx React.DOM */
var Transition = require('react-transition'),
React = require('react');
<Transition component={React.DOM.path} ease="bounce" duration="500" className="link" d={diagonal(link)}/>
In the previous example, the Transition
component will actualy render a React.DOM.path
, and it will apply the bounce
ease function with a duration of 500
milisseconds on any componentWillReceiveProps of the d
property.
Easing functions
Check D3's documentation to see the available easing function.
Dependencies
Author
Similar work
You can check @chenglou's approach to animation using mixins: react-tween-state.