UNPKG

1.15 kBTypeScriptView Raw
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @format
8 */
9
10/**
11 * This class implements common easing functions. The math is pretty obscure,
12 * but this cool website has nice visual illustrations of what they represent:
13 * http://xaedes.de/dev/transitions/
14 */
15export type EasingFunction = (value: number) => number;
16export interface EasingStatic {
17 step0: EasingFunction;
18 step1: EasingFunction;
19 linear: EasingFunction;
20 ease: EasingFunction;
21 quad: EasingFunction;
22 cubic: EasingFunction;
23 poly(n: number): EasingFunction;
24 sin: EasingFunction;
25 circle: EasingFunction;
26 exp: EasingFunction;
27 elastic(bounciness: number): EasingFunction;
28 back(s: number): EasingFunction;
29 bounce: EasingFunction;
30 bezier(x1: number, y1: number, x2: number, y2: number): EasingFunction;
31 in(easing: EasingFunction): EasingFunction;
32 out(easing: EasingFunction): EasingFunction;
33 inOut(easing: EasingFunction): EasingFunction;
34}
35
36export type Easing = EasingStatic;
37export const Easing: EasingStatic;