diff --git a/src/utils/animationVariants.ts b/src/utils/animationVariants.ts new file mode 100644 index 0000000..ce38e17 --- /dev/null +++ b/src/utils/animationVariants.ts @@ -0,0 +1,18 @@ +export const variants = (x = 1000, opacity = 0) => ({ + enter: (direction: number) => { + return { + x: direction > 0 ? x : -x, + opacity, + }; + }, + center: { + x: 0, + opacity: 1, + }, + exit: (direction: number) => { + return { + x: direction < 0 ? x : -x, + opacity, + }; + }, +});