Creates a new Curve instance.
Optionaldata: number[]
An array of keys (pairs of numbers with the time first and value second).
The keys that define the curve. Each key is an array of two numbers with the time first and the value second.
Controls how CURVE_SPLINE tangents are calculated. Valid range is between 0 and 1 where 0 results in a non-smooth curve (equivalent to linear interpolation) and 1 results in a very smooth curve. Use 0.5 for a Catmull-Rom spline.
The curve interpolation scheme. Can be:
Defaults to CURVE_SMOOTHSTEP.
Returns the key closest to the specified time.
The time to find the closest key to.
The [time, value] pair closest to the specified time, or null if
no keys exist.
Sorts keys by time.
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.
Keys are kept sorted by time. Supply them to the constructor as a flat
[time, value, ...]array or insert them one at a time with add, then evaluate the curve at any time with value. The type selects how values between keys are computed: CURVE_LINEAR, CURVE_SMOOTHSTEP, CURVE_SPLINE or CURVE_STEP. Curves drive values that change over time or over a normalized range, such as particle size over a particle's lifetime.Example