Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

il y a 3 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. # rc-animate
  2. ---
  3. animate react element easily
  4. [![NPM version][npm-image]][npm-url]
  5. [![build status][travis-image]][travis-url]
  6. [![Test coverage][coveralls-image]][coveralls-url]
  7. [![gemnasium deps][gemnasium-image]][gemnasium-url]
  8. [![node version][node-image]][node-url]
  9. [![npm download][download-image]][download-url]
  10. [npm-image]: http://img.shields.io/npm/v/rc-animate.svg?style=flat-square
  11. [npm-url]: http://npmjs.org/package/rc-animate
  12. [travis-image]: https://img.shields.io/travis/react-component/animate.svg?style=flat-square
  13. [travis-url]: https://travis-ci.org/react-component/animate
  14. [coveralls-image]: https://img.shields.io/coveralls/react-component/animate.svg?style=flat-square
  15. [coveralls-url]: https://coveralls.io/r/react-component/animate?branch=master
  16. [gemnasium-image]: http://img.shields.io/gemnasium/react-component/animate.svg?style=flat-square
  17. [gemnasium-url]: https://gemnasium.com/react-component/animate
  18. [node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
  19. [node-url]: http://nodejs.org/download/
  20. [download-image]: https://img.shields.io/npm/dm/rc-animate.svg?style=flat-square
  21. [download-url]: https://npmjs.org/package/rc-animate
  22. ## Feature
  23. * support ie8,ie8+,chrome,firefox,safari
  24. ## install
  25. [![rc-animate](https://nodei.co/npm/rc-animate.png)](https://npmjs.org/package/rc-animate)
  26. ## Usage
  27. ```jsx
  28. import Animate from 'rc-animate';
  29. ReactDOM.render(
  30. <Animate animation={{ ... }}>
  31. <p key="1">1</p>
  32. <p key="2">2</p>
  33. </Animate>
  34. , mountNode);
  35. ```
  36. ## API
  37. ### props
  38. <table class="table table-bordered table-striped">
  39. <thead>
  40. <tr>
  41. <th style="width: 100px;">name</th>
  42. <th style="width: 50px;">type</th>
  43. <th style="width: 50px;">default</th>
  44. <th>description</th>
  45. </tr>
  46. </thead>
  47. <tbody>
  48. <tr>
  49. <td>component</td>
  50. <td>React.Element/String</td>
  51. <td>'span'</td>
  52. <td>wrap dom node or component for children. set to '' if you do not wrap for only one child</td>
  53. </tr>
  54. <tr>
  55. <td>componentProps</td>
  56. <td>Object</td>
  57. <td>{}</td>
  58. <td>extra props that will be passed to component</td>
  59. </tr>
  60. <tr>
  61. <td>showProp</td>
  62. <td>String</td>
  63. <td></td>
  64. <td>using prop for show and hide. [demo](http://react-component.github.io/animate/examples/hide-todo.html) </td>
  65. </tr>
  66. <tr>
  67. <td>exclusive</td>
  68. <td>Boolean</td>
  69. <td></td>
  70. <td>whether allow only one set of animations(enter and leave) at the same time. </td>
  71. </tr>
  72. <tr>
  73. <td>transitionName</td>
  74. <td>String|Object</td>
  75. <td></td>
  76. <td>specify corresponding css, see ReactCSSTransitionGroup</td>
  77. </tr>
  78. <tr>
  79. <td>transitionAppear</td>
  80. <td>Boolean</td>
  81. <td>false</td>
  82. <td>whether support transition appear anim</td>
  83. </tr>
  84. <tr>
  85. <td>transitionEnter</td>
  86. <td>Boolean</td>
  87. <td>true</td>
  88. <td>whether support transition enter anim</td>
  89. </tr>
  90. <tr>
  91. <td>transitionLeave</td>
  92. <td>Boolean</td>
  93. <td>true</td>
  94. <td>whether support transition leave anim</td>
  95. </tr>
  96. <tr>
  97. <td>onEnd</td>
  98. <td>function(key:String, exists:Boolean)</td>
  99. <td>true</td>
  100. <td>animation end callback</td>
  101. </tr>
  102. <tr>
  103. <td>animation</td>
  104. <td>Object</td>
  105. <td>{}</td>
  106. <td>
  107. to animate with js. see animation format below.
  108. </td>
  109. </tr>
  110. </tbody>
  111. </table>
  112. ### animation format
  113. with appear, enter and leave as keys. for example:
  114. ```js
  115. {
  116. appear: function(node, done){
  117. node.style.display='none';
  118. $(node).slideUp(done);
  119. return {
  120. stop:function(){
  121. // jq will call done on finish
  122. $(node).stop(true);
  123. }
  124. };
  125. },
  126. enter: function(){
  127. this.appear.apply(this,arguments);
  128. },
  129. leave: function(node, done){
  130. node.style.display='';
  131. $(node).slideDown(done);
  132. return {
  133. stop:function(){
  134. // jq will call done on finish
  135. $(node).stop(true);
  136. }
  137. };
  138. }
  139. }
  140. ```
  141. ## Development
  142. ```
  143. npm install
  144. npm start
  145. ```
  146. ## Example
  147. http://localhost:8200/examples/index.md
  148. online example: http://react-component.github.io/animate/examples/
  149. ## Test Case
  150. ```
  151. npm test
  152. npm run chrome-test
  153. ```
  154. ## Coverage
  155. ```
  156. npm run coverage
  157. ```
  158. open coverage/ dir
  159. ## License
  160. rc-animate is released under the MIT license.