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
| length | The number of keys in the curve. |
| type | The curve interpolation scheme. |
Methods
| add | Add a new key to the curve. |
| clone | Returns a clone of the specified curve object. |
| get | Return a specific key. |
| sort | Sort keys by time. |
| value | Returns the interpolated value of the curve at specified time. |
Details
Constructor
Curve([data])
Creates a new curve.
Parameters
| data | number[] | An array of keys (pairs of numbers with the time first and value second). |
Properties
Methods
add(time, value)
Add a new key to the curve.
Parameters
| time | number | Time to add new key. |
| value | number | Value of new key. |
Returns
number[][time, value] pair.
clone()
Returns a clone of the specified curve object.
Returns
pc.CurveA clone of the specified curve.
get(index)
Return a specific key.
Parameters
| index | number | The index of the key to return. |
Returns
number[]The key at the specified index.
sort()
Sort keys by time.