Line2.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Line2 - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → <a href="Mesh.html">Mesh</a> → <a href="LineSegments2.html">LineSegments2</a> → </p>
  13. <h1 translate="no">Line2</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A polyline drawn between vertices.</p>
  17. <p>This adds functionality beyond <a href="Line.html">Line</a>, like arbitrary line width and changing width to
  18. be in world units.It extends <a href="LineSegments2.html">LineSegments2</a>, simplifying constructing segments from a
  19. chain of points.</p>
  20. <p>This module can only be used with <a href="WebGLRenderer.html">WebGLRenderer</a>. When using <a href="WebGPURenderer.html">WebGPURenderer</a>,
  21. import the class from <code>lines/webgpu/Line2.js</code>.</p></div>
  22. <h2>Code Example</h2>
  23. <div translate="no"><pre><code class="language-js">const geometry = new LineGeometry();
  24. geometry.setPositions( positions );
  25. geometry.setColors( colors );
  26. const material = new LineMaterial( { linewidth: 5, vertexColors: true } };
  27. const line = new Line2( geometry, material );
  28. scene.add( line );
  29. </code></pre></div>
  30. </header>
  31. <article>
  32. <h2 class="subsection-title">Import</h2>
  33. <p><span translate="no">Line2</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  34. <pre><code class="language-js">import { Line2 } from 'three/addons/lines/Line2.js';</code></pre>
  35. <div class="container-overview">
  36. <h2>Constructor</h2>
  37. <h3 class="name name-method" id="Line2" translate="no">new <a href="#Line2">Line2</a><span class="signature">( geometry : <span class="param-type"><a href="LineGeometry.html">LineGeometry</a></span>, material : <span class="param-type"><a href="LineMaterial.html">LineMaterial</a></span> )</span> </h3>
  38. <div class="method">
  39. <div class="description">
  40. <p>Constructs a new wide line.</p>
  41. </div>
  42. <table class="params">
  43. <tbody>
  44. <tr>
  45. <td class="name">
  46. <strong>geometry</strong>
  47. </td>
  48. <td class="description last">
  49. <p>The line geometry.</p>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td class="name">
  54. <strong>material</strong>
  55. </td>
  56. <td class="description last">
  57. <p>The line material.</p>
  58. </td>
  59. </tr>
  60. </tbody>
  61. </table>
  62. </div>
  63. </div>
  64. <h2 class="subsection-title">Properties</h2>
  65. <div class="member">
  66. <h3 class="name" id="isLine2" translate="no">.<a href="#isLine2">isLine2</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  67. <div class="description">
  68. <p>This flag can be used for type testing.</p>
  69. <p>Default is <code>true</code>.</p>
  70. </div>
  71. </div>
  72. <h2 class="subsection-title">Source</h2>
  73. <p>
  74. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/Line2.js" translate="no" target="_blank" rel="noopener">examples/jsm/lines/Line2.js</a>
  75. </p>
  76. </article>
  77. </section>
  78. <script src="../scripts/linenumber.js"></script>
  79. <script src="../scripts/page.js"></script>
  80. </body>
  81. </html>
粤ICP备19079148号