react-ui-animate 3.0.0-rc.1 → 3.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -30
- package/dist/animation/core/controllers/FluidValue.d.ts +1 -1
- package/dist/animation/core/helpers/isDefined.d.ts +1 -1
- package/dist/animation/core/helpers/isFluidValue.d.ts +8 -4
- package/dist/animation/core/index.d.ts +1 -1
- package/dist/animation/core/react/useFluidValue.d.ts +2 -2
- package/dist/animation/core/react/useMount.d.ts +3 -3
- package/dist/animation/lib/animationType.d.ts +14 -13
- package/dist/animation/lib/getInitialConfig.d.ts +2 -1
- package/dist/animation/lib/index.d.ts +1 -0
- package/dist/animation/lib/interpolation.d.ts +21 -15
- package/dist/animation/lib/modules/MountedBlock.d.ts +3 -2
- package/dist/animation/lib/modules/ScrollableBlock.d.ts +2 -3
- package/dist/animation/lib/modules/TransitionBlock.d.ts +2 -3
- package/dist/animation/lib/useAnimatedValue.d.ts +7 -2
- package/dist/animation/lib/withFunctions.d.ts +63 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,114 +2,152 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/react-ui-animate)
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
> Create smooth animations and interactive gestures in React applications effortlessly.
|
|
6
6
|
|
|
7
7
|
### Install
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
You can install react-ui-animate via npm or yarn:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
12
|
npm i react-ui-animate
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
or
|
|
16
|
-
Install with yarn:
|
|
17
|
-
|
|
18
15
|
```sh
|
|
19
16
|
yarn add react-ui-animate
|
|
20
17
|
```
|
|
21
18
|
|
|
22
19
|
### Getting Started
|
|
23
20
|
|
|
24
|
-
`react-ui-animate` provides
|
|
21
|
+
The `react-ui-animate` library provides a straightforward way to add animations and gestures to your React components. Here’s how you can get started quickly:
|
|
25
22
|
|
|
26
23
|
```javascript
|
|
27
|
-
import { AnimatedBlock, useAnimatedValue } from
|
|
24
|
+
import { AnimatedBlock, useAnimatedValue } from 'react-ui-animate';
|
|
28
25
|
|
|
29
26
|
export default function () {
|
|
30
|
-
|
|
27
|
+
// Initialize an animated opacity value
|
|
28
|
+
const opacity = useAnimatedValue(0);
|
|
31
29
|
|
|
32
30
|
return (
|
|
33
31
|
<div>
|
|
34
|
-
{/* AnimatedBlock component
|
|
32
|
+
{/* AnimatedBlock component uses the animated opacity value */}
|
|
35
33
|
<AnimatedBlock
|
|
36
34
|
style={{
|
|
37
35
|
opacity: opacity.value, // using opacity with value property
|
|
38
36
|
width: 100,
|
|
39
37
|
padding: 20,
|
|
40
|
-
background:
|
|
38
|
+
background: '#39F',
|
|
41
39
|
}}
|
|
42
40
|
>
|
|
43
41
|
ANIMATED
|
|
44
42
|
</AnimatedBlock>
|
|
45
43
|
|
|
46
|
-
{/*
|
|
44
|
+
{/* Clicking the button changes the opacity smoothly to 1 */}
|
|
47
45
|
<button onClick={() => (opacity.value = 1)}>Animate Me</button>
|
|
48
46
|
</div>
|
|
49
47
|
);
|
|
50
48
|
}
|
|
51
49
|
```
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
In this example, clicking the "Animate Me" button smoothly changes the opacity of the animated block from 0 to 1.
|
|
52
|
+
|
|
53
|
+
### Key Features
|
|
54
54
|
|
|
55
55
|
#### `useAnimatedValue()`
|
|
56
56
|
|
|
57
|
-
`useAnimatedValue()`
|
|
57
|
+
The `useAnimatedValue()` hook is central to creating animations. It initializes an animated value and allows you to seamlessly update it to create dynamic effects.
|
|
58
58
|
|
|
59
59
|
```javascript
|
|
60
|
-
const opacity = useAnimatedValue(0); //
|
|
60
|
+
const opacity = useAnimatedValue(0); // Start with opacity set to 0
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
// Use in style
|
|
63
63
|
style={{
|
|
64
|
-
|
|
64
|
+
opacity: opacity.value, // Access the animated opacity value
|
|
65
65
|
}}
|
|
66
|
-
...
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
onClick={() => opacity.value = 1} //
|
|
70
|
-
...
|
|
67
|
+
// Update the value on user interaction
|
|
68
|
+
onClick={() => (opacity.value = 1)} // Changes the opacity to 1
|
|
71
69
|
```
|
|
72
70
|
|
|
73
71
|
#### `AnimatedBlock`
|
|
74
72
|
|
|
75
|
-
`AnimatedBlock` is a
|
|
73
|
+
`AnimatedBlock` is a special component designed to work with `useAnimatedValue()`. It simplifies animating elements by directly using animated values.
|
|
76
74
|
|
|
77
75
|
```javascript
|
|
78
|
-
const width = useAnimatedValue(100);
|
|
76
|
+
const width = useAnimatedValue(100); // Start with a width of 100
|
|
79
77
|
|
|
80
78
|
<AnimatedBlock
|
|
81
79
|
style={{
|
|
82
80
|
width: width.value,
|
|
83
81
|
height: 100,
|
|
84
|
-
backgroundColor:
|
|
82
|
+
backgroundColor: '#39f',
|
|
85
83
|
}}
|
|
86
84
|
/>;
|
|
87
85
|
```
|
|
88
86
|
|
|
89
87
|
#### `interpolate`
|
|
90
88
|
|
|
91
|
-
The `interpolate()` function
|
|
89
|
+
The `interpolate()` function is useful for mapping values from one range to another, enabling more complex animations.
|
|
92
90
|
|
|
93
91
|
```javascript
|
|
94
|
-
import { useAnimatedValue, AnimatedBlock, interpolate } from
|
|
92
|
+
import { useAnimatedValue, AnimatedBlock, interpolate } from 'react-ui-animate';
|
|
95
93
|
|
|
96
|
-
const width = useAnimatedValue(100);
|
|
94
|
+
const width = useAnimatedValue(100); // Start with a width of 100
|
|
97
95
|
|
|
98
96
|
<AnimatedBlock
|
|
99
97
|
style={{
|
|
100
98
|
width: width.value,
|
|
101
99
|
height: 100,
|
|
102
|
-
backgroundColor: interpolate(width.value, [100, 200], [
|
|
100
|
+
backgroundColor: interpolate(width.value, [100, 200], ['red', 'blue']),
|
|
103
101
|
}}
|
|
104
102
|
/>;
|
|
105
103
|
```
|
|
106
104
|
|
|
107
|
-
|
|
105
|
+
In this example, as the width changes from 100 to 200, the background color smoothly transitions from red to blue.
|
|
106
|
+
|
|
107
|
+
### Gestures
|
|
108
|
+
|
|
109
|
+
The `react-ui-animate` library also provides several hooks for handling different types of gestures:
|
|
110
|
+
|
|
111
|
+
1. `useDrag`: Handles drag gestures on elements.
|
|
112
|
+
2. `useMouseMove`: Handles mouse movements.
|
|
113
|
+
3. `useScroll`: Handles scrolling of the document.
|
|
114
|
+
4. `useWheel`: Handles wheel rotation gestures.
|
|
115
|
+
5. `useGesture`: Handles combinations of various gestures.
|
|
116
|
+
|
|
117
|
+
**Example**: `useDrag`
|
|
118
|
+
|
|
119
|
+
Here’s an example of using the useDrag hook to enable drag gestures:
|
|
120
|
+
|
|
121
|
+
```jsx
|
|
122
|
+
import { useAnimatedValue, AnimatedBlock, useDrag } from 'react-ui-animate';
|
|
123
|
+
|
|
124
|
+
export const Draggable = () => {
|
|
125
|
+
const translateX = useAnimatedValue(0);
|
|
126
|
+
|
|
127
|
+
const bind = useDrag(function ({ down, movementX }) {
|
|
128
|
+
translateX.value = down ? movementX : 0;
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<AnimatedBlock
|
|
133
|
+
{...bind()}
|
|
134
|
+
style={{
|
|
135
|
+
width: 100,
|
|
136
|
+
height: 100,
|
|
137
|
+
backgroundColor: '#3399ff',
|
|
138
|
+
translateX: translateX.value, // Use translateX with animated value
|
|
139
|
+
}}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
In this example, the blue block can be dragged horizontally by clicking and dragging.
|
|
108
146
|
|
|
109
147
|
## Documentation
|
|
110
148
|
|
|
111
|
-
|
|
149
|
+
For detailed documentation and examples, visit the official [react-ui-animate documentation](http://react-ui-animate.js.org/).
|
|
112
150
|
|
|
113
151
|
## License
|
|
114
152
|
|
|
115
|
-
MIT
|
|
153
|
+
This library is licensed under the MIT License.
|
|
@@ -28,5 +28,5 @@ export declare class FluidValue {
|
|
|
28
28
|
* @param config - Optional configuration for the animation.
|
|
29
29
|
* @param callback - Optional callback to be called after the animation ends.
|
|
30
30
|
*/
|
|
31
|
-
setValue(updatedValue: AssignValue,
|
|
31
|
+
setValue(updatedValue: AssignValue, callback?: Fn<ResultType, void>): void;
|
|
32
32
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { FluidValue } from '../controllers/FluidValue';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Checks if the given value is of type FluidValue.
|
|
4
|
+
* A value is considered a FluidValue if it is defined,
|
|
5
|
+
* an object, and contains the '_subscribe' property.
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to check.
|
|
8
|
+
* @returns - True if the value is a FluidValue, false otherwise.
|
|
5
9
|
*/
|
|
6
|
-
export declare const isFluidValue: (value:
|
|
10
|
+
export declare const isFluidValue: (value: unknown) => value is FluidValue;
|
|
@@ -6,6 +6,6 @@ export { isFluidValue } from './helpers/isFluidValue';
|
|
|
6
6
|
export { Easing } from './easing/Easing';
|
|
7
7
|
export { interpolate } from './interpolation/Interpolation';
|
|
8
8
|
export { FluidValue } from './controllers/FluidValue';
|
|
9
|
-
export type { FluidValueConfig } from './types/animation';
|
|
9
|
+
export type { FluidValueConfig, Length } from './types/animation';
|
|
10
10
|
export type { UseMountConfig } from './react/useMount';
|
|
11
11
|
export type { ExtrapolateConfig } from './interpolation/Interpolation';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FluidValue } from '../controllers/FluidValue';
|
|
2
|
-
import type { FluidValueConfig, Length,
|
|
2
|
+
import type { FluidValueConfig, Length, OnUpdateFn } from '../types/animation';
|
|
3
3
|
/**
|
|
4
4
|
* useFluidValue
|
|
5
5
|
*
|
|
6
6
|
* @param value - initial value
|
|
7
7
|
* @param config - the config object for `FluidValue`
|
|
8
8
|
*/
|
|
9
|
-
export declare const useFluidValue: (value: Length, config?: FluidValueConfig) => [FluidValue,
|
|
9
|
+
export declare const useFluidValue: (value: Length, config?: FluidValueConfig) => [FluidValue, OnUpdateFn];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FluidValue } from '../controllers/FluidValue';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FluidValueConfig } from '../types/animation';
|
|
3
3
|
export interface UseMountConfig {
|
|
4
4
|
from: number;
|
|
5
|
-
enter: number
|
|
6
|
-
exit: number
|
|
5
|
+
enter: number;
|
|
6
|
+
exit: number;
|
|
7
7
|
enterConfig?: FluidValueConfig;
|
|
8
8
|
exitConfig?: FluidValueConfig;
|
|
9
9
|
config?: FluidValueConfig;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { FluidValueConfig } from '../core';
|
|
1
2
|
export declare const AnimationConfigUtils: {
|
|
2
|
-
ELASTIC:
|
|
3
|
-
BOUNCE:
|
|
4
|
-
EASE:
|
|
5
|
-
STIFF:
|
|
6
|
-
WOOBLE:
|
|
7
|
-
EASE_IN:
|
|
8
|
-
EASE_OUT:
|
|
9
|
-
EASE_IN_OUT:
|
|
10
|
-
POWER1:
|
|
11
|
-
POWER2:
|
|
12
|
-
POWER3:
|
|
13
|
-
POWER4:
|
|
14
|
-
LINEAR:
|
|
3
|
+
ELASTIC: FluidValueConfig;
|
|
4
|
+
BOUNCE: FluidValueConfig;
|
|
5
|
+
EASE: FluidValueConfig;
|
|
6
|
+
STIFF: FluidValueConfig;
|
|
7
|
+
WOOBLE: FluidValueConfig;
|
|
8
|
+
EASE_IN: FluidValueConfig;
|
|
9
|
+
EASE_OUT: FluidValueConfig;
|
|
10
|
+
EASE_IN_OUT: FluidValueConfig;
|
|
11
|
+
POWER1: FluidValueConfig;
|
|
12
|
+
POWER2: FluidValueConfig;
|
|
13
|
+
POWER3: FluidValueConfig;
|
|
14
|
+
POWER4: FluidValueConfig;
|
|
15
|
+
LINEAR: FluidValueConfig;
|
|
15
16
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { FluidValueConfig } from '../core';
|
|
2
|
-
|
|
2
|
+
type InitialConfigType = 'linear' | 'easein' | 'easeout' | 'easeinout' | 'ease' | 'power1' | 'power2' | 'power3' | 'power4' | 'elastic' | 'stiff' | 'wooble' | 'bounce';
|
|
3
3
|
export declare const getInitialConfig: (animationType?: InitialConfigType) => FluidValueConfig;
|
|
4
|
+
export {};
|
|
@@ -3,3 +3,4 @@ export { AnimatedBlock, AnimatedImage, AnimatedInline, MountedBlock, ScrollableB
|
|
|
3
3
|
export { useAnimatedValue, UseAnimatedValueConfig } from './useAnimatedValue';
|
|
4
4
|
export { useMountedValue } from './useMountedValue';
|
|
5
5
|
export { AnimationConfigUtils } from './animationType';
|
|
6
|
+
export { withSpring, withTiming, withSequence, withDelay, } from './withFunctions';
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { ExtrapolateConfig, FluidValue } from '../core';
|
|
2
|
+
import { ValueType } from './useAnimatedValue';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @
|
|
4
|
+
* Maps the input range to the given output range using the specified extrapolation configuration.
|
|
5
|
+
* The function ensures that the value is either a number or a FluidValue.
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to be interpolated, which must be a number or FluidValue.
|
|
8
|
+
* @param inputRange - An array of numbers defining the input range.
|
|
9
|
+
* @param outputRange - An array of numbers or strings defining the output range.
|
|
10
|
+
* @param extrapolateConfig - The extrapolation configuration, which can be "clamp", "identity", or "extend".
|
|
11
|
+
* @returns - The interpolated value, which will be a number or FluidValue.
|
|
12
|
+
* @throws - Will throw an error if the value is not a number or FluidValue.
|
|
9
13
|
*/
|
|
10
|
-
export declare function interpolate(value:
|
|
14
|
+
export declare function interpolate(value: FluidValue | ValueType | number, inputRange: Array<number>, outputRange: Array<number | string>, extrapolateConfig?: ExtrapolateConfig): any;
|
|
11
15
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @
|
|
16
|
+
* A shorthand function for interpolate that maps the input range [0, 1] to the given [minOutput, maxOutput].
|
|
17
|
+
* The function ensures that the value is either a number or a FluidValue.
|
|
18
|
+
*
|
|
19
|
+
* @param value - The value to be interpolated, which must be a number or FluidValue.
|
|
20
|
+
* @param minOutput - The minimum value of the output range, which can be a number or string.
|
|
21
|
+
* @param maxOutput - The maximum value of the output range, which can be a number or string.
|
|
22
|
+
* @param extrapolateConfig - The extrapolation configuration, which can be "clamp", "identity", or "extend".
|
|
23
|
+
* @returns - The interpolated value, which will be a number or FluidValue.
|
|
24
|
+
* @throws - Will throw an error if the value is not a number or FluidValue.
|
|
19
25
|
*/
|
|
20
|
-
export declare function bInterpolate(value:
|
|
26
|
+
export declare function bInterpolate(value: FluidValue | ValueType | number, minOutput: number | string, maxOutput: number | string, extrapolateConfig?: ExtrapolateConfig): any;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { FluidValueConfig } from '../../core';
|
|
3
|
+
import { ValueType } from '../useAnimatedValue';
|
|
3
4
|
interface MountedValueConfig extends FluidValueConfig {
|
|
4
5
|
}
|
|
5
6
|
interface MountedBlockProps {
|
|
6
7
|
state: boolean;
|
|
7
8
|
children: (animation: {
|
|
8
|
-
value:
|
|
9
|
+
value: ValueType;
|
|
9
10
|
}) => React.ReactNode;
|
|
10
11
|
from?: number;
|
|
11
12
|
enter?: number;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { UseAnimatedValueConfig } from '../useAnimatedValue';
|
|
3
|
-
import { FluidValue } from '../../core';
|
|
2
|
+
import { UseAnimatedValueConfig, ValueType } from '../useAnimatedValue';
|
|
4
3
|
interface ScrollableBlockProps {
|
|
5
4
|
children?: (animation: {
|
|
6
|
-
value
|
|
5
|
+
value: ValueType;
|
|
7
6
|
}) => React.ReactNode;
|
|
8
7
|
direction?: 'single' | 'both';
|
|
9
8
|
threshold?: number;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { UseAnimatedValueConfig } from '../useAnimatedValue';
|
|
3
|
-
import { FluidValue } from '../../core';
|
|
2
|
+
import { UseAnimatedValueConfig, ValueType } from '../useAnimatedValue';
|
|
4
3
|
interface TransitionBlockProps {
|
|
5
4
|
state: boolean;
|
|
6
5
|
children: (animation: {
|
|
7
|
-
value
|
|
6
|
+
value: ValueType;
|
|
8
7
|
}) => React.ReactNode;
|
|
9
8
|
config?: UseAnimatedValueConfig;
|
|
10
9
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { FluidValueConfig
|
|
1
|
+
import { FluidValueConfig } from '../core';
|
|
2
2
|
type Length = number | string;
|
|
3
3
|
export interface UseAnimatedValueConfig extends FluidValueConfig {
|
|
4
4
|
}
|
|
5
|
+
type AssignValue = {
|
|
6
|
+
toValue: Length;
|
|
7
|
+
config?: UseAnimatedValueConfig;
|
|
8
|
+
};
|
|
9
|
+
export type ValueType = Length | AssignValue | ((update: (next: AssignValue) => Promise<any>) => void);
|
|
5
10
|
/**
|
|
6
11
|
* `useAnimatedValue` returns an animation value with `.value` and `.currentValue` property which is
|
|
7
12
|
* initialized when passed to argument (`initialValue`). The retured value persist until the lifetime of
|
|
@@ -11,7 +16,7 @@ export interface UseAnimatedValueConfig extends FluidValueConfig {
|
|
|
11
16
|
* @param { UseAnimatedValueConfig } config - Animation configuration object.
|
|
12
17
|
*/
|
|
13
18
|
export declare function useAnimatedValue(initialValue: Length, config?: UseAnimatedValueConfig): {
|
|
14
|
-
value:
|
|
19
|
+
value: ValueType;
|
|
15
20
|
currentValue: number | string;
|
|
16
21
|
};
|
|
17
22
|
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { FluidValueConfig, Length } from '../core';
|
|
2
|
+
interface WithSpringConfig extends Pick<FluidValueConfig, 'mass' | 'friction' | 'tension'> {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Creates a spring animation configuration.
|
|
6
|
+
* @param {Length} toValue - The target value of the animation.
|
|
7
|
+
* @param {WithSpringConfig} [config=AnimationConfigUtils.ELASTIC] - Optional spring configuration.
|
|
8
|
+
* @returns {{ toValue: Length; config: WithSpringConfig }}
|
|
9
|
+
*/
|
|
10
|
+
export declare const withSpring: (toValue: Length, config?: WithSpringConfig) => {
|
|
11
|
+
toValue: Length;
|
|
12
|
+
config: WithSpringConfig;
|
|
13
|
+
};
|
|
14
|
+
interface WithTimingConfig extends Pick<FluidValueConfig, 'duration' | 'easing'> {
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a timing animation configuration.
|
|
18
|
+
* @param {Length} toValue - The target value of the animation.
|
|
19
|
+
* @param {WithTimingConfig} [config={ duration: 250 }] - Optional timing configuration.
|
|
20
|
+
* @returns {{ toValue: Length; config: WithTimingConfig }}
|
|
21
|
+
*/
|
|
22
|
+
export declare const withTiming: (toValue: Length, config?: WithTimingConfig) => {
|
|
23
|
+
toValue: Length;
|
|
24
|
+
config: WithTimingConfig;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Creates a sequence of animations that run one after another.
|
|
28
|
+
* @param {Array<{ toValue: Length; config?: FluidValueConfig }>} configs - An array of animation configurations.
|
|
29
|
+
* @returns {Function} An async function that runs the animations in sequence.
|
|
30
|
+
*/
|
|
31
|
+
export declare const withSequence: ([...configs]: Array<{
|
|
32
|
+
toValue: Length;
|
|
33
|
+
config?: FluidValueConfig;
|
|
34
|
+
}>) => (next: (arg: {
|
|
35
|
+
toValue: Length;
|
|
36
|
+
config?: FluidValueConfig;
|
|
37
|
+
}) => void) => Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Adds a delay before the given animation.
|
|
40
|
+
* @param {number} delay - The delay in milliseconds.
|
|
41
|
+
* @param {{ toValue: Length; config?: FluidValueConfig }} animation - The animation configuration ( withTiming | withSpring )
|
|
42
|
+
* @returns {{ toValue: Length; config: FluidValueConfig }} The updated animation configuration with delay.
|
|
43
|
+
*/
|
|
44
|
+
export declare const withDelay: (delay: number, animation: {
|
|
45
|
+
toValue: Length;
|
|
46
|
+
config?: FluidValueConfig;
|
|
47
|
+
}) => {
|
|
48
|
+
config: {
|
|
49
|
+
delay: number;
|
|
50
|
+
mass?: number;
|
|
51
|
+
tension?: number;
|
|
52
|
+
friction?: number;
|
|
53
|
+
duration?: number;
|
|
54
|
+
easing?: import("../core/types/common").Fn<number, number>;
|
|
55
|
+
immediate?: boolean;
|
|
56
|
+
restDistance?: number;
|
|
57
|
+
onChange?: import("../core/types/common").Fn<number, void>;
|
|
58
|
+
onRest?: import("../core/types/common").Fn<import("../core/types/animation").ResultType, void>;
|
|
59
|
+
onStart?: import("../core/types/common").Fn<number, void>;
|
|
60
|
+
};
|
|
61
|
+
toValue: Length;
|
|
62
|
+
};
|
|
63
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { AnimatedBlock, AnimatedImage, AnimatedInline, AnimationConfigUtils, Mou
|
|
|
3
3
|
export { bInterpolate, interpolate } from './animation/lib';
|
|
4
4
|
export { useAnimatedValue, useMountedValue } from './animation/lib';
|
|
5
5
|
export { delay } from './utils';
|
|
6
|
+
export { withSpring, withTiming, withSequence, withDelay, } from './animation/lib';
|
|
6
7
|
export { useMeasure, useOutsideClick, useWindowDimension } from './hooks';
|
|
7
8
|
export { useDrag, useGesture, useMouseMove, useScroll, useWheel, } from './gestures/hooks';
|
|
8
9
|
export { bin, clamp, mix, rubberClamp, move, snapTo } from './gestures/helpers';
|