"use client"; import type { CSSProperties, PointerEvent } from "react"; import { useRef } from "react"; import { motion, useReducedMotion } from "motion/react"; import { BrandMark } from "@/components/brand"; import { Icon } from "@/components/icons"; type StageStyle = CSSProperties & { "--pointer-x": string; "--pointer-y": string; }; const cycle = 10.5; const rest = 1.2; export function HeroIllustration() { const stageRef = useRef(null); const reduceMotion = useReducedMotion(); const updateParallax = (event: PointerEvent) => { const stage = stageRef.current; if (!stage || reduceMotion) return; const bounds = stage.getBoundingClientRect(); const x = ((event.clientX - bounds.left) / bounds.width - 0.5) * 2; const y = ((event.clientY - bounds.top) / bounds.height - 0.5) * 2; stage.style.setProperty("--pointer-x", x.toFixed(3)); stage.style.setProperty("--pointer-y", y.toFixed(3)); }; const resetParallax = () => { stageRef.current?.style.setProperty("--pointer-x", "0"); stageRef.current?.style.setProperty("--pointer-y", "0"); }; const repeating = { duration: cycle, repeat: Infinity, repeatDelay: rest }; return (
); }