SplineCurve.html 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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;Vector2></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"><code>points</code></td>
  45. <td class="description last"><p>An array of 2D points defining the curve.</p></td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. </div>
  50. </div>
  51. <h2 class="subsection-title">Properties</h2>
  52. <div class="member">
  53. <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>
  54. <div class="description">
  55. <p>This flag can be used for type testing.<br/>Default is <code>true</code>.</p>
  56. </div>
  57. </div>
  58. <div class="member">
  59. <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>
  60. <div class="description">
  61. <p>An array of 2D points defining the curve.</p>
  62. </div>
  63. </div>
  64. <h2 class="subsection-title">Methods</h2>
  65. <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">Vector2</span> )</span><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  66. <div class="method">
  67. <div class="description">
  68. <p>Returns a point on the curve.</p>
  69. </div>
  70. <table class="params">
  71. <tbody>
  72. <tr>
  73. <td class="name"><code>t</code></td>
  74. <td class="description last"><p>A interpolation factor representing a position on the curve. Must be in the range <code>[0,1]</code>.</p></td>
  75. </tr>
  76. <tr>
  77. <td class="name"><code>optionalTarget</code></td>
  78. <td class="description last"><p>The optional target vector the result is written to.</p></td>
  79. </tr>
  80. </tbody>
  81. </table>
  82. <dl class="details">
  83. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Curve.html#getPoint">Curve#getPoint</a></dt>
  84. </dl>
  85. <dl class="details">
  86. <dt class="tag-returns"><strong>Returns:</strong> The position on the curve.</dt>
  87. </dl>
  88. </div>
  89. <h2 class="subsection-title">Source</h2>
  90. <p>
  91. <a href="https://github.com/mrdoob/three.js/blob/master/src/extras/curves/SplineCurve.js" target="_blank" rel="noopener" translate="no">src/extras/curves/SplineCurve.js</a>
  92. </p>
  93. </article>
  94. </section>
  95. <script src="../scripts/linenumber.js"></script>
  96. <script src="../scripts/page.js"></script>
  97. </body>
  98. </html>
粤ICP备19079148号