Files
imen_pishghaman/app/utils/motion.ts
T

14 lines
550 B
TypeScript
Raw Normal View History

export const EASE: [number, number, number, number] = [0.22, 1, 0.36, 1];
/** Convert latin digits to Persian digits */
export const faNum = (v: number | string): string =>
String(v).replace(/\d/g, (d) => "۰۱۲۳۴۵۶۷۸۹"[Number(d)]!);
/** While-in-view fade-up props for motion elements (spread with v-bind) */
export const fade = (delay = 0, y = 36) => ({
initial: { opacity: 0, y },
whileInView: { opacity: 1, y: 0 },
inViewOptions: { once: true, margin: "-60px" as const },
transition: { duration: 0.8, delay, ease: EASE },
});