Files
portfolio/components/reveal.tsx

60 lines
1.1 KiB
TypeScript

"use client";
import { motion } from "framer-motion";
export function Reveal({
children,
delay = 0,
}: {
children: React.ReactNode;
delay?: number;
}) {
return (
<motion.div
initial={{ opacity: 0, y: 14 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, amount: 0.25 }}
transition={{ duration: 0.45, ease: "easeOut", delay }}
>
{children}
</motion.div>
);
}
export function Stagger({
children,
}: {
children: React.ReactNode;
}) {
return (
<motion.div
initial="hidden"
whileInView="show"
viewport={{ once: true, amount: 0.2 }}
variants={{
hidden: {},
show: { transition: { staggerChildren: 0.06 } },
}}
>
{children}
</motion.div>
);
}
export function StaggerItem({ children }: { children: React.ReactNode }) {
return (
<motion.div
variants={{
hidden: { opacity: 0, y: 14 },
show: {
opacity: 1,
y: 0,
transition: { duration: 0.42, ease: "easeOut" },
},
}}
>
{children}
</motion.div>
);
}