-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathanimations-config.ts
40 lines (34 loc) · 1.52 KB
/
animations-config.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
import { Static, Type } from '@sinclair/typebox';
export const CSSAnimationOptionsSchema = Type.Object({
delay: Type.Optional(Type.Number()),
direction: Type.Optional(Type.String()),
duration: Type.Optional(Type.Number()),
easing: Type.Optional(Type.String()),
endDelay: Type.Optional(Type.Number()),
fill: Type.Optional(Type.String()),
iterationStart: Type.Optional(Type.Number()),
iterations: Type.Optional(Type.Number()),
keyframes: Type.Optional(Type.Any()),
});
export type CSSAnimationOptions = Static<typeof CSSAnimationOptionsSchema>;
export const CSSAnimationKeyframesSchema = Type.Array(Type.Any());
export type CSSAnimationKeyframes = Static<typeof CSSAnimationKeyframesSchema>;
export const NarratAnimationInputSchema = Type.Object({
keyframes: Type.Union([Type.String(), CSSAnimationKeyframesSchema]),
options: Type.Optional(CSSAnimationOptionsSchema),
});
export type NarratAnimationInput = Static<typeof NarratAnimationInputSchema>;
export const NarratAnimationSchema = Type.Object({
keyframes: CSSAnimationKeyframesSchema,
options: Type.Optional(CSSAnimationOptionsSchema),
});
export type NarratAnimation = Static<typeof NarratAnimationSchema>;
export const AnimationsConfigSchema = Type.Object({
animations: Type.Record(Type.String(), NarratAnimationInputSchema),
keyframes: Type.Record(Type.String(), CSSAnimationKeyframesSchema),
});
export type AnimationsConfig = Static<typeof AnimationsConfigSchema>;
export const defaultAnimationsConfig: AnimationsConfig = {
animations: {},
keyframes: {},
};