Reference Source
public class | source

SplineCurve

Extends:

ComponentCurve → SplineCurve

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

Constructor Summary

Public Constructor
public

constructor(owner: Component, cfg: *)

Member Summary

Public Members
public get

point: Number[]: *

Gets the point on this SplineCurve at position SplineCurve#t.

public set

points(value: Number[])

Sets the control points on this SplineCurve.

public get

points: Number[]: *

Gets the control points on this SplineCurve.

public set

t(value: Number)

Sets the progress along this SplineCurve.

public get

t: Number: *

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

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

scheduleTask(task: *)

Schedule a task to perform on the next browser interval

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: Number[]: *

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 SplineCurve as well.

cfg *
  • optional

Configs

cfg.id String
  • optional

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

cfg.points Array
  • optional
  • default: []

Control points on this SplineCurve.

cfg.t Number
  • optional
  • default: 0

Current position on this SplineCurve, in range between 0..1.

cfg.t Number
  • optional
  • default: 0

Current position on this CubicBezierCurve, in range between 0..1.

Public Members

public get point: Number[]: * source

Gets the point on this SplineCurve at position SplineCurve#t.

Return:

Number[]

The point at SplineCurve#t.

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 [].

Return:

Number[]

The control points.

public set t(value: Number) source

Sets the progress along this SplineCurve.

Automatically clamps to range [0..1].

Default value is 0.

Override:

Curve#t

public get t: Number: * source

Gets the progress along this SplineCurve.

Automatically clamps to range [0..1].

Default value is 0.

Override:

Curve#t

Return:

Number

The new progress.

Public Methods

public getJSON(): {"points": *, "t": *} source

Return:

{"points": *, "t": *}

public getPoint(t: Number): Number[] source

Returns point on this SplineCurve at the given position.

Params:

NameTypeAttributeDescription
t Number

Position to get point at.

Return:

Number[]

Point at the given position.