SplineCurve.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Curve] &rarr;
  12. <h1>[name]</h1>
  13. <p class="desc">
  14. Create a smooth 2d spline curve from a series of points. Internally this uses
  15. [page:Interpolations.CatmullRom] to create the curve.
  16. </p>
  17. <h2>Code Example</h2>
  18. <code>
  19. // Create a sine-like wave
  20. var curve = new THREE.SplineCurve( [
  21. new THREE.Vector2( -10, 0 ),
  22. new THREE.Vector2( -5, 5 ),
  23. new THREE.Vector2( 0, 0 ),
  24. new THREE.Vector2( 5, -5 ),
  25. new THREE.Vector2( 10, 0 )
  26. ] );
  27. var points = curve.getPoints( 50 );
  28. var geometry = new THREE.BufferGeometry().setFromPoints( points );
  29. var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
  30. // Create the final object to add to the scene
  31. var splineObject = new THREE.Line( geometry, material );
  32. </code>
  33. <h2>Constructor</h2>
  34. <h3>[name]( [param:Array points] )</h3>
  35. <p>points – An array of [page:Vector2] points that define the curve.</p>
  36. <h2>Properties</h2>
  37. <p>See the base [page:Curve] class for common properties.</p>
  38. <h3>[property:Array points]</h3>
  39. <p>The array of [page:Vector2] points that define the curve.</p>
  40. <h2>Methods</h2>
  41. <p>See the base [page:Curve] class for common methods.</p>
  42. <h2>Source</h2>
  43. <p>
  44. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  45. </p>
  46. </body>
  47. </html>