Package Exports
- rc-animate
- rc-animate/es/Animate
- rc-animate/es/CSSMotion
- rc-animate/lib/CSSMotion
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rc-animate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
rc-animate
animate react element easily
Feature
- support ie8,ie8+,chrome,firefox,safari
install
Usage
import Animate from 'rc-animate';
ReactDOM.render(
<Animate animation={{ ... }}>
<p key="1">1</p>
<p key="2">2</p>
</Animate>
, mountNode);
CSSMotion
props
Property | Type | Default | Description |
---|---|---|---|
visible | boolean | true | Display child content or not |
children | function | Render props of children content. Example [see below](#sample usage) | |
motionName | string | motionNameObjProps | Set the className when motion start | |
motionAppear | boolean | true | Support motion on appear |
motionEnter | boolean | true | Support motion on enter |
motionLeave | boolean | true | Support motion on leave |
onAppearStart | function | Trigger when appear start | |
onAppearActive | function | Trigger when appear active | |
onAppearEnd | function | Trigger when appear end | |
onEnterStart | function | Trigger when enter start | |
onEnterActive | function | Trigger when enter active | |
onEnterEnd | function | Trigger when enter end | |
onLeaveStart | function | Trigger when leave start | |
onLeaveActive | function | Trigger when leave active | |
onLeaveEnd | function | Trigger when leave end |
motionNameObjProps
Property | Type |
---|---|
appear | string |
appearActive | string |
enter | string |
enterActive | string |
leave | string |
leaveActive | string |
sample usage
// Return customize style
const onAppearStart = (ele) => ({ height: 0 });
<CSSMotion
visible={show}
transitionName="transition"
onAppearStart={onAppearStart}
>
{({ style, className }) => (
<div className={className} style={style} />
)}
</CSSMotion>
Animate (Deprecated)
props
name | type | default | description |
---|---|---|---|
component | React.Element/String | 'span' | wrap dom node or component for children. set to '' if you do not wrap for only one child |
componentProps | Object | {} | extra props that will be passed to component |
showProp | String | using prop for show and hide. [demo](http://react-component.github.io/animate/examples/hide-todo.html) | |
exclusive | Boolean | whether allow only one set of animations(enter and leave) at the same time. | |
transitionName | String|Object | specify corresponding css, see ReactCSSTransitionGroup | |
transitionAppear | Boolean | false | whether support transition appear anim |
transitionEnter | Boolean | true | whether support transition enter anim |
transitionLeave | Boolean | true | whether support transition leave anim |
onEnd | function(key:String, exists:Boolean) | true | animation end callback |
animation | Object | {} | to animate with js. see animation format below. |
animation format
with appear, enter and leave as keys. for example:
{
appear: function(node, done){
node.style.display='none';
$(node).slideUp(done);
return {
stop:function(){
// jq will call done on finish
$(node).stop(true);
}
};
},
enter: function(){
this.appear.apply(this,arguments);
},
leave: function(node, done){
node.style.display='';
$(node).slideDown(done);
return {
stop:function(){
// jq will call done on finish
$(node).stop(true);
}
};
}
}
Development
npm install
npm start
Example
http://localhost:8200/examples/index.md
online example: http://react-component.github.io/animate/examples/
Test Case
npm test
npm run chrome-test
Coverage
npm run coverage
open coverage/ dir
License
rc-animate is released under the MIT license.