Counter Animation
보통숫자가 카운트업되는 애니메이션
라이브 데모
602
Users Worldwide
코드
CounterAnimation.tsx
const [count, setCount] = useState(0);
const targetValue = 1234;
useEffect(() => {
const increment = targetValue / (2000 / 16);
const timer = setInterval(() => {
setCount(prev => prev >= targetValue ? targetValue : prev + increment);
}, 16);
}, []);