"use client"; import React, { useRef, useState } from "react"; import { motion } from "framer-motion"; import { cn } from "@/lib/utils"; interface TiltCardProps { children: React.ReactNode; className?: string; tiltAmount?: number; glow?: boolean; } export function TiltCard({ children, className, tiltAmount = 8, glow = true, }: TiltCardProps) { const ref = useRef(null); const [rotateX, setRotateX] = useState(0); const [rotateY, setRotateY] = useState(0); const [gradient, setGradient] = useState({ x: 50, y: 50 }); const handleMouseMove = (e: React.MouseEvent) => { if (!ref.current) return; const rect = ref.current.getBoundingClientRect(); const x = (e.clientX - rect.left) / rect.width; const y = (e.clientY - rect.top) / rect.height; setRotateX((0.5 - y) * tiltAmount); setRotateY((x - 0.5) * tiltAmount); setGradient({ x: x * 100, y: y * 100 }); }; const handleMouseLeave = () => { setRotateX(0); setRotateY(0); setGradient({ x: 50, y: 50 }); }; return ( {children} ); }