/* All rights reserved to NY0510 (As Known As NY64), 2024 https://github.com/NY0510/ny64.kr/blob/main/src/components/ProfileSection.tsx */ import { useState, useEffect } from 'react'; import { useMotionValue, motion, useMotionTemplate } from "framer-motion"; const birthday = new Date('2021-11-14'); export function TimeCounter() { const mouseX = useMotionValue(0); const mouseY = useMotionValue(0); const background = useMotionTemplate`radial-gradient(200px circle at ${mouseX}px ${mouseY}px, rgba(38, 38, 38, 0.4), transparent 80%)`; const [afterBirth, setAfterBirth] = useState(''); const [tenThousands, setTenThousands] = useState(0); const [animate, setAnimate] = useState(false); useEffect(() => { const interval = setInterval(() => { const elapsed = new Date().getTime() - birthday.getTime(); setAfterBirth(elapsed.toLocaleString()); const newTenThousands = Math.floor(elapsed / 10000); if (newTenThousands !== tenThousands) { setTenThousands(newTenThousands); setAnimate(true); setTimeout(() => setAnimate(false), 200); } }, 1); return () => clearInterval(interval); }, [tenThousands]); return (
{ const { left, top } = e.currentTarget.getBoundingClientRect(); mouseX.set(e.clientX - left); mouseY.set(e.clientY - top); }} className="group relative w-full max-w-[350px] overflow-hidden rounded-xl bg-neutral-950" title='암냥으로 활동한지' >
암냥 ~

{afterBirth} ms

); /* return (
암냥으로 활동한지 {afterBirth} ms
);*/ }