Skip to content

Vben CountToAnimator ​ ​

CountToAnimator renders animated number transitions.

Basic Usage ​ ​

Use start-val, end-val, and duration to control the animation range and timing.

Formatting ​ ​

Use prefix, suffix, separator, and decimal to control how the number is displayed.

Props ​ ​

PropDescriptionTypeDefault
startValstarting valuenumber0
endValending valuenumber2021
durationanimation duration in msnumber1500
autoplaystart automaticallybooleantrue
prefixvalue prefixstring''
suffixvalue suffixstring''
separatorthousands separatorstring','
decimaldecimal separatorstring'.'
colortext colorstring''
useEasingenable transition preset easingbooleantrue
transitiontransition preset namekeyof typeof TransitionPresets'linear'
decimalsdecimal places to keepnumber0

Events ​ ​

EventDescriptionType
startedfired when the animation starts() => void
finishedfired when the animation ends() => void
onStarteddeprecated alias of started() => void
onFinisheddeprecated alias of finished() => void

Exposed Methods ​ ​

MethodDescriptionType
resetreset to startVal and run again() => void

Contributors

Changelog

Released under the MIT License.