CubicBezierCurve.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CubicBezierCurve - 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">CubicBezierCurve</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A curve representing a 2D Cubic Bezier curve.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const curve = new THREE.CubicBezierCurve(
  19. new THREE.Vector2( - 0, 0 ),
  20. new THREE.Vector2( - 5, 15 ),
  21. new THREE.Vector2( 20, 15 ),
  22. new THREE.Vector2( 10, 0 )
  23. );
  24. const points = curve.getPoints( 50 );
  25. const geometry = new THREE.BufferGeometry().setFromPoints( points );
  26. const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
  27. // Create the final object to add to the scene
  28. const curveObject = new THREE.Line( geometry, material );
  29. </code></pre></div>
  30. </header>
  31. <article>
  32. <div class="container-overview">
  33. <h2>Constructor</h2>
  34. <h3 class="name name-method" id="CubicBezierCurve" translate="no">new <a href="#CubicBezierCurve">CubicBezierCurve</a><span class="signature">( v0 : <span class="param-type"><a href="Vector2.html">Vector2</a></span>, v1 : <span class="param-type"><a href="Vector2.html">Vector2</a></span>, v2 : <span class="param-type"><a href="Vector2.html">Vector2</a></span>, v3 : <span class="param-type"><a href="Vector2.html">Vector2</a></span> )</span> </h3>
  35. <div class="method">
  36. <div class="description">
  37. <p>Constructs a new Cubic Bezier curve.</p>
  38. </div>
  39. <table class="params">
  40. <tbody>
  41. <tr>
  42. <td class="name">
  43. <strong>v0</strong>
  44. </td>
  45. <td class="description last">
  46. <p>The start point.</p>
  47. </td>
  48. </tr>
  49. <tr>
  50. <td class="name">
  51. <strong>v1</strong>
  52. </td>
  53. <td class="description last">
  54. <p>The first control point.</p>
  55. </td>
  56. </tr>
  57. <tr>
  58. <td class="name">
  59. <strong>v2</strong>
  60. </td>
  61. <td class="description last">
  62. <p>The second control point.</p>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td class="name">
  67. <strong>v3</strong>
  68. </td>
  69. <td class="description last">
  70. <p>The end point.</p>
  71. </td>
  72. </tr>
  73. </tbody>
  74. </table>
  75. </div>
  76. </div>
  77. <h2 class="subsection-title">Properties</h2>
  78. <div class="member">
  79. <h3 class="name" id="isCubicBezierCurve" translate="no">.<a href="#isCubicBezierCurve">isCubicBezierCurve</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  80. <div class="description">
  81. <p>This flag can be used for type testing.</p>
  82. <p>Default is <code>true</code>.</p>
  83. </div>
  84. </div>
  85. <div class="member">
  86. <h3 class="name" id="v0" translate="no">.<a href="#v0">v0</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  87. <div class="description">
  88. <p>The start point.</p>
  89. </div>
  90. </div>
  91. <div class="member">
  92. <h3 class="name" id="v1" translate="no">.<a href="#v1">v1</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  93. <div class="description">
  94. <p>The first control point.</p>
  95. </div>
  96. </div>
  97. <div class="member">
  98. <h3 class="name" id="v2" translate="no">.<a href="#v2">v2</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  99. <div class="description">
  100. <p>The second control point.</p>
  101. </div>
  102. </div>
  103. <div class="member">
  104. <h3 class="name" id="v3" translate="no">.<a href="#v3">v3</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  105. <div class="description">
  106. <p>The end point.</p>
  107. </div>
  108. </div>
  109. <h2 class="subsection-title">Methods</h2>
  110. <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>
  111. <div class="method">
  112. <div class="description">
  113. <p>Returns a point on the curve.</p>
  114. </div>
  115. <table class="params">
  116. <tbody>
  117. <tr>
  118. <td class="name">
  119. <strong>t</strong>
  120. </td>
  121. <td class="description last">
  122. <p>A interpolation factor representing a position on the curve. Must be in the range <code>[0,1]</code>.</p>
  123. </td>
  124. </tr>
  125. <tr>
  126. <td class="name">
  127. <strong>optionalTarget</strong>
  128. </td>
  129. <td class="description last">
  130. <p>The optional target vector the result is written to.</p>
  131. </td>
  132. </tr>
  133. </tbody>
  134. </table>
  135. <dl class="details">
  136. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Curve.html#getPoint">Curve#getPoint</a></dt>
  137. </dl>
  138. <dl class="details">
  139. <dt class="tag-returns"><strong>Returns:</strong> The position on the curve.</dt>
  140. </dl>
  141. </div>
  142. <h2 class="subsection-title">Source</h2>
  143. <p>
  144. <a href="https://github.com/mrdoob/three.js/blob/master/src/extras/curves/CubicBezierCurve.js" translate="no" target="_blank" rel="noopener">src/extras/curves/CubicBezierCurve.js</a>
  145. </p>
  146. </article>
  147. </section>
  148. <script src="../scripts/linenumber.js"></script>
  149. <script src="../scripts/page.js"></script>
  150. </body>
  151. </html>
粤ICP备19079148号