1import bezier from "bezier-easing";
2import { Curve } from "../ref/curves";
3
4/**
5 * Formats our Curve data structure into a bezier easing function.
6 * @param {Curve} curve - The curve to format.
7 * @param {Boolean} inverted - Whether or not to invert the curve.
8 * @returns {EasingFunction} The formatted easing function.
9 */
10export function curve(curve: Curve, inverted?: Boolean) {
11 if (inverted) {
12 return bezier(
13 curve.value[3],
14 curve.value[2],
15 curve.value[1],
16 curve.value[0]
17 );
18 }
19
20 return bezier(curve.value[0], curve.value[1], curve.value[2], curve.value[3]);
21}