"use client" import type React from "react" import { useEffect, useRef, useState } from "react" import { motion, useTransform, useScroll, useSpring } from "framer-motion" import { cn } from "@/lib/utils" export const TracingBeam = ({ children, className, }: { children: React.ReactNode className?: string }) => { const ref = useRef(null) const { scrollYProgress } = useScroll({ target: ref, offset: ["start start", "end end"], }) const contentRef = useRef(null) const [svgHeight, setSvgHeight] = useState(0) useEffect(() => { if (contentRef.current) { setSvgHeight(contentRef.current.offsetHeight) } }, []) const yRange = useTransform(scrollYProgress, [0, 1], [0, svgHeight]) const smoothY = useSpring(yRange, { damping: 50, stiffness: 400 }) return (
{children}
) }