Line.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <!DOCTYPE html>
  2. <html lang="zh">
  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:Object3D] &rarr;
  12. <h1>线([name])</h1>
  13. <p class="desc">
  14. 一条连续的线。<br /><br />
  15. 它几乎和[page:LineSegments]是一样的,唯一的区别是它在渲染时使用的是[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP],
  16. 而不是[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINES]。
  17. </p>
  18. <h2>代码示例</h2>
  19. <code>
  20. var material = new THREE.LineBasicMaterial({
  21. color: 0x0000ff
  22. });
  23. var points = [];
  24. points.push( new THREE.Vector3( - 10, 0, 0 ) );
  25. points.push( new THREE.Vector3( 0, 10, 0 ) );
  26. points.push( new THREE.Vector3( 10, 0, 0 ) );
  27. var geometry = new THREE.BufferGeometry().setFromPoints( points );
  28. var line = new THREE.Line( geometry, material );
  29. scene.add( line );
  30. </code>
  31. <h2>构造器</h2>
  32. <h3>[name]( [param:Geometry geometry], [param:Material material] )</h3>
  33. <p>
  34. [page:Geometry geometry] —— 表示线段的顶点,默认值是一个新的[page:BufferGeometry]。<br />
  35. [page:Material material] —— 线的材质,默认值是一个新的具有随机颜色的[page:LineBasicMaterial]。<br />
  36. </p>
  37. <h2>属性</h2>
  38. <p>共有属性请参见其基类[page:Object3D]。</p>
  39. <h3>[property:Geometry geometry]</h3>
  40. <p>表示线段的顶点。</p>
  41. <h3>[property:Material material]</h3>
  42. <p>线的材质。</p>
  43. <h3>[property:Array morphTargetInfluences]</h3>
  44. <p>
  45. An array of weights typically from 0-1 that specify how much of the morph is applied.
  46. Undefined by default, but reset to a blank array by [page:.updateMorphTargets]().
  47. </p>
  48. <h3>[property:Object morphTargetDictionary]</h3>
  49. <p>
  50. A dictionary of morphTargets based on the morphTarget.name property.
  51. Undefined by default, but rebuilt [page:.updateMorphTargets]().
  52. </p>
  53. <h2>方法</h2>
  54. <p>共有方法请参见其基类 [page:Object3D]。</p>
  55. <h3>[method:Line computeLineDistances]()</h3>
  56. <p>
  57. 计算[page:LineDashedMaterial]所需的距离的值的数组。
  58. 对于几何体中的每一个顶点,这个方法计算出了当前点到线的起始点的累积长度。
  59. </p>
  60. <h3>[method:null raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
  61. <p>
  62. 在一条投射出去的[page:Ray](射线)和这条线之间产生交互。
  63. [page:Raycaster.intersectObject]将会调用这个方法。
  64. </p>
  65. <h3>[method:Line clone]()</h3>
  66. <p>
  67. 返回这条线及其子集的一个克隆对象。
  68. </p>
  69. <h3>[method:null updateMorphTargets]()</h3>
  70. <p>
  71. Updates the morphTargets to have no influence on the object. Resets the
  72. [page:.morphTargetInfluences] and [page:.morphTargetDictionary] properties.
  73. </p>
  74. <h2>源代码</h2>
  75. <p>
  76. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  77. </p>
  78. </body>
  79. </html>