CubicBezierCurve.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Curve] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. Create a smooth 2d
  14. <a
  15. href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve#mediaviewer/File:Bezier_curve.svg"
  16. target="_blank"
  17. >cubic bezier curve</a
  18. >, defined by a start point, endpoint and two control points.
  19. </p>
  20. <h2>Code Example</h2>
  21. <code>
  22. const curve = new THREE.CubicBezierCurve(
  23. new THREE.Vector2( -10, 0 ),
  24. new THREE.Vector2( -5, 15 ),
  25. new THREE.Vector2( 20, 15 ),
  26. new THREE.Vector2( 10, 0 )
  27. );
  28. const points = curve.getPoints( 50 );
  29. const geometry = new THREE.BufferGeometry().setFromPoints( points );
  30. const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
  31. // Create the final object to add to the scene
  32. const curveObject = new THREE.Line( geometry, material );
  33. </code>
  34. <h2>Constructor</h2>
  35. <h3>
  36. [name] ( [param:Vector2 v0], [param:Vector2 v1], [param:Vector2 v2],
  37. [param:Vector2 v3] )
  38. </h3>
  39. <p>
  40. [page:Vector2 v0] – The starting point.<br />
  41. [page:Vector2 v1] – The first control point.<br />
  42. [page:Vector2 v2] – The second control point.<br />
  43. [page:Vector2 v3] – The ending point.
  44. </p>
  45. <h2>Properties</h2>
  46. <p>See the base [page:Curve] class for common properties.</p>
  47. <h3>[property:Vector2 v0]</h3>
  48. <p>The starting point.</p>
  49. <h3>[property:Vector2 v1]</h3>
  50. <p>The first control point.</p>
  51. <h3>[property:Vector2 v2]</h3>
  52. <p>The second control point.</p>
  53. <h3>[property:Vector2 v3]</h3>
  54. <p>The ending point.</p>
  55. <h2>Methods</h2>
  56. <p>See the base [page:Curve] class for common Methods.</p>
  57. <h2>Source</h2>
  58. <p>
  59. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  60. </p>
  61. </body>
  62. </html>