
Mirror Engine API / CurveSet
Class: CurveSet
A curve set is a collection of curves.
Constructors
new CurveSet()
new CurveSet(...args: any): CurveSet
Creates a new CurveSet instance.
Parameters
args
...any
Returns
Example
const curveSet = new 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
]
])
length
Get Signature
get length(): number
Gets the number of curves in the curve set.
Returns
number
type
Get Signature
get type(): number
Gets the interpolation scheme applied to all curves in the curve set.
Returns
number
Set Signature
set type(value: number): void
Sets the interpolation scheme applied to all curves in the curve set. Can be:
Defaults to CURVE_SMOOTHSTEP.
Parameters
value
number
Returns
void
Methods
clone()
clone(): CurveSet
Returns a clone of the specified curve set object.
Returns
A clone of the specified curve set.
get()
get(index: number): Curve
Return a specific curve in the curve set.
Parameters
index
number
The index of the curve to return.
Returns
The curve at the specified index.
value()
value(time: number, result?: number[]): number[]
Returns the interpolated value of all curves in the curve set at the specified time.
Parameters
time
number
The time at which to calculate the value.
result?
number
[] = []
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.