Skip to content
roguelite labsAnthony Spezzano ↗
motion/animated-number

Animated Number

Smoothly counts to a target number on mount using requestAnimationFrame with cubic ease-out. Pure React.

Use and inspectUse this when the motion supports the surrounding content. Connect callbacks and state to your app, keep the reset preview as a local demonstration, and add a reduced-motion fallback for movement or looping. The preview is synthetic; it does not call a backend.Next: inspect the source below and replace the demo inputs with your own data.
Animated NumberSmoothly counts to a target number on mount using requestAnimationFrame with cubic ease-out. Pure React.

Props

PropTypeDefaultDescription
valuerequirednumberTarget number to count to
durationnumber1.5Count duration in seconds
format(n: number) => stringOptional number formatter