SplineCurve.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SplineCurve - 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="Curve.html">Curve</a> → </p>
  13. <h1 translate="no">SplineCurve</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A curve representing a 2D spline curve.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">// Create a sine-like wave
  19. const curve = new THREE.SplineCurve( [
  20. new THREE.Vector2( -10, 0 ),
  21. new THREE.Vector2( -5, 5 ),
  22. new THREE.Vector2( 0, 0 ),
  23. new THREE.Vector2( 5, -5 ),
  24. new THREE.Vector2( 10, 0 )
  25. ] );
  26. const points = curve.getPoints( 50 );
  27. const geometry = new THREE.BufferGeometry().setFromPoints( points );
  28. const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
  29. // Create the final object to add to the scene
  30. const splineObject = new THREE.Line( geometry, material );
  31. </code></pre></div>
  32. </header>
  33. <article>
  34. <div class="container-overview">
  35. <h2>Constructor</h2>
  36. <h3 class="name name-method" id="SplineCurve" translate="no">new <a href="#SplineCurve">SplineCurve</a><span class="signature">( points : <span class="param-type">Array.&lt;<a href="Vector2.html">Vector2</a>></span> )</span> </h3>
  37. <div class="method">
  38. <div class="description">
  39. <p>Constructs a new 2D spline curve.</p>
  40. </div>
  41. <table class="params">
  42. <tbody>
  43. <tr>
  44. <td class="name">
  45. <strong>points</strong>
  46. </td>
  47. <td class="description last">
  48. <p>An array of 2D points defining the curve.</p>
  49. </td>
  50. </tr>
  51. </tbody>
  52. </table>
  53. </div>
  54. </div>
  55. <h2 class="subsection-title">Properties</h2>
  56. <div class="member">
  57. <h3 class="name" id="isSplineCurve" translate="no">.<a href="#isSplineCurve">isSplineCurve</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  58. <div class="description">
  59. <p>This flag can be used for type testing.</p>
  60. <p>Default is <code>true</code>.</p>
  61. </div>
  62. </div>
  63. <div class="member">
  64. <h3 class="name" id="points" translate="no">.<a href="#points">points</a><span class="type-signature"> : Array.&lt;<a href="Vector2.html">Vector2</a>></span> </h3>
  65. <div class="description">
  66. <p>An array of 2D points defining the curve.</p>
  67. </div>
  68. </div>
  69. <h2 class="subsection-title">Methods</h2>
  70. <h3 class="name name-method" id="getPoint" translate="no">.<a href="#getPoint">getPoint</a><span class="signature">( t : <span class="param-type">number</span>, optionalTarget : <span class="param-type"><a href="Vector2.html">Vector2</a></span> )</span><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  71. <div class="method">
  72. <div class="description">
  73. <p>Returns a point on the curve.</p>
  74. </div>
  75. <table class="params">
  76. <tbody>
  77. <tr>
  78. <td class="name">
  79. <strong>t</strong>
  80. </td>
  81. <td class="description last">
  82. <p>A interpolation factor representing a position on the curve. Must be in the range <code>[0,1]</code>.</p>
  83. </td>
  84. </tr>
  85. <tr>
  86. <td class="name">
  87. <strong>optionalTarget</strong>
  88. </td>
  89. <td class="description last">
  90. <p>The optional target vector the result is written to.</p>
  91. </td>
  92. </tr>
  93. </tbody>
  94. </table>
  95. <dl class="details">
  96. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Curve.html#getPoint">Curve#getPoint</a></dt>
  97. </dl>
  98. <dl class="details">
  99. <dt class="tag-returns"><strong>Returns:</strong> The position on the curve.</dt>
  100. </dl>
  101. </div>
  102. <h2 class="subsection-title">Source</h2>
  103. <p>
  104. <a href="https://github.com/mrdoob/three.js/blob/master/src/extras/curves/SplineCurve.js" translate="no" target="_blank" rel="noopener">src/extras/curves/SplineCurve.js</a>
  105. </p>
  106. </article>
  107. </section>
  108. <script src="../scripts/linenumber.js"></script>
  109. <script src="../scripts/page.js"></script>
  110. </body>
  111. </html>
粤ICP备19079148号