SplineCurve.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!DOCTYPE html>
  2. <html lang="zh">
  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. 从一系列的点中,创建一个平滑的二维样条曲线。内部使用[page:Interpolations.CatmullRom]来创建曲线。
  14. </p>
  15. <h2>代码示例</h2>
  16. <code>
  17. // Create a sine-like wave
  18. const curve = new THREE.SplineCurve( [
  19. new THREE.Vector2( -10, 0 ),
  20. new THREE.Vector2( -5, 5 ),
  21. new THREE.Vector2( 0, 0 ),
  22. new THREE.Vector2( 5, -5 ),
  23. new THREE.Vector2( 10, 0 )
  24. ] );
  25. const points = curve.getPoints( 50 );
  26. const geometry = new THREE.BufferGeometry().setFromPoints( points );
  27. const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
  28. // Create the final object to add to the scene
  29. const splineObject = new THREE.Line( geometry, material );
  30. </code>
  31. <h2>构造函数</h2>
  32. <h3>[name]( [param:Array points] )</h3>
  33. <p>points – 定义曲线的[page:Vector2]点的数组。</p>
  34. <h2>属性</h2>
  35. <p>共有属性请参见其基类[page:Curve]。</p>
  36. <h3>[property:Array points]</h3>
  37. <p>定义这一曲线的[page:Vector2]点的数组。</p>
  38. <h2>方法</h2>
  39. <p>共有方法请参见其基类[page:Curve]。</p>
  40. <h2>源代码</h2>
  41. <p>
  42. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  43. </p>
  44. </body>
  45. </html>