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.
Parameters
Default value threshold: number = 1
Default value resolution: number = 1000
Returns number[]
oscillation
oscillation(t: number): number
Parameters
t: number
Returns number
serialize
serialize(): { bounces: number; stiffness: 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.