File: Line2.md | Updated: 11/15/2025
A polyline drawn between vertices.
This adds functionality beyond Line, like arbitrary line width and changing width to be in world units.It extends LineSegments2, simplifying constructing segments from a chain of points.
This module can only be used with WebGLRenderer. When using WebGPURenderer, import the class from lines/webgpu/Line2.js.
const geometry = new LineGeometry();
geometry.setPositions( positions );
geometry.setColors( colors );
const material = new LineMaterial( { linewidth: 5, vertexColors: true } };
const line = new Line2( geometry, material );
scene.add( line );
Line2 is an addon, and must be imported explicitly, see Installation#Addons.
import { Line2 } from 'three/addons/lines/Line2.js';
Constructs a new wide line.
geometry | The line geometry.
---|---
material | The line material.
This flag can be used for type testing.
Default is true.