File: Line.md | Updated: 11/15/2025
A continuous line. The line are rendered by connecting consecutive vertices with straight lines.
const material = new THREE.LineBasicMaterial( { color: 0x0000ff } );
const points = [];
points.push( new THREE.Vector3( - 10, 0, 0 ) );
points.push( new THREE.Vector3( 0, 10, 0 ) );
points.push( new THREE.Vector3( 10, 0, 0 ) );
const geometry = new THREE.BufferGeometry().setFromPoints( points );
const line = new THREE.Line( geometry, material );
scene.add( line );
Constructs a new line.
geometry | The line geometry.
---|---
material | The line material.
The line geometry.
This flag can be used for type testing.
Default is true.
The line material.
Default is LineBasicMaterial.
A dictionary representing the morph targets in the geometry. The key is the morph targets name, the value its attribute index. This member is undefined by default and only set when morph targets are detected in the geometry.
Default is undefined.
An array of weights typically in the range [0,1] that specify how much of the morph is applied. This member is undefined by default and only set when morph targets are detected in the geometry.
Default is undefined.
Computes an array of distance values which are necessary for rendering dashed lines. For each vertex in the geometry, the method calculates the cumulative length from the current point to the very beginning of the line.
Returns: A reference to this line.
Computes intersection points between a casted ray and this line.
raycaster | The raycaster.
---|---
intersects | The target array that holds the intersection points.
Overrides: Object3D#raycast
Sets the values of Line#morphTargetDictionary and Line#morphTargetInfluences to make sure existing morph targets can influence this 3D object.