Curve

Curve

Creates curves.

Constructor

new Curve($easingopt)

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 Attributes Description
$easing TypeHandlerCurve <optional>
The easing function to use.

Methods

getProgress($previous, $current) → {number}

Description:
  • Gets the progress between the 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

getValues($samplesopt) → {Array.<number>}

Description:
  • Gets values according to the given number of samples (in [0, 1] range).
Source:
Parameters:
Name Type Attributes Default Description
$samples number <optional>
2 The number of samples (must be greater than or equal to 2).
Returns:
Type
Array.<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