-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
use-web-animations.d.ts
160 lines (146 loc) · 4.55 KB
/
use-web-animations.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
declare module "@wellyshen/use-web-animations" {
import type { RefObject } from "react";
export type Keyframes = Keyframe[] | PropertyIndexedKeyframes;
export type PlayState = AnimationPlayState | undefined;
type BaseOptions = Partial<{
id: string;
playbackRate: number;
autoPlay: boolean;
animationOptions:
| number
| (KeyframeAnimationOptions & { pseudoElement?: string });
}>;
export type AnimateOptions = BaseOptions & { keyframes: Keyframes };
export interface Animate {
(options: AnimateOptions): void;
}
export interface Event {
playState: PlayState;
animate: Animate;
animation: Animation;
}
export interface Callback {
(event: Event): void;
}
export interface Options<T> extends BaseOptions {
ref?: RefObject<T>;
keyframes?: Keyframes;
onReady?: Callback;
onUpdate?: Callback;
onFinish?: Callback;
}
export interface GetAnimation {
(): Animation | undefined;
}
export interface Return<T> {
ref: RefObject<T>;
playState: PlayState;
getAnimation: GetAnimation;
animate: Animate;
}
const useWebAnimations: <T extends HTMLElement | null = HTMLElement>(
options?: Options<T>
) => Return<T>;
export default useWebAnimations;
interface Anim {
keyframes: Keyframe[];
animationOptions: EffectTiming;
}
export const bounce: Anim;
export const flash: Anim;
export const pulse: Anim;
export const rubberBand: Anim;
export const shakeX: Anim;
export const shakeY: Anim;
export const headShake: Anim;
export const swing: Anim;
export const tada: Anim;
export const wobble: Anim;
export const jello: Anim;
export const heartBeat: Anim;
export const backInDown: Anim;
export const backInLeft: Anim;
export const backInRight: Anim;
export const backInUp: Anim;
export const backOutDown: Anim;
export const backOutLeft: Anim;
export const backOutRight: Anim;
export const backOutUp: Anim;
export const bounceIn: Anim;
export const bounceInDown: Anim;
export const bounceInLeft: Anim;
export const bounceInRight: Anim;
export const bounceInUp: Anim;
export const bounceOut: Anim;
export const bounceOutDown: Anim;
export const bounceOutLeft: Anim;
export const bounceOutRight: Anim;
export const bounceOutUp: Anim;
export const fadeIn: Anim;
export const fadeInDown: Anim;
export const fadeInDownBig: Anim;
export const fadeInLeft: Anim;
export const fadeInLeftBig: Anim;
export const fadeInRight: Anim;
export const fadeInRightBig: Anim;
export const fadeInUp: Anim;
export const fadeInUpBig: Anim;
export const fadeInTopLeft: Anim;
export const fadeInTopRight: Anim;
export const fadeInBottomLeft: Anim;
export const fadeInBottomRight: Anim;
export const fadeOut: Anim;
export const fadeOutDown: Anim;
export const fadeOutDownBig: Anim;
export const fadeOutLeft: Anim;
export const fadeOutLeftBig: Anim;
export const fadeOutRight: Anim;
export const fadeOutRightBig: Anim;
export const fadeOutUp: Anim;
export const fadeOutUpBig: Anim;
export const fadeOutTopLeft: Anim;
export const fadeOutTopRight: Anim;
export const fadeOutBottomLeft: Anim;
export const fadeOutBottomRight: Anim;
export const flip: Anim;
export const flipInX: Anim;
export const flipInY: Anim;
export const flipOutX: Anim;
export const flipOutY: Anim;
export const lightSpeedInRight: Anim;
export const lightSpeedInLeft: Anim;
export const lightSpeedOutRight: Anim;
export const lightSpeedOutLeft: Anim;
export const rotateIn: Anim;
export const rotateInDownLeft: Anim;
export const rotateInDownRight: Anim;
export const rotateInUpLeft: Anim;
export const rotateInUpRight: Anim;
export const rotateOut: Anim;
export const rotateOutDownLeft: Anim;
export const rotateOutDownRight: Anim;
export const rotateOutUpLeft: Anim;
export const rotateOutUpRight: Anim;
export const hinge: Anim;
export const jackInTheBox: Anim;
export const rollIn: Anim;
export const rollOut: Anim;
export const zoomIn: Anim;
export const zoomInDown: Anim;
export const zoomInLeft: Anim;
export const zoomInRight: Anim;
export const zoomInUp: Anim;
export const zoomOut: Anim;
export const zoomOutDown: Anim;
export const zoomOutLeft: Anim;
export const zoomOutRight: Anim;
export const zoomOutUp: Anim;
export const slideInDown: Anim;
export const slideInLeft: Anim;
export const slideInRight: Anim;
export const slideInUp: Anim;
export const slideOutDown: Anim;
export const slideOutLeft: Anim;
export const slideOutRight: Anim;
export const slideOutUp: Anim;
}