AnimationUtils.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>AnimationUtils - 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">AnimationUtils</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A class with various methods to assist with animations.</p></div>
  16. </header>
  17. <article>
  18. <div class="container-overview">
  19. <div class="method">
  20. </div>
  21. </div>
  22. <h2 class="subsection-title">Static Methods</h2>
  23. <h3 class="name name-method" id=".convertArray" translate="no">.<a href="#.convertArray">convertArray</a><span class="signature">( array : <span class="param-type">TypedArray | Array</span>, type : <span class="param-type">TypedArray.constructor</span> )</span><span class="type-signature"> : TypedArray</span> </h3>
  24. <div class="method">
  25. <div class="description">
  26. <p>Converts an array to a specific type</p>
  27. </div>
  28. <table class="params">
  29. <tbody>
  30. <tr>
  31. <td class="name"><code>array</code></td>
  32. <td class="description last"><p>The array to convert.</p></td>
  33. </tr>
  34. <tr>
  35. <td class="name"><code>type</code></td>
  36. <td class="description last"><p>The constructor of a type array.</p></td>
  37. </tr>
  38. </tbody>
  39. </table>
  40. <dl class="details">
  41. <dt class="tag-returns"><strong>Returns:</strong> The converted array</dt>
  42. </dl>
  43. </div>
  44. <h3 class="name name-method" id=".flattenJSON" translate="no">.<a href="#.flattenJSON">flattenJSON</a><span class="signature">( jsonKeys : <span class="param-type">Array.&lt;number></span>, times : <span class="param-type">Array.&lt;number></span>, values : <span class="param-type">Array.&lt;number></span>, valuePropertyName : <span class="param-type">string</span> )</span> </h3>
  45. <div class="method">
  46. <div class="description">
  47. <p>Used for parsing AOS keyframe formats.</p>
  48. </div>
  49. <table class="params">
  50. <tbody>
  51. <tr>
  52. <td class="name"><code>jsonKeys</code></td>
  53. <td class="description last"><p>A list of JSON keyframes.</p></td>
  54. </tr>
  55. <tr>
  56. <td class="name"><code>times</code></td>
  57. <td class="description last"><p>This array will be filled with keyframe times by this method.</p></td>
  58. </tr>
  59. <tr>
  60. <td class="name"><code>values</code></td>
  61. <td class="description last"><p>This array will be filled with keyframe values by this method.</p></td>
  62. </tr>
  63. <tr>
  64. <td class="name"><code>valuePropertyName</code></td>
  65. <td class="description last"><p>The name of the property to use.</p></td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. </div>
  70. <h3 class="name name-method" id=".getKeyframeOrder" translate="no">.<a href="#.getKeyframeOrder">getKeyframeOrder</a><span class="signature">( times : <span class="param-type">Array.&lt;number></span> )</span><span class="type-signature"> : Array.&lt;number></span> </h3>
  71. <div class="method">
  72. <div class="description">
  73. <p>Returns an array by which times and values can be sorted.</p>
  74. </div>
  75. <table class="params">
  76. <tbody>
  77. <tr>
  78. <td class="name"><code>times</code></td>
  79. <td class="description last"><p>The keyframe time values.</p></td>
  80. </tr>
  81. </tbody>
  82. </table>
  83. <dl class="details">
  84. <dt class="tag-returns"><strong>Returns:</strong> The array.</dt>
  85. </dl>
  86. </div>
  87. <h3 class="name name-method" id=".isTypedArray" translate="no">.<a href="#.isTypedArray">isTypedArray</a><span class="signature">( object : <span class="param-type">any</span> )</span><span class="type-signature"> : boolean</span> </h3>
  88. <div class="method">
  89. <div class="description">
  90. <p>Returns <code>true</code> if the given object is a typed array.</p>
  91. </div>
  92. <table class="params">
  93. <tbody>
  94. <tr>
  95. <td class="name"><code>object</code></td>
  96. <td class="description last"><p>The object to check.</p></td>
  97. </tr>
  98. </tbody>
  99. </table>
  100. <dl class="details">
  101. <dt class="tag-returns"><strong>Returns:</strong> Whether the given object is a typed array.</dt>
  102. </dl>
  103. </div>
  104. <h3 class="name name-method" id=".makeClipAdditive" translate="no">.<a href="#.makeClipAdditive">makeClipAdditive</a><span class="signature">( targetClip : <span class="param-type">AnimationClip</span>, referenceFrame : <span class="param-type">number</span>, referenceClip : <span class="param-type">AnimationClip</span>, fps : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> </h3>
  105. <div class="method">
  106. <div class="description">
  107. <p>Converts the keyframes of the given animation clip to an additive format.</p>
  108. </div>
  109. <table class="params">
  110. <tbody>
  111. <tr>
  112. <td class="name"><code>targetClip</code></td>
  113. <td class="description last"><p>The clip to make additive.</p></td>
  114. </tr>
  115. <tr>
  116. <td class="name"><code>referenceFrame</code></td>
  117. <td class="description last"><p>The reference frame.<br/>Default is <code>0</code>.</p></td>
  118. </tr>
  119. <tr>
  120. <td class="name"><code>referenceClip</code></td>
  121. <td class="description last"><p>The reference clip.<br/>Default is <code>targetClip</code>.</p></td>
  122. </tr>
  123. <tr>
  124. <td class="name"><code>fps</code></td>
  125. <td class="description last"><p>The FPS.<br/>Default is <code>30</code>.</p></td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. <dl class="details">
  130. <dt class="tag-returns"><strong>Returns:</strong> The updated clip which is now additive.</dt>
  131. </dl>
  132. </div>
  133. <h3 class="name name-method" id=".sortedArray" translate="no">.<a href="#.sortedArray">sortedArray</a><span class="signature">( values : <span class="param-type">Array.&lt;number></span>, stride : <span class="param-type">number</span>, order : <span class="param-type">Array.&lt;number></span> )</span><span class="type-signature"> : Array.&lt;number></span> </h3>
  134. <div class="method">
  135. <div class="description">
  136. <p>Sorts the given array by the previously computed order via <code>getKeyframeOrder()</code>.</p>
  137. </div>
  138. <table class="params">
  139. <tbody>
  140. <tr>
  141. <td class="name"><code>values</code></td>
  142. <td class="description last"><p>The values to sort.</p></td>
  143. </tr>
  144. <tr>
  145. <td class="name"><code>stride</code></td>
  146. <td class="description last"><p>The stride.</p></td>
  147. </tr>
  148. <tr>
  149. <td class="name"><code>order</code></td>
  150. <td class="description last"><p>The sort order.</p></td>
  151. </tr>
  152. </tbody>
  153. </table>
  154. <dl class="details">
  155. <dt class="tag-returns"><strong>Returns:</strong> The sorted values.</dt>
  156. </dl>
  157. </div>
  158. <h3 class="name name-method" id=".subclip" translate="no">.<a href="#.subclip">subclip</a><span class="signature">( sourceClip : <span class="param-type">AnimationClip</span>, name : <span class="param-type">string</span>, startFrame : <span class="param-type">number</span>, endFrame : <span class="param-type">number</span>, fps : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> </h3>
  159. <div class="method">
  160. <div class="description">
  161. <p>Creates a new clip, containing only the segment of the original clip between the given frames.</p>
  162. </div>
  163. <table class="params">
  164. <tbody>
  165. <tr>
  166. <td class="name"><code>sourceClip</code></td>
  167. <td class="description last"><p>The values to sort.</p></td>
  168. </tr>
  169. <tr>
  170. <td class="name"><code>name</code></td>
  171. <td class="description last"><p>The name of the clip.</p></td>
  172. </tr>
  173. <tr>
  174. <td class="name"><code>startFrame</code></td>
  175. <td class="description last"><p>The start frame.</p></td>
  176. </tr>
  177. <tr>
  178. <td class="name"><code>endFrame</code></td>
  179. <td class="description last"><p>The end frame.</p></td>
  180. </tr>
  181. <tr>
  182. <td class="name"><code>fps</code></td>
  183. <td class="description last"><p>The FPS.<br/>Default is <code>30</code>.</p></td>
  184. </tr>
  185. </tbody>
  186. </table>
  187. <dl class="details">
  188. <dt class="tag-returns"><strong>Returns:</strong> The new sub clip.</dt>
  189. </dl>
  190. </div>
  191. <h2 class="subsection-title">Source</h2>
  192. <p>
  193. <a href="https://github.com/mrdoob/three.js/blob/master/src/animation/AnimationUtils.js" target="_blank" rel="noopener" translate="no">src/animation/AnimationUtils.js</a>
  194. </p>
  195. </article>
  196. </section>
  197. <script src="../scripts/linenumber.js"></script>
  198. <script src="../scripts/page.js"></script>
  199. </body>
  200. </html>
粤ICP备19079148号