AnimationClipCreator.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>AnimationClipCreator - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">AnimationClipCreator</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A utility class with factory methods for creating basic animation clips.</p></div>
  16. </header>
  17. <article>
  18. <h2 class="subsection-title">Import</h2>
  19. <p><span translate="no">AnimationClipCreator</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  20. <pre><code class="language-js">import { AnimationClipCreator } from 'three/addons/animation/AnimationClipCreator.js';</code></pre>
  21. <div class="container-overview">
  22. <div class="method">
  23. </div>
  24. </div>
  25. <h2 class="subsection-title">Static Methods</h2>
  26. <h3 class="name name-method" id=".CreateMaterialColorAnimation" translate="no">.<a href="#.CreateMaterialColorAnimation">CreateMaterialColorAnimation</a><span class="signature">( duration : <span class="param-type">number</span>, colors : <span class="param-type">Array.&lt;<a href="Color.html">Color</a>></span> )</span><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> </h3>
  27. <div class="method">
  28. <div class="description">
  29. <p>Creates an animation clip that animates the <code>color</code> property of a 3D object's
  30. material.</p>
  31. </div>
  32. <table class="params">
  33. <tbody>
  34. <tr>
  35. <td class="name">
  36. <strong>duration</strong>
  37. </td>
  38. <td class="description last">
  39. <p>The duration of the animation.</p>
  40. </td>
  41. </tr>
  42. <tr>
  43. <td class="name">
  44. <strong>colors</strong>
  45. </td>
  46. <td class="description last">
  47. <p>An array of colors that should be sequentially animated.</p>
  48. </td>
  49. </tr>
  50. </tbody>
  51. </table>
  52. <dl class="details">
  53. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  54. </dl>
  55. </div>
  56. <h3 class="name name-method" id=".CreatePulsationAnimation" translate="no">.<a href="#.CreatePulsationAnimation">CreatePulsationAnimation</a><span class="signature">( duration : <span class="param-type">number</span>, pulseScale : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> </h3>
  57. <div class="method">
  58. <div class="description">
  59. <p>Creates an animation clip that scales a 3D object in a pulse pattern
  60. in the given period.</p>
  61. </div>
  62. <table class="params">
  63. <tbody>
  64. <tr>
  65. <td class="name">
  66. <strong>duration</strong>
  67. </td>
  68. <td class="description last">
  69. <p>The duration of the animation.</p>
  70. </td>
  71. </tr>
  72. <tr>
  73. <td class="name">
  74. <strong>pulseScale</strong>
  75. </td>
  76. <td class="description last">
  77. <p>The scale of the pulse.</p>
  78. </td>
  79. </tr>
  80. </tbody>
  81. </table>
  82. <dl class="details">
  83. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  84. </dl>
  85. </div>
  86. <h3 class="name name-method" id=".CreateRotationAnimation" translate="no">.<a href="#.CreateRotationAnimation">CreateRotationAnimation</a><span class="signature">( period : <span class="param-type">number</span>, axis : <span class="param-type">'x' | 'y' | 'z'</span> )</span><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> </h3>
  87. <div class="method">
  88. <div class="description">
  89. <p>Creates an animation clip that rotates a 3D object 360 degrees
  90. in the given period of time around the given axis.</p>
  91. </div>
  92. <table class="params">
  93. <tbody>
  94. <tr>
  95. <td class="name">
  96. <strong>period</strong>
  97. </td>
  98. <td class="description last">
  99. <p>The duration of the animation.</p>
  100. </td>
  101. </tr>
  102. <tr>
  103. <td class="name">
  104. <strong>axis</strong>
  105. </td>
  106. <td class="description last">
  107. <p>The axis of rotation.</p>
  108. <p>Default is <code>'x'</code>.</p>
  109. </td>
  110. </tr>
  111. </tbody>
  112. </table>
  113. <dl class="details">
  114. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  115. </dl>
  116. </div>
  117. <h3 class="name name-method" id=".CreateScaleAxisAnimation" translate="no">.<a href="#.CreateScaleAxisAnimation">CreateScaleAxisAnimation</a><span class="signature">( period : <span class="param-type">number</span>, axis : <span class="param-type">'x' | 'y' | 'z'</span> )</span><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> </h3>
  118. <div class="method">
  119. <div class="description">
  120. <p>Creates an animation clip that scales a 3D object from <code>0</code> to <code>1</code>
  121. in the given period of time along the given axis.</p>
  122. </div>
  123. <table class="params">
  124. <tbody>
  125. <tr>
  126. <td class="name">
  127. <strong>period</strong>
  128. </td>
  129. <td class="description last">
  130. <p>The duration of the animation.</p>
  131. </td>
  132. </tr>
  133. <tr>
  134. <td class="name">
  135. <strong>axis</strong>
  136. </td>
  137. <td class="description last">
  138. <p>The axis to scale the 3D object along.</p>
  139. <p>Default is <code>'x'</code>.</p>
  140. </td>
  141. </tr>
  142. </tbody>
  143. </table>
  144. <dl class="details">
  145. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  146. </dl>
  147. </div>
  148. <h3 class="name name-method" id=".CreateShakeAnimation" translate="no">.<a href="#.CreateShakeAnimation">CreateShakeAnimation</a><span class="signature">( duration : <span class="param-type">number</span>, shakeScale : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> </h3>
  149. <div class="method">
  150. <div class="description">
  151. <p>Creates an animation clip that translates a 3D object in a shake pattern
  152. in the given period.</p>
  153. </div>
  154. <table class="params">
  155. <tbody>
  156. <tr>
  157. <td class="name">
  158. <strong>duration</strong>
  159. </td>
  160. <td class="description last">
  161. <p>The duration of the animation.</p>
  162. </td>
  163. </tr>
  164. <tr>
  165. <td class="name">
  166. <strong>shakeScale</strong>
  167. </td>
  168. <td class="description last">
  169. <p>The scale of the shake.</p>
  170. </td>
  171. </tr>
  172. </tbody>
  173. </table>
  174. <dl class="details">
  175. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  176. </dl>
  177. </div>
  178. <h3 class="name name-method" id=".CreateVisibilityAnimation" translate="no">.<a href="#.CreateVisibilityAnimation">CreateVisibilityAnimation</a><span class="signature">( duration : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> </h3>
  179. <div class="method">
  180. <div class="description">
  181. <p>Creates an animation clip that toggles the visibility of a 3D object.</p>
  182. </div>
  183. <table class="params">
  184. <tbody>
  185. <tr>
  186. <td class="name">
  187. <strong>duration</strong>
  188. </td>
  189. <td class="description last">
  190. <p>The duration of the animation.</p>
  191. </td>
  192. </tr>
  193. </tbody>
  194. </table>
  195. <dl class="details">
  196. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  197. </dl>
  198. </div>
  199. <h2 class="subsection-title">Source</h2>
  200. <p>
  201. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/animation/AnimationClipCreator.js" translate="no" target="_blank" rel="noopener">examples/jsm/animation/AnimationClipCreator.js</a>
  202. </p>
  203. </article>
  204. </section>
  205. <script src="../scripts/linenumber.js"></script>
  206. <script src="../scripts/page.js"></script>
  207. </body>
  208. </html>
粤ICP备19079148号