| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- "use client";
- import { motion } from "framer-motion";
- import { ReactNode } from "react";
- interface FadeInProps {
- children: ReactNode;
- delay?: number;
- className?: string;
- }
- export function FadeIn({ children, delay = 0, className = "" }: FadeInProps) {
- return (
- <motion.div
- initial={{ opacity: 0, y: 20 }}
- whileInView={{ opacity: 1, y: 0 }}
- viewport={{ once: true, margin: "-100px" }}
- transition={{ duration: 0.6, delay, ease: "easeOut" }}
- className={className}
- style={{ willChange: "opacity, transform" }}
- >
- {children}
- </motion.div>
- );
- }
- interface FadeInStaggerProps {
- children: ReactNode;
- className?: string;
- }
- export function FadeInStagger({ children, className = "" }: FadeInStaggerProps) {
- return (
- <motion.div
- initial="hidden"
- whileInView="visible"
- viewport={{ once: true, margin: "-100px" }}
- variants={{
- hidden: { opacity: 0 },
- visible: {
- opacity: 1,
- transition: {
- staggerChildren: 0.1,
- },
- },
- }}
- className={className}
- >
- {children}
- </motion.div>
- );
- }
- interface FadeInItemProps {
- children: ReactNode;
- className?: string;
- }
- export function FadeInItem({ children, className = "" }: FadeInItemProps) {
- return (
- <motion.div
- variants={{
- hidden: { opacity: 0, y: 20 },
- visible: { opacity: 1, y: 0 },
- }}
- transition={{ duration: 0.5, ease: "easeOut" }}
- className={className}
- style={{ willChange: "opacity, transform" }}
- >
- {children}
- </motion.div>
- );
- }
|