AnimationClipCreator.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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">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;Color></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"><code>duration</code></td>
  36. <td class="description last"><p>The duration of the animation.</p></td>
  37. </tr>
  38. <tr>
  39. <td class="name"><code>colors</code></td>
  40. <td class="description last"><p>An array of colors that should be sequentially animated.</p></td>
  41. </tr>
  42. </tbody>
  43. </table>
  44. <dl class="details">
  45. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  46. </dl>
  47. </div>
  48. <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>
  49. <div class="method">
  50. <div class="description">
  51. <p>Creates an animation clip that scales a 3D object in a pulse pattern
  52. in the given period.</p>
  53. </div>
  54. <table class="params">
  55. <tbody>
  56. <tr>
  57. <td class="name"><code>duration</code></td>
  58. <td class="description last"><p>The duration of the animation.</p></td>
  59. </tr>
  60. <tr>
  61. <td class="name"><code>pulseScale</code></td>
  62. <td class="description last"><p>The scale of the pulse.</p></td>
  63. </tr>
  64. </tbody>
  65. </table>
  66. <dl class="details">
  67. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  68. </dl>
  69. </div>
  70. <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>
  71. <div class="method">
  72. <div class="description">
  73. <p>Creates an animation clip that rotates a 3D object 360 degrees
  74. in the given period of time around the given axis.</p>
  75. </div>
  76. <table class="params">
  77. <tbody>
  78. <tr>
  79. <td class="name"><code>period</code></td>
  80. <td class="description last"><p>The duration of the animation.</p></td>
  81. </tr>
  82. <tr>
  83. <td class="name"><code>axis</code></td>
  84. <td class="description last"><p>The axis of rotation.<br/>Default is <code>'x'</code>.</p></td>
  85. </tr>
  86. </tbody>
  87. </table>
  88. <dl class="details">
  89. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  90. </dl>
  91. </div>
  92. <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>
  93. <div class="method">
  94. <div class="description">
  95. <p>Creates an animation clip that scales a 3D object from <code>0</code> to <code>1</code>
  96. in the given period of time along the given axis.</p>
  97. </div>
  98. <table class="params">
  99. <tbody>
  100. <tr>
  101. <td class="name"><code>period</code></td>
  102. <td class="description last"><p>The duration of the animation.</p></td>
  103. </tr>
  104. <tr>
  105. <td class="name"><code>axis</code></td>
  106. <td class="description last"><p>The axis to scale the 3D object along.<br/>Default is <code>'x'</code>.</p></td>
  107. </tr>
  108. </tbody>
  109. </table>
  110. <dl class="details">
  111. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  112. </dl>
  113. </div>
  114. <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">Vector3</span> )</span><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> </h3>
  115. <div class="method">
  116. <div class="description">
  117. <p>Creates an animation clip that translates a 3D object in a shake pattern
  118. in the given period.</p>
  119. </div>
  120. <table class="params">
  121. <tbody>
  122. <tr>
  123. <td class="name"><code>duration</code></td>
  124. <td class="description last"><p>The duration of the animation.</p></td>
  125. </tr>
  126. <tr>
  127. <td class="name"><code>shakeScale</code></td>
  128. <td class="description last"><p>The scale of the shake.</p></td>
  129. </tr>
  130. </tbody>
  131. </table>
  132. <dl class="details">
  133. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  134. </dl>
  135. </div>
  136. <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>
  137. <div class="method">
  138. <div class="description">
  139. <p>Creates an animation clip that toggles the visibility of a 3D object.</p>
  140. </div>
  141. <table class="params">
  142. <tbody>
  143. <tr>
  144. <td class="name"><code>duration</code></td>
  145. <td class="description last"><p>The duration of the animation.</p></td>
  146. </tr>
  147. </tbody>
  148. </table>
  149. <dl class="details">
  150. <dt class="tag-returns"><strong>Returns:</strong> The created animation clip.</dt>
  151. </dl>
  152. </div>
  153. <h2 class="subsection-title">Source</h2>
  154. <p>
  155. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/animation/AnimationClipCreator.js" target="_blank" rel="noopener" translate="no">examples/jsm/animation/AnimationClipCreator.js</a>
  156. </p>
  157. </article>
  158. </section>
  159. <script src="../scripts/linenumber.js"></script>
  160. <script src="../scripts/page.js"></script>
  161. </body>
  162. </html>
粤ICP备19079148号