Line.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 as [page:LineSegments]; the only difference is
  15. that it is rendered using
  16. [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP] instead of
  17. [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>
  34. [name]( [param:BufferGeometry geometry], [param:Material material] )
  35. </h3>
  36. <p>
  37. [page:BufferGeometry geometry] — vertices representing the line
  38. segment(s). Default is a new [page:BufferGeometry].<br />
  39. [page:Material material] — material for the line. Default is a new
  40. [page:LineBasicMaterial].<br />
  41. </p>
  42. <h2>Properties</h2>
  43. <p>See the base [page:Object3D] class for common properties.</p>
  44. <h3>[property:BufferGeometry geometry]</h3>
  45. <p>Vertices representing the line segment(s).</p>
  46. <h3>[property:Boolean isLine]</h3>
  47. <p>Read-only flag to check if a given object is of type [name].</p>
  48. <h3>[property:Material material]</h3>
  49. <p>Material for the line.</p>
  50. <h3>[property:Array morphTargetInfluences]</h3>
  51. <p>
  52. An array of weights typically from 0-1 that specify how much of the morph
  53. is applied. Undefined by default, but reset to a blank array by
  54. [page:.updateMorphTargets]().
  55. </p>
  56. <h3>[property:Object morphTargetDictionary]</h3>
  57. <p>
  58. A dictionary of morphTargets based on the morphTarget.name property.
  59. Undefined by default, but rebuilt [page:.updateMorphTargets]().
  60. </p>
  61. <h2>Methods</h2>
  62. <p>See the base [page:Object3D] class for common methods.</p>
  63. <h3>[method:this computeLineDistances]()</h3>
  64. <p>
  65. Computes an array of distance values which are necessary for
  66. [page:LineDashedMaterial]. For each vertex in the geometry, the method
  67. calculates the cumulative length from the current point to the very
  68. beginning of the line.
  69. </p>
  70. <h3>
  71. [method:undefined raycast]( [param:Raycaster raycaster], [param:Array intersects] )
  72. </h3>
  73. <p>
  74. Get intersections between a casted [page:Ray] and this Line.
  75. [page:Raycaster.intersectObject] will call this method.
  76. </p>
  77. <h3>[method:undefined updateMorphTargets]()</h3>
  78. <p>
  79. Updates the morphTargets to have no influence on the object. Resets the
  80. [page:.morphTargetInfluences] and [page:.morphTargetDictionary]
  81. properties.
  82. </p>
  83. <h2>Source</h2>
  84. <p>
  85. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  86. </p>
  87. </body>
  88. </html>