Animated Number
Animated Number é um componente para React e Tailwind CSS, da biblioteca Motion Primitives, com licença MIT. Copia e cola no teu projeto.
Motion Primitives
MIT
other
O que é
Animated Number é um componente para React e Tailwind CSS, da biblioteca Motion Primitives, com licença MIT. Copia e cola no teu projeto.
Como usar
Abre o componente no catálogo, carrega em copiar, e cola no teu projeto. O prompt copiado leva o código e as regras para o teu agente o reproduzir sem alterar nada.
Cinco cópias grátis por mês. Sem cartão.
Precisa de
npm i motion
Licença
Este componente vem de Motion Primitives e é redistribuído sob a licença MIT, que permite uso comercial. O aviso de copyright viaja com o código.
Animated Number
'use client';
import { AnimatedNumber } from '@/components/core/animated-number';
import { useInView } from 'motion/react';
import { useRef, useState } from 'react';
export function AnimatedNumberInView() {
const [value, setValue] = useState(0);
const ref = useRef(null);
const isInView = useInView(ref);
if (isInView && value === 0) {
setValue(10000);
}
return (
<div className='flex w-full items-center justify-center' ref={ref}>
<AnimatedNumber
className='inline-flex items-center font-mono text-2xl font-light text-zinc-800 dark:text-zinc-50'
springOptions={{
bounce: 0,
duration: 10000,
}}
value={value}
/>
</div>
);
}