import {CubicBezierCurve} from '@xeokit/xeokit-sdk/src/viewer/scene/paths/CubicBezierCurve.js'CubicBezierCurve
A Curve along which a 3D position can be animated.
- As shown in the diagram below, a CubicBezierCurve is defined by four control points.
- You can sample a CubicBezierCurve#point and a CubicBezierCurve#tangent vector on a CubicBezierCurve for any given value of CubicBezierCurve#t in the range [0..1].
- When you set CubicBezierCurve#t on a CubicBezierCurve, its CubicBezierCurve#point and CubicBezierCurve#tangent properties will update accordingly.
- To build a complex path, you can combine an unlimited combination of CubicBezierCurves, QuadraticBezierCurves and SplineCurves into a Path.
Constructor Summary
| Public Constructor | ||
| public |
constructor(owner: Component, cfg: *) |
|
Member Summary
| Public Members | ||
| public get |
Returns point on this CubicBezierCurve at the given position. |
|
| public set |
Sets the current position of progress along this CubicBezierCurve. |
|
| public get |
Gets the current position of progress along this CubicBezierCurve. |
|
| public set |
Sets the starting point on this CubicBezierCurve. |
|
| public get |
Gets the starting point on this CubicBezierCurve. |
|
| public set |
Sets the first control point on this CubicBezierCurve. |
|
| public get |
Gets the first control point on this CubicBezierCurve. |
|
| public set |
Sets the second control point on this CubicBezierCurve. |
|
| public get |
Gets the second control point on this CubicBezierCurve. |
|
| public set |
Sets the end point on this CubicBezierCurve. |
|
| public get |
Gets the end point on this CubicBezierCurve. |
|
Method Summary
| Public Methods | ||
| public |
getJSON(): {"v0": *, "v1": *, "v2": *, "v3": *, "t": *} |
|
| public |
Returns point on this CubicBezierCurve 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 |
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 |
tangent: *: * 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): * 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 CubicBezierCurve as well. |
| cfg | * |
|
Configs |
| cfg.id | String |
|
Optional ID, unique among all components in the parent Scene, generated automatically when omitted. |
| cfg.v0 | Number[] |
|
The starting point. |
| cfg.v1 | Number[] |
|
The first control point. |
| cfg.v2 | Number[] |
|
The middle control point. |
| cfg.v3 | Number[] |
|
The ending point. |
| cfg.t | Number |
|
Current position on this CubicBezierCurve, in range between 0..1. |
Public Members
public get point(t: Number): *: * source
Returns point on this CubicBezierCurve at the given position.
Return:
| * | The point at the given position. |
public set t(value: Number) source
Sets the current position of progress along this CubicBezierCurve.
Automatically clamps to range [0..1].
Override:
Curve#tpublic get t: Number: * source
Gets the current position of progress along this CubicBezierCurve.
Override:
Curve#tpublic set v0(value: Number[]) source
Sets the starting point on this CubicBezierCurve.
Default value is [0.0, 0.0, 0.0]
public get v0: Number[]: * source
Gets the starting point on this CubicBezierCurve.
Default value is [0.0, 0.0, 0.0]
public set v1(value: Number[]) source
Sets the first control point on this CubicBezierCurve.
Default value is [0.0, 0.0, 0.0]
public get v1: Number[]: * source
Gets the first control point on this CubicBezierCurve.
Fires a CubicBezierCurve#v1:event event on change.
Default value is [0.0, 0.0, 0.0]
public set v2(value: Number[]) source
Sets the second control point on this CubicBezierCurve.
Default value is [0.0, 0.0, 0.0]
public get v2: Number[]: * source
Gets the second control point on this CubicBezierCurve.
Default value is [0.0, 0.0, 0.0]
Public Methods
public getJSON(): {"v0": *, "v1": *, "v2": *, "v3": *, "t": *} source
Return:
| {"v0": *, "v1": *, "v2": *, "v3": *, "t": *} |
Reference
Source
