Line.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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:Object3D] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. A continuous line.<br /><br />
  14. This is nearly the same
  15. as [page:LineSegments]; the only difference is that it is rendered using
  16. [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP]
  17. instead of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINES]
  18. </p>
  19. <h2>Code Example</h2>
  20. <code>
  21. const material = new THREE.LineBasicMaterial({
  22. color: 0x0000ff
  23. });
  24. const points = [];
  25. points.push( new THREE.Vector3( - 10, 0, 0 ) );
  26. points.push( new THREE.Vector3( 0, 10, 0 ) );
  27. points.push( new THREE.Vector3( 10, 0, 0 ) );
  28. const geometry = new THREE.BufferGeometry().setFromPoints( points );
  29. const line = new THREE.Line( geometry, material );
  30. scene.add( line );
  31. </code>
  32. <h2>Constructor</h2>
  33. <h3>[name]( [param:BufferGeometry geometry], [param:Material material] )</h3>
  34. <p>
  35. [page:BufferGeometry geometry] — vertices representing the line segment(s). Default is a new [page:BufferGeometry].<br />
  36. [page:Material material] — material for the line. Default is a new [page:LineBasicMaterial].<br />
  37. </p>
  38. <h2>Properties</h2>
  39. <p>See the base [page:Object3D] class for common properties.</p>
  40. <h3>[property:BufferGeometry geometry]</h3>
  41. <p>Vertices representing the line segment(s).</p>
  42. <h3>[property:Material material]</h3>
  43. <p>Material for the line.</p>
  44. <h3>[property:Array morphTargetInfluences]</h3>
  45. <p>
  46. An array of weights typically from 0-1 that specify how much of the morph is applied.
  47. Undefined by default, but reset to a blank array by [page:.updateMorphTargets]().
  48. </p>
  49. <h3>[property:Object morphTargetDictionary]</h3>
  50. <p>
  51. A dictionary of morphTargets based on the morphTarget.name property.
  52. Undefined by default, but rebuilt [page:.updateMorphTargets]().
  53. </p>
  54. <h2>Methods</h2>
  55. <p>See the base [page:Object3D] class for common methods.</p>
  56. <h3>[method:Line computeLineDistances]()</h3>
  57. <p>
  58. Computes an array of distance values which are necessary for [page:LineDashedMaterial]. For each vertex in the geometry, the method calculates the cumulative length from the current point to the very beginning of the line.
  59. </p>
  60. <h3>[method:null raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
  61. <p>
  62. Get intersections between a casted [page:Ray] and this Line.
  63. [page:Raycaster.intersectObject] will call this method.
  64. </p>
  65. <h3>[method:Line clone]()</h3>
  66. <p>
  67. Returns a clone of this Line object and its descendants.
  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>Source</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>