Skip to main content

Curve

CubicBezierCurve

Create a smooth 2dcubic bezier curve, defined by a start point, endpoint and two control points.

Code Example

const curve = new THREE.CubicBezierCurve( new THREE.Vector2( -10, 0 ), new
THREE.Vector2( -5, 15 ), new THREE.Vector2( 20, 15 ), new THREE.Vector2( 10, 0
) ); const points = curve.getPoints( 50 ); const geometry = new
THREE.BufferGeometry().setFromPoints( points ); const material = new
THREE.LineBasicMaterial( { color: 0xff0000 } ); // Create the final object to
add to the scene const curveObject = new THREE.Line( geometry, material );

Constructor

CubicBezierCurve ( [param:Vector2 v0], [param:Vector2 v1], [param:Vector2

v2], [param:Vector2 v3] )

v0 – The starting point.
v1 – The first control point.
v2 – The second control point.
v3 – The ending point.

Properties

See the base Curve class for common properties.

v0

v0: Vector2;  

The starting point.

v1

v1: Vector2;  

The first control point.

v2

v2: Vector2;  

The second control point.

v3

v3: Vector2;  

The ending point.

Methods

See the base Curve class for common Methods.

Source

src/extras/curves/CubicBezierCurve.js