API Reference

Class List

pc.Curve

A curve is a collection of keys (time/value pairs). The shape of the curve is defined by its type that specifies an interpolation scheme for the keys.

Summary

Properties

lengthThe number of keys in the curve.

Methods

addAdd a new key to the curve.
cloneReturns a clone of the specified curve object.
getReturn a specific key.
sortSort keys by time.
valueReturns the interpolated value of the curve at specified time.

Details

Constructor

Curve([data])

Creates a new curve.

Parameters

dataNumber[]An array of keys (pairs of numbers with the time first and value second)

Properties

Numberlength

The number of keys in the curve. [read only]

Methods

add(time, value)

Add a new key to the curve.

Parameters

timeNumberTime to add new key
valueNumberValue of new key

Returns

Number[] [time, value] pair

clone()

Returns a clone of the specified curve object.

Returns

pc.Curve A clone of the specified curve

get(index)

Return a specific key.

Parameters

indexNumberThe index of the key to return

Returns

Number[] The key at the specified index

sort()

Sort keys by time.

value(time)

Returns the interpolated value of the curve at specified time.

Parameters

timeNumberThe time at which to calculate the value

Returns

Number The interpolated value