Methods
calculate
- calculate(ratio: number): number
-
Parameters
Returns number
findOptimalKeyPoints
- findOptimalKeyPoints(threshold?: number, resolution?: number): number[]
-
Parameters
-
Default value threshold: number = 1
-
Default value resolution: number = 1000
Returns number[]
Find the optimal keypoints to approximate the easing curve with line segments. This is done in two steps:
Set keypoints at the start, end and turning points of the curve
For each pair of subsequent keypoints, compare the area between the curve and a straight line between these keypoints. If it is above a given threshold, insert a new keypoint in the middle of these two. This process is repeated until the area has been reduced below the threshold for all pairs of subsequent keypoints.