Reference Source
public class | source

CubicBezierCurve

Extends:

ComponentCurve → CubicBezierCurve

A Curve along which a 3D position can be animated.



Cubic Bezier Curve from WikiPedia

Constructor Summary

Public Constructor
public

constructor(owner: Component, cfg: *)

Member Summary

Public Members
public get

point(t: Number): *: *

Returns point on this CubicBezierCurve at the given position.

public get

t: Number: *

Gets the current position of progress along this CubicBezierCurve.

public set

t(value: Number)

Sets the current position of progress along this CubicBezierCurve.

public set

v0(value: Number[])

Sets the starting point on this CubicBezierCurve.

public get

v0: Number[]: *

Gets the starting point on this CubicBezierCurve.

public get

v1: Number[]: *

Gets the first control point on this CubicBezierCurve.

public set

v1(value: Number[])

Sets the first control point on this CubicBezierCurve.

public set

v2(value: Number[])

Sets the second control point on this CubicBezierCurve.

public get

v2: Number[]: *

Gets the second control point on this CubicBezierCurve.

public set

v3(value: Number[])

Sets the end point on this CubicBezierCurve.

public get

v3: Number[]: *

Gets the end point on this CubicBezierCurve.

Method Summary

Public Methods
public

getJSON(): {"v0": *, "v1": *, "v2": *, "v3": *, "t": *}

public

getPoint(t: Number): *

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

viewer: *

public

clear()

Destroys all Components that are owned by this.

public

Destroys this component.

public

error(message: String)

Logs an error for this component to the JavaScript console.

public

fire(event: String, value: Object, forget: Boolean)

Fires an event on this component.

public

Returns true if there are any subscribers to the given event on this component.

public

isType(type: *): *: Boolean

Tests if this component is of the given type, or is a subclass of the given type.

public

log(message: String)

Logs a console debugging message for this component.

public

off(subId: String)

Cancels an event subscription that was previously made with Component#on or Component#once.

public

on(event: String, callback: Function, scope: Object): String

Subscribes to an event on this component.

public

once(event: String, callback: Function, scope: Object)

Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd.

public

warn(message: String)

Logs a warning for this component to the JavaScript console.

From class Curve
public get

Gets the length of this Curve.

public get

t: Number: *

Gets the progress along this Curve.

public set

t(value: Number)

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

getPoints(divisions: Number): *

Samples points on this Curve, at the given number of equally-spaced divisions.

public

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#constructor

Params:

NameTypeAttributeDescription
owner Component
  • optional

Owner component. When destroyed, the owner will destroy this CubicBezierCurve as well.

cfg *
  • optional

Configs

cfg.id String
  • optional

Optional ID, unique among all components in the parent Scene, generated automatically when omitted.

cfg.v0 Number[]
  • optional
  • default: [0,0,0]

The starting point.

cfg.v1 Number[]
  • optional
  • default: [0,0,0]

The first control point.

cfg.v2 Number[]
  • optional
  • default: [0,0,0]

The middle control point.

cfg.v3 Number[]
  • optional
  • default: [0,0,0]

The ending point.

cfg.t Number
  • optional
  • default: 0

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 get t: Number: * source

Gets the current position of progress along this CubicBezierCurve.

Override:

Curve#t

Return:

Number

Current progress time value.

public set t(value: Number) source

Sets the current position of progress along this CubicBezierCurve.

Automatically clamps to range [0..1].

Override:

Curve#t

public 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]

Return:

Number[]

The starting point.

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]

Return:

Number[]

The first control point.

public set v1(value: Number[]) source

Sets the first control point on this CubicBezierCurve.

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]

Return:

Number[]

The second control point.

public set v3(value: Number[]) source

Sets the end point on this CubicBezierCurve.

Fires a CubicBezierCurve#v3:event event on change.

Default value is [0.0, 0.0, 0.0]

public get v3: Number[]: * source

Gets the end point on this CubicBezierCurve.

Fires a CubicBezierCurve#v3:event event on change.

Default value is [0.0, 0.0, 0.0]

Return:

Number[]

The end point.

Public Methods

public getJSON(): {"v0": *, "v1": *, "v2": *, "v3": *, "t": *} source

Return:

{"v0": *, "v1": *, "v2": *, "v3": *, "t": *}

public getPoint(t: Number): * source

Returns point on this CubicBezierCurve at the given position.

Params:

NameTypeAttributeDescription
t Number

Position to get point at.

Return:

*

The point at the given position.