Capítulo 367 de 859
A curve representing a 2D spline curve.
// Create a sine-like wave
const curve = new THREE.SplineCurve( [
new THREE.Vector2( -10, 0 ),
new THREE.Vector2( -5, 5 ),
new THREE.Vector2( 0, 0 ),
new THREE.Vector2( 5, -5 ),
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 splineObject = new THREE.Line( geometry, material );
Constructor
| Signature |
|---|
new SplineCurve( points : Array.<Vector2> ) |
Properties
| Property | Description |
|---|---|
.isSplineCurve : boolean (readonly) | This flag can be used for type testing. |
.points : Array.<Vector2> | An array of 2D points defining the curve. |
Methods
| Method | Description |
|---|---|
.getPoint( t : number, optionalTarget : Vector2 ) : Vector2 | Returns a point on the curve. |