SplineCurve.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 spline curve from a series of points. Internally this
  14. uses [page:Interpolations.CatmullRom] to create the curve.
  15. </p>
  16. <h2>Code Example</h2>
  17. <code>
  18. // 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>
  32. <h2>Constructor</h2>
  33. <h3>[name]( [param:Array points] )</h3>
  34. <p>points – An array of [page:Vector2] points that define the curve.</p>
  35. <h2>Properties</h2>
  36. <p>See the base [page:Curve] class for common properties.</p>
  37. <h3>[property:Array points]</h3>
  38. <p>The array of [page:Vector2] points that define the curve.</p>
  39. <h2>Methods</h2>
  40. <p>See the base [page:Curve] class for common methods.</p>
  41. <h2>Source</h2>
  42. <p>
  43. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  44. </p>
  45. </body>
  46. </html>