Interpolation methods
Methods
# static bezier(t, tMinopt, tMaxopt, value1opt, value2opt, bezierPointsopt) → {number}
Interpolates a value with a bezier curve.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
t |
number
|
The value to interpolate | ||
tMin |
number
|
<optional> |
0 | The minimum value of the initial range |
tMax |
number
|
<optional> |
1 | The maximum value of the initial range |
value1 |
number
|
<optional> |
0 | The minimum value of the interpolated result |
value2 |
number
|
<optional> |
1 | The maximum value of the interpolated result |
bezierPoints |
Array.<number>
|
<optional> |
[0.33,0.0,0.66,1.0] | an Array of 4 coordinates wihtin the [0.0, 1.0] range which describes the Bézier interpolation. The default mimics the native ease() function [ outTangentX, outTangentY, inTangentX, inTangentY ] |
the value.
number
# static exponential(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt) → {number}
Interpolates and extrapolates a value with an exponential function.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
t |
number
|
The value to interpolate | ||
tMin |
number
|
<optional> |
0 | The minimum value of the initial range |
tMax |
number
|
<optional> |
1 | The maximum value of the initial range |
value1 |
number
|
<optional> |
0 | The minimum value of the interpolated result |
value2 |
number
|
<optional> |
1 | The maximum value of the interpolated result |
rate |
number
|
<optional> |
1 | The raising speed in the range [0, inf]. |
the value.
number
# static gaussian(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt) → {number}
Interpolates a value with a gaussian function.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
t |
number
|
The value to interpolate | ||
tMin |
number
|
<optional> |
0 | The minimum value of the initial range |
tMax |
number
|
<optional> |
1 | The maximum value of the initial range |
value1 |
number
|
<optional> |
0 | The minimum value of the interpolated result |
value2 |
number
|
<optional> |
1 | The maximum value of the interpolated result |
rate |
number
|
<optional> |
0 | The raising speed in the range [-1.0, 1.0]. |
the value.
number
# static linear(value, minopt, maxopt, targetMinopt, targetMaxopt, extrapolateopt) → {Number}
Linear (extra/inter)polation
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
Number
|
The variable | ||
min |
Number
|
<optional> |
0 | The minimum input value |
max |
Number
|
<optional> |
1 | The maximum input value |
targetMin |
Number
|
<optional> |
0 | The minimum output value |
targetMax |
Number
|
<optional> |
1 | The maximum output value |
extrapolate |
Boolean
|
<optional> |
true | Whether to extrapolate outside the target. |
Number
# static logarithmic(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt) → {number}
Interpolates and extrapolates a value with a logarithmic function.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
t |
number
|
The value to interpolate | ||
tMin |
number
|
<optional> |
0 | The minimum value of the initial range |
tMax |
number
|
<optional> |
1 | The maximum value of the initial range |
value1 |
number
|
<optional> |
0 | The minimum value of the interpolated result |
value2 |
number
|
<optional> |
1 | The maximum value of the interpolated result |
rate |
number
|
<optional> |
1 | The raising speed in the range [0, inf]. |
the value.
number
# static logistic(t, tMinopt, tMaxopt, value1opt, value2opt, rateopt, tMidopt) → {number}
Interpolates and extrapolates a value with a logistic (sigmoid) function.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
t |
number
|
The value to interpolate | ||
tMin |
number
|
<optional> |
0 | The minimum value of the initial range |
tMax |
number
|
<optional> |
1 | The maximum value of the initial range |
value1 |
number
|
<optional> |
0 | The minimum value of the interpolated result |
value2 |
number
|
<optional> |
1 | The maximum value of the interpolated result |
rate |
number
|
<optional> |
1 | The raising speed in the range [0, inf]. |
tMid |
number
|
<optional> |
The t value at which the interpolated value should be half way. By default, (tMin+tMax)/2 |
the value
number