📄 threejs/Addons/Lines/Line2

File: Line2.md | Updated: 11/15/2025


title: Line2 category: Addons layout: docs

Line2

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.

Code Example

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 );

Import

Line2 is an addon, and must be imported explicitly, see Installation#Addons.

import { Line2 } from 'three/addons/lines/Line2.js';

Constructor

new Line2( geometry : LineGeometry, material : LineMaterial )

Constructs a new wide line.

geometry | The line geometry.
---|---
material | The line material.

Properties

.isLine2 : boolean (readonly)

This flag can be used for type testing.

Default is true.

Source

examples/jsm/lines/Line2.js