animations file
All checks were successful
/ image_build (push) Successful in 1m50s

This commit is contained in:
tymur999
2026-03-17 14:01:41 -04:00
parent e61d3525a0
commit cbb6b997e2
6 changed files with 51 additions and 28 deletions

27
src/animations.ts Normal file
View File

@@ -0,0 +1,27 @@
import {Target} from "motion";
export type AnimateTemplate = {
initial: Target,
animate: Target,
};
export function AnimateDirection(dir: "top" | "left" | "right" | "bottom", top: string | number = 0) : AnimateTemplate {
const animation: Required<AnimateTemplate> = { animate: {}, initial: {} };
animation.animate[dir] = top;
animation.initial[dir] = "-100%";
return animation;
}
export function AnimateFade() : AnimateTemplate {
return {
initial: { opacity: 0 },
animate: { opacity: 1 },
};
}
export function AnimateSpin() : Pick<AnimateTemplate, "animate"> {
return {
animate : { rotate: 360 },
};
}