import {SplineCurve} from '@xeokit/xeokit-sdk/src/viewer/scene/paths/SplineCurve.js'
SplineCurve
A Curve along which a 3D position can be animated.
- As shown in the diagram below, a SplineCurve is defined by three or more control points.
- You can sample a SplineCurve#point and a Curve#tangent vector on a SplineCurve for any given value of SplineCurve#t in the range
[0..1]
. - When you set SplineCurve#t on a SplineCurve, its SplineCurve#point and Curve#tangent will update accordingly.
To build a complex path, you can combine an unlimited combination of SplineCurves, CubicBezierCurve and QuadraticBezierCurve into a Path.
Constructor Summary
Public Constructor | ||
public |
constructor(owner: Component, cfg: *) |
Member Summary
Public Members | ||
public get |
Gets the point on this SplineCurve at position SplineCurve#t. |
|
public set |
Sets the control points on this SplineCurve. |
|
public get |
Gets the control points on this SplineCurve. |
|
public set |
Sets the progress along this SplineCurve. |
|
public get |
Gets the progress along this SplineCurve. |
Method Summary
Public Methods | ||
public |
getJSON(): {"points": *, "t": *} |
|
public |
Returns point on this SplineCurve at the given position. |
Inherited Summary
From class Component | ||
public get |
The Component that owns the lifecycle of this Component, if any. |
|
public |
True as soon as this Component has been destroyed |
|
public |
ID of this Component, unique within the Scene. |
|
public |
meta: * Arbitrary, user-defined metadata on this component. |
|
public |
The parent Scene that contains this Component. |
|
public |
The viewer that contains this Scene. |
|
public |
clear() Destroys all Components that are owned by this. |
|
public |
destroy() Destroys this component. |
|
public |
Logs an error for this component to the JavaScript console. |
|
public |
Fires an event on this component. |
|
public |
Returns true if there are any subscribers to the given event on this component. |
|
public |
Tests if this component is of the given type, or is a subclass of the given type. |
|
public |
Logs a console debugging message for this component. |
|
public |
Cancels an event subscription that was previously made with Component#on or Component#once. |
|
public |
Subscribes to an event on this component. |
|
public |
Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd. |
|
public |
scheduleTask(task: *) Schedule a task to perform on the next browser interval |
|
public |
Logs a warning for this component to the JavaScript console. |
From class Curve | ||
public get |
Gets the length of this Curve. |
|
public get |
Gets the progress along this Curve. |
|
public set |
Sets the progress along this Curve. |
|
public get |
Gets the tangent on this Curve at position Curve#t. |
|
public |
|
|
public |
|
|
public |
getPointAt(u: *): * |
|
public |
Samples points on this Curve, at the given number of equally-spaced divisions. |
|
public |
getTangent(t: Number): Number[] Returns a normalized tangent vector on this Curve at the given position. |
|
public |
getUToTMapping(u: *, distance: *): * |
Public Constructors
public constructor(owner: Component, cfg: *) source
Override:
Curve#constructorParams:
Name | Type | Attribute | Description |
owner | Component |
|
Owner component. When destroyed, the owner will destroy this SplineCurve as well. |
cfg | * |
|
Configs |
cfg.id | String |
|
Optional ID, unique among all components in the parent Scene, generated automatically when omitted. |
cfg.points | Array |
|
Control points on this SplineCurve. |
cfg.t | Number |
|
Current position on this SplineCurve, in range between 0..1. |
cfg.t | Number |
|
Current position on this CubicBezierCurve, in range between 0..1. |
Public Members
public set points(value: Number[]) source
Sets the control points on this SplineCurve.
Default value is []
.
public get points: Number[]: * source
Gets the control points on this SplineCurve.
Default value is []
.