Files
Evandro Fonseca Junior 08dd046887 feat: add animated components for enhanced UI/UX
- Introduced DrawLine component for drawing animations.
- Added LazyRevealImage component for lazy loading images with reveal animations.
- Implemented TextDiffuseReveal for animated text reveals with staggered effects.
- Created TopProgressBar for a dynamic loading indicator.
- Added PointCloud mock for testing animations.
- Developed useReducedMotion hook to handle user preferences for reduced motion.
- Centralized animation configurations in config.ts for easier management.
- Defined animation variants in variants.ts for consistent animation effects.
- Established AnimationProvider to supply global animation settings.
- Created tests for AnimationProvider and useReducedMotion hook.
- Added SVG assets for branding and UI elements.
- Documented frontend review plan and hero circuit board animation plan.
2026-03-15 21:06:43 -03:00

69 lines
1.5 KiB
TypeScript

"use client";
import type { ReactNode } from "react";
import { useState } from "react";
import { motion, useReducedMotion } from "framer-motion";
interface RevealProps {
children: ReactNode;
y?: number;
duration?: number;
delay?: number;
ease?: string;
start?: string;
end?: string;
scrub?: boolean | number;
className?: string;
}
export function Reveal({
children,
y = 36,
duration = 0.8,
delay = 0,
className = "",
}: RevealProps) {
const shouldReduceMotion = useReducedMotion();
const [animating, setAnimating] = useState(!shouldReduceMotion);
return (
<motion.div
className={className}
initial={
shouldReduceMotion
? { opacity: 0 }
: { opacity: 0, y, clipPath: "inset(100% 0 0 0)" }
}
whileInView={
shouldReduceMotion
? { opacity: 1 }
: { opacity: 1, y: 0, clipPath: "inset(0% 0 0 0)" }
}
viewport={{ once: true, amount: 0.2 }}
transition={
shouldReduceMotion
? { duration: 0.25 }
: {
duration,
delay,
ease: [0.16, 1, 0.3, 1],
}
}
style={{
willChange:
animating && !shouldReduceMotion
? "transform, opacity, clip-path"
: undefined,
}}
onAnimationStart={() => {
if (!shouldReduceMotion) {
setAnimating(true);
}
}}
onAnimationComplete={() => setAnimating(false)}
>
{children}
</motion.div>
);
}