Files
blog/src/animations.ts
tymur999 cbb6b997e2
All checks were successful
/ image_build (push) Successful in 1m50s
animations file
2026-03-17 14:01:41 -04:00

27 lines
638 B
TypeScript

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 },
};
}