AnimationUtils.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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">
  32. <strong>array</strong>
  33. </td>
  34. <td class="description last">
  35. <p>The array to convert.</p>
  36. </td>
  37. </tr>
  38. <tr>
  39. <td class="name">
  40. <strong>type</strong>
  41. </td>
  42. <td class="description last">
  43. <p>The constructor of a type array.</p>
  44. </td>
  45. </tr>
  46. </tbody>
  47. </table>
  48. <dl class="details">
  49. <dt class="tag-returns"><strong>Returns:</strong> The converted array</dt>
  50. </dl>
  51. </div>
  52. <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>
  53. <div class="method">
  54. <div class="description">
  55. <p>Used for parsing AOS keyframe formats.</p>
  56. </div>
  57. <table class="params">
  58. <tbody>
  59. <tr>
  60. <td class="name">
  61. <strong>jsonKeys</strong>
  62. </td>
  63. <td class="description last">
  64. <p>A list of JSON keyframes.</p>
  65. </td>
  66. </tr>
  67. <tr>
  68. <td class="name">
  69. <strong>times</strong>
  70. </td>
  71. <td class="description last">
  72. <p>This array will be filled with keyframe times by this method.</p>
  73. </td>
  74. </tr>
  75. <tr>
  76. <td class="name">
  77. <strong>values</strong>
  78. </td>
  79. <td class="description last">
  80. <p>This array will be filled with keyframe values by this method.</p>
  81. </td>
  82. </tr>
  83. <tr>
  84. <td class="name">
  85. <strong>valuePropertyName</strong>
  86. </td>
  87. <td class="description last">
  88. <p>The name of the property to use.</p>
  89. </td>
  90. </tr>
  91. </tbody>
  92. </table>
  93. </div>
  94. <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>
  95. <div class="method">
  96. <div class="description">
  97. <p>Returns an array by which times and values can be sorted.</p>
  98. </div>
  99. <table class="params">
  100. <tbody>
  101. <tr>
  102. <td class="name">
  103. <strong>times</strong>
  104. </td>
  105. <td class="description last">
  106. <p>The keyframe time values.</p>
  107. </td>
  108. </tr>
  109. </tbody>
  110. </table>
  111. <dl class="details">
  112. <dt class="tag-returns"><strong>Returns:</strong> The array.</dt>
  113. </dl>
  114. </div>
  115. <h3 class="name name-method" id=".isTypedArray" translate="no">.<a href="#.isTypedArray">isTypedArray</a><span class="signature">( object : <span class="param-type"><a href="global.html#any">any</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  116. <div class="method">
  117. <div class="description">
  118. <p>Returns <code>true</code> if the given object is a typed array.</p>
  119. </div>
  120. <table class="params">
  121. <tbody>
  122. <tr>
  123. <td class="name">
  124. <strong>object</strong>
  125. </td>
  126. <td class="description last">
  127. <p>The object to check.</p>
  128. </td>
  129. </tr>
  130. </tbody>
  131. </table>
  132. <dl class="details">
  133. <dt class="tag-returns"><strong>Returns:</strong> Whether the given object is a typed array.</dt>
  134. </dl>
  135. </div>
  136. <h3 class="name name-method" id=".makeClipAdditive" translate="no">.<a href="#.makeClipAdditive">makeClipAdditive</a><span class="signature">( targetClip : <span class="param-type"><a href="AnimationClip.html">AnimationClip</a></span>, referenceFrame : <span class="param-type">number</span>, referenceClip : <span class="param-type"><a href="AnimationClip.html">AnimationClip</a></span>, fps : <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>Converts the keyframes of the given animation clip to an additive format.</p>
  140. </div>
  141. <table class="params">
  142. <tbody>
  143. <tr>
  144. <td class="name">
  145. <strong>targetClip</strong>
  146. </td>
  147. <td class="description last">
  148. <p>The clip to make additive.</p>
  149. </td>
  150. </tr>
  151. <tr>
  152. <td class="name">
  153. <strong>referenceFrame</strong>
  154. </td>
  155. <td class="description last">
  156. <p>The reference frame.</p>
  157. <p>Default is <code>0</code>.</p>
  158. </td>
  159. </tr>
  160. <tr>
  161. <td class="name">
  162. <strong>referenceClip</strong>
  163. </td>
  164. <td class="description last">
  165. <p>The reference clip.</p>
  166. <p>Default is <code>targetClip</code>.</p>
  167. </td>
  168. </tr>
  169. <tr>
  170. <td class="name">
  171. <strong>fps</strong>
  172. </td>
  173. <td class="description last">
  174. <p>The FPS.</p>
  175. <p>Default is <code>30</code>.</p>
  176. </td>
  177. </tr>
  178. </tbody>
  179. </table>
  180. <dl class="details">
  181. <dt class="tag-returns"><strong>Returns:</strong> The updated clip which is now additive.</dt>
  182. </dl>
  183. </div>
  184. <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>
  185. <div class="method">
  186. <div class="description">
  187. <p>Sorts the given array by the previously computed order via <code>getKeyframeOrder()</code>.</p>
  188. </div>
  189. <table class="params">
  190. <tbody>
  191. <tr>
  192. <td class="name">
  193. <strong>values</strong>
  194. </td>
  195. <td class="description last">
  196. <p>The values to sort.</p>
  197. </td>
  198. </tr>
  199. <tr>
  200. <td class="name">
  201. <strong>stride</strong>
  202. </td>
  203. <td class="description last">
  204. <p>The stride.</p>
  205. </td>
  206. </tr>
  207. <tr>
  208. <td class="name">
  209. <strong>order</strong>
  210. </td>
  211. <td class="description last">
  212. <p>The sort order.</p>
  213. </td>
  214. </tr>
  215. </tbody>
  216. </table>
  217. <dl class="details">
  218. <dt class="tag-returns"><strong>Returns:</strong> The sorted values.</dt>
  219. </dl>
  220. </div>
  221. <h3 class="name name-method" id=".subclip" translate="no">.<a href="#.subclip">subclip</a><span class="signature">( sourceClip : <span class="param-type"><a href="AnimationClip.html">AnimationClip</a></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>
  222. <div class="method">
  223. <div class="description">
  224. <p>Creates a new clip, containing only the segment of the original clip between the given frames.</p>
  225. </div>
  226. <table class="params">
  227. <tbody>
  228. <tr>
  229. <td class="name">
  230. <strong>sourceClip</strong>
  231. </td>
  232. <td class="description last">
  233. <p>The values to sort.</p>
  234. </td>
  235. </tr>
  236. <tr>
  237. <td class="name">
  238. <strong>name</strong>
  239. </td>
  240. <td class="description last">
  241. <p>The name of the clip.</p>
  242. </td>
  243. </tr>
  244. <tr>
  245. <td class="name">
  246. <strong>startFrame</strong>
  247. </td>
  248. <td class="description last">
  249. <p>The start frame.</p>
  250. </td>
  251. </tr>
  252. <tr>
  253. <td class="name">
  254. <strong>endFrame</strong>
  255. </td>
  256. <td class="description last">
  257. <p>The end frame.</p>
  258. </td>
  259. </tr>
  260. <tr>
  261. <td class="name">
  262. <strong>fps</strong>
  263. </td>
  264. <td class="description last">
  265. <p>The FPS.</p>
  266. <p>Default is <code>30</code>.</p>
  267. </td>
  268. </tr>
  269. </tbody>
  270. </table>
  271. <dl class="details">
  272. <dt class="tag-returns"><strong>Returns:</strong> The new sub clip.</dt>
  273. </dl>
  274. </div>
  275. <h2 class="subsection-title">Source</h2>
  276. <p>
  277. <a href="https://github.com/mrdoob/three.js/blob/master/src/animation/AnimationUtils.js" translate="no" target="_blank" rel="noopener">src/animation/AnimationUtils.js</a>
  278. </p>
  279. </article>
  280. </section>
  281. <script src="../scripts/linenumber.js"></script>
  282. <script src="../scripts/page.js"></script>
  283. </body>
  284. </html>
粤ICP备19079148号