AnimationPathHelper.html 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>AnimationPathHelper - 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. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → </p>
  13. <h1 translate="no">AnimationPathHelper</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Visualizes the motion path of an animated object based on position keyframes
  17. from an AnimationClip.</p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const clip = model.animations[ 0 ];
  20. const helper = new AnimationPathHelper( model, clip, object );
  21. scene.add( helper );
  22. </code></pre></div>
  23. </header>
  24. <article>
  25. <h2 class="subsection-title">Import</h2>
  26. <p><span translate="no">AnimationPathHelper</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>
  27. <pre><code class="language-js">import { AnimationPathHelper } from 'three/addons/helpers/AnimationPathHelper.js';</code></pre>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="AnimationPathHelper" translate="no">new <a href="#AnimationPathHelper">AnimationPathHelper</a><span class="signature">( root : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, clip : <span class="param-type"><a href="AnimationClip.html">AnimationClip</a></span>, object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, options : <span class="param-type">Object</span> )</span> </h3>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new animation path helper.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name">
  39. <strong translate="no">root</strong>
  40. </td>
  41. <td class="description last">
  42. <p>The root object containing the animation clips.</p>
  43. </td>
  44. </tr>
  45. <tr>
  46. <td class="name">
  47. <strong translate="no">clip</strong>
  48. </td>
  49. <td class="description last">
  50. <p>The animation clip containing position keyframes.</p>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td class="name">
  55. <strong translate="no">object</strong>
  56. </td>
  57. <td class="description last">
  58. <p>The specific object to show the path for.</p>
  59. </td>
  60. </tr>
  61. <tr>
  62. <td class="name">
  63. <strong translate="no">options</strong>
  64. </td>
  65. <td class="description last">
  66. <p>Configuration options.</p>
  67. <p>Default is <code>{}</code>.</p>
  68. <table class="params">
  69. <tbody>
  70. <tr>
  71. <td class="name">
  72. <strong translate="no">color</strong>
  73. </td>
  74. <td class="description last">
  75. <p>The path line color.</p>
  76. <p>Default is <code>0x00ff00</code>.</p>
  77. </td>
  78. </tr>
  79. <tr>
  80. <td class="name">
  81. <strong translate="no">markerColor</strong>
  82. </td>
  83. <td class="description last">
  84. <p>The keyframe marker color.</p>
  85. <p>Default is <code>0xff0000</code>.</p>
  86. </td>
  87. </tr>
  88. <tr>
  89. <td class="name">
  90. <strong translate="no">divisions</strong>
  91. </td>
  92. <td class="description last">
  93. <p>Number of samples for smooth path interpolation.</p>
  94. <p>Default is <code>100</code>.</p>
  95. </td>
  96. </tr>
  97. <tr>
  98. <td class="name">
  99. <strong translate="no">showMarkers</strong>
  100. </td>
  101. <td class="description last">
  102. <p>Whether to show markers at keyframe positions.</p>
  103. <p>Default is <code>true</code>.</p>
  104. </td>
  105. </tr>
  106. <tr>
  107. <td class="name">
  108. <strong translate="no">markerSize</strong>
  109. </td>
  110. <td class="description last">
  111. <p>Size of keyframe markers in pixels.</p>
  112. <p>Default is <code>5</code>.</p>
  113. </td>
  114. </tr>
  115. </tbody>
  116. </table>
  117. </td>
  118. </tr>
  119. </tbody>
  120. </table>
  121. </div>
  122. </div>
  123. <h2 class="subsection-title">Properties</h2>
  124. <div class="member">
  125. <h3 class="name" id="clip" translate="no">.<a href="#clip">clip</a><span class="type-signature"> : <a href="AnimationClip.html">AnimationClip</a></span> </h3>
  126. <div class="description">
  127. <p>The animation clip containing position keyframes.</p>
  128. </div>
  129. </div>
  130. <div class="member">
  131. <h3 class="name" id="divisions" translate="no">.<a href="#divisions">divisions</a><span class="type-signature"> : number</span> </h3>
  132. <div class="description">
  133. <p>Number of samples for smooth path interpolation.</p>
  134. <p>Default is <code>100</code>.</p>
  135. </div>
  136. </div>
  137. <div class="member">
  138. <h3 class="name" id="isAnimationPathHelper" translate="no">.<a href="#isAnimationPathHelper">isAnimationPathHelper</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  139. <div class="description">
  140. <p>This flag can be used for type testing.</p>
  141. <p>Default is <code>true</code>.</p>
  142. </div>
  143. </div>
  144. <div class="member">
  145. <h3 class="name" id="line" translate="no">.<a href="#line">line</a><span class="type-signature"> : <a href="Line.html">Line</a></span> </h3>
  146. <div class="description">
  147. <p>The line representing the animation path.</p>
  148. </div>
  149. </div>
  150. <div class="member">
  151. <h3 class="name" id="object" translate="no">.<a href="#object">object</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  152. <div class="description">
  153. <p>The object whose path is being visualized.</p>
  154. </div>
  155. </div>
  156. <div class="member">
  157. <h3 class="name" id="points" translate="no">.<a href="#points">points</a><span class="type-signature"> : <a href="Points.html">Points</a> | null</span> </h3>
  158. <div class="description">
  159. <p>Points marking keyframe positions.</p>
  160. </div>
  161. </div>
  162. <div class="member">
  163. <h3 class="name" id="root" translate="no">.<a href="#root">root</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  164. <div class="description">
  165. <p>The root object containing the animation clips.</p>
  166. </div>
  167. </div>
  168. <h2 class="subsection-title">Methods</h2>
  169. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  170. <div class="method">
  171. <div class="description">
  172. <p>Frees the GPU-related resources allocated by this instance.</p>
  173. </div>
  174. </div>
  175. <h3 class="name name-method" id="setColor" translate="no">.<a href="#setColor">setColor</a><span class="signature">( color : <span class="param-type">number | <a href="Color.html">Color</a> | string</span> )</span> </h3>
  176. <div class="method">
  177. <div class="description">
  178. <p>Sets the path line color.</p>
  179. </div>
  180. <table class="params">
  181. <tbody>
  182. <tr>
  183. <td class="name">
  184. <strong translate="no">color</strong>
  185. </td>
  186. <td class="description last">
  187. <p>The new color.</p>
  188. </td>
  189. </tr>
  190. </tbody>
  191. </table>
  192. </div>
  193. <h3 class="name name-method" id="setMarkerColor" translate="no">.<a href="#setMarkerColor">setMarkerColor</a><span class="signature">( color : <span class="param-type">number | <a href="Color.html">Color</a> | string</span> )</span> </h3>
  194. <div class="method">
  195. <div class="description">
  196. <p>Sets the keyframe marker color.</p>
  197. </div>
  198. <table class="params">
  199. <tbody>
  200. <tr>
  201. <td class="name">
  202. <strong translate="no">color</strong>
  203. </td>
  204. <td class="description last">
  205. <p>The new color.</p>
  206. </td>
  207. </tr>
  208. </tbody>
  209. </table>
  210. </div>
  211. <h3 class="name name-method" id="updateMatrixWorld" translate="no">.<a href="#updateMatrixWorld">updateMatrixWorld</a><span class="signature">( force : <span class="param-type">boolean</span> )</span> </h3>
  212. <div class="method">
  213. <div class="description">
  214. <p>Updates the helper's transform to match the object's parent.</p>
  215. </div>
  216. <table class="params">
  217. <tbody>
  218. <tr>
  219. <td class="name">
  220. <strong translate="no">force</strong>
  221. </td>
  222. <td class="description last">
  223. <p>Force matrix update.</p>
  224. </td>
  225. </tr>
  226. </tbody>
  227. </table>
  228. <dl class="details">
  229. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Object3D.html#updateMatrixWorld">Object3D#updateMatrixWorld</a></dt>
  230. </dl>
  231. </div>
  232. <h2 class="subsection-title">Source</h2>
  233. <p>
  234. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/AnimationPathHelper.js" translate="no" target="_blank" rel="noopener">examples/jsm/helpers/AnimationPathHelper.js</a>
  235. </p>
  236. </article>
  237. </section>
  238. <script src="../scripts/linenumber.js"></script>
  239. <script src="../scripts/page.js"></script>
  240. </body>
  241. </html>
粤ICP备19079148号