14 lines
550 B
TypeScript
14 lines
550 B
TypeScript
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 },
|
||
|
|
});
|