UNPKG

725 BTypeScriptView Raw
1/**
2 * Based on:
3 * https://stackoverflow.com/questions/7348009/y-coordinate-for-a-given-x-cubic-bezier
4 * https://math.stackexchange.com/questions/26846/is-there-an-explicit-form-for-cubic-b%C3%A9zier-curves
5 * TODO: Reduce rounding error
6 */
7/**
8 * EXPERIMENTAL
9 * Given a cubic-bezier curve, get the x value (time) given
10 * the y value (progression).
11 * Ex: cubic-bezier(0.32, 0.72, 0, 1);
12 * P0: (0, 0)
13 * P1: (0.32, 0.72)
14 * P2: (0, 1)
15 * P3: (1, 1)
16 *
17 * If you give a cubic bezier curve that never reaches the
18 * provided progression, this function will return an empty array.
19 */
20export declare const getTimeGivenProgression: (p0: number[], p1: number[], p2: number[], p3: number[], progression: number) => number[];