UNPKG

1.99 kBTypeScriptView Raw
1import type { EasingFunctionFactory } from '../Easing';
2import type { Animation, AnimationCallback, Timestamp, AnimatableValue, ReduceMotion, EasingFunction } from '../commonTypes';
3/**
4 * The timing animation configuration.
5 *
6 * @param duration - Length of the animation (in milliseconds). Defaults to 300.
7 * @param easing - An easing function which defines the animation curve.
8 * Defaults to `Easing.inOut(Easing.quad)`.
9 * @param reduceMotion - Determines how the animation responds to the device's
10 * reduced motion accessibility setting. Default to `ReduceMotion.System` -
11 * {@link ReduceMotion}.
12 * @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withTiming#config-
13 */
14interface TimingConfig {
15 duration?: number;
16 reduceMotion?: ReduceMotion;
17 easing?: EasingFunction | EasingFunctionFactory;
18}
19export type WithTimingConfig = TimingConfig;
20export interface TimingAnimation extends Animation<TimingAnimation> {
21 type: string;
22 easing: EasingFunction;
23 startValue: AnimatableValue;
24 startTime: Timestamp;
25 progress: number;
26 toValue: AnimatableValue;
27 current: AnimatableValue;
28}
29type withTimingType = <T extends AnimatableValue>(toValue: T, userConfig?: TimingConfig, callback?: AnimationCallback) => T;
30/**
31 * Lets you create an animation based on duration and easing.
32 *
33 * @param toValue - The value on which the animation will come at rest -
34 * {@link AnimatableValue}.
35 * @param config - The timing animation configuration - {@link TimingConfig}.
36 * @param callback - A function called on animation complete -
37 * {@link AnimationCallback}.
38 * @returns An [animation
39 * object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object)
40 * which holds the current state of the animation.
41 * @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withTiming
42 */
43export declare const withTiming: withTimingType;
44export {};
45//# sourceMappingURL=timing.d.ts.map
\No newline at end of file