UNPKG

2.32 kBTypeScriptView Raw
1/**
2 * Extrapolation type.
3 *
4 * @param IDENTITY - Returns the provided value as is.
5 * @param CLAMP - Clamps the value to the edge of the output range.
6 * @param EXTEND - Predicts the values beyond the output range.
7 */
8export declare enum Extrapolation {
9 IDENTITY = "identity",
10 CLAMP = "clamp",
11 EXTEND = "extend"
12}
13/** Represents the possible values for extrapolation as a string. */
14type ExtrapolationAsString = 'identity' | 'clamp' | 'extend';
15/** Allows to specify extrapolation for left and right edge of the interpolation. */
16export interface ExtrapolationConfig {
17 extrapolateLeft?: Extrapolation | string;
18 extrapolateRight?: Extrapolation | string;
19}
20/** Configuration options for extrapolation. */
21export type ExtrapolationType = ExtrapolationConfig | Extrapolation | ExtrapolationAsString | undefined;
22/**
23 * Lets you map a value from one range to another using linear interpolation.
24 *
25 * @param value - A number from the `input` range that is going to be mapped to
26 * the `output` range.
27 * @param inputRange - An array of numbers specifying the input range of the
28 * interpolation.
29 * @param outputRange - An array of numbers specifying the output range of the
30 * interpolation.
31 * @param extrapolate - Determines what happens when the `value` goes beyond the
32 * `input` range. Defaults to `Extrapolation.EXTEND` -
33 * {@link ExtrapolationType}.
34 * @returns A mapped value within the output range.
35 * @see https://docs.swmansion.com/react-native-reanimated/docs/utilities/interpolate
36 */
37export declare function interpolate(x: number, inputRange: readonly number[], outputRange: readonly number[], type?: ExtrapolationType): number;
38/**
39 * Lets you limit a value within a specified range.
40 *
41 * @param value - A number that will be returned as long as the provided value
42 * is in range between `min` and `max`.
43 * @param min - A number which will be returned when provided `value` is lower
44 * than `min`.
45 * @param max - A number which will be returned when provided `value` is higher
46 * than `max`.
47 * @returns A number between min and max bounds.
48 * @see https://docs.swmansion.com/react-native-reanimated/docs/utilities/clamp/
49 */
50export declare function clamp(value: number, min: number, max: number): number;
51export {};
52//# sourceMappingURL=interpolation.d.ts.map
\No newline at end of file