Constructor
new Curve($easing)
- Description:
- Creates a new curve.
- Source:
Examples
// without chaining
const curve = new Curve(curve);
curve.setDuration(800);
const progress = curve.getProgress(previous, current);
// with chaining
const progress = new Curve(curve).setDuration(800).getProgress(previous, current);
Parameters:
| Name | Type | Description |
|---|---|---|
$easing |
TypeHandlerCurve | The easing function to use. |
Methods
getProgress($previous, $current) → {number}
- Description:
- Gets the progress between two given time cursors.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
$previous |
number | The previous time cursor (in [0, 1] range). |
$current |
number | The current time cursor (in [0, 1] range). |
Returns:
- Type
- number
setDuration($duration) → {this}
- Description:
- Sets the duration.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
$duration |
number | The duration to set. |
Returns:
- Type
- this
Type Definitions
(protected) TypeHandlerCurve($x) → {number}
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
$x |
number | The value to transform (in [0, 1] range). |
Returns:
- Type
- number