-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmotion.ts
More file actions
53 lines (46 loc) · 1.7 KB
/
Copy pathmotion.ts
File metadata and controls
53 lines (46 loc) · 1.7 KB
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
import type { Transition, Variants } from "motion/react";
/**
* Motion tokens — the single place animation timing/easing is defined.
* Components must import these presets instead of writing inline variants;
* no animation duration or easing may be hardcoded elsewhere.
*
* All presets animate only opacity/transform (compositor-friendly, no layout
* shift). `prefers-reduced-motion` is honored globally via
* `<MotionConfig reducedMotion="user">` in components/providers.tsx, which
* disables the transform portion of these presets for users who opt out.
*/
/** Standard easing/duration for entrances. */
export const transitionBase: Transition = {
duration: 0.5,
ease: [0.21, 0.47, 0.32, 0.98],
};
/** Fast easing for micro-interactions (hover, press). */
export const transitionFast: Transition = {
duration: 0.2,
ease: "easeOut",
};
/** Element rises 16px and fades in. Pair with `initial="hidden" animate="visible"`. */
export const fadeUp: Variants = {
hidden: { opacity: 0, y: 16 },
visible: { opacity: 1, y: 0, transition: transitionBase },
};
/** Opacity-only entrance for surfaces where movement would distract. */
export const fadeIn: Variants = {
hidden: { opacity: 0 },
visible: { opacity: 1, transition: { duration: 0.4, ease: "easeOut" } },
};
/**
* Parent container that reveals `fadeUp`/`fadeIn` children one after another.
* Apply to the wrapper; children carry their own variants.
*/
export const staggerChildren: Variants = {
hidden: {},
visible: {
transition: { staggerChildren: 0.08, delayChildren: 0.1 },
},
};
/** Subtle scale for interactive cards/buttons — use with `whileHover`. */
export const subtleHover = {
scale: 1.02,
transition: transitionFast,
} as const;