API Reference

Class List

CurveSet

A curve set is a collection of curves.

var curveSet = new pc.CurveSet([
    [
        0, 0,        // At 0 time, value of 0
        0.33, 2,     // At 0.33 time, value of 2
        0.66, 2.6,   // At 0.66 time, value of 2.6
        1, 3         // At 1 time, value of 3
    ],
    [
        0, 34,
        0.33, 35,
        0.66, 36,
        1, 37
    ]
]);

Summary

Properties

length

The number of curves in the curve set.

type

The interpolation scheme applied to all curves in the curve set.

Methods

clone

Returns a clone of the specified curve set object.

get

Return a specific curve in the curve set.

value

Returns the interpolated value of all curves in the curve set at the specified time.

Details

Constructor

CurveSet(curveKeys)

Creates a new CurveSet instance.

var curveSet = new pc.CurveSet([
    [
        0, 0,        // At 0 time, value of 0
        0.33, 2,     // At 0.33 time, value of 2
        0.66, 2.6,   // At 0.66 time, value of 2.6
        1, 3         // At 1 time, value of 3
    ],
    [
        0, 34,
        0.33, 35,
        0.66, 36,
        1, 37
    ]
]);

Parameters

curveKeysnumber[][]

An array of arrays of keys (pairs of numbers with the time first and value second).

Properties

numberlength

The number of curves in the curve set.

numbertype

The interpolation scheme applied to all curves in the curve set. Can be:

Defaults to CURVE_SMOOTHSTEP.

Methods

clone()

Returns a clone of the specified curve set object.

Returns

this

A clone of the specified curve set.

get(index)

Return a specific curve in the curve set.

Parameters

indexnumber

The index of the curve to return.

Returns

Curve

The curve at the specified index.

value(time, [result])

Returns the interpolated value of all curves in the curve set at the specified time.

Parameters

timenumber

The time at which to calculate the value.

resultnumber[]

The interpolated curve values at the specified time. If this parameter is not supplied, the function allocates a new array internally to return the result.

Returns

number[]

The interpolated curve values at the specified time.