JavaScript Library For Animating Numbers – NumberRush

Category: Animation , Javascript | January 15, 2022
AuthorVladislavKaraulanov
Last UpdateJanuary 15, 2022
LicenseMIT
Tags
Views2,692 views
JavaScript Library For Animating Numbers – NumberRush

NumberRush is a tiny incrementing counter JavaScript library that can be used to animate counting to a given number.

How to use it:

1. Include the number-rush.js library on the page.

<script src="./js/number-rush.js"></script>

2. Wrap the initial value in a container element.

<div id="example">
  0
</div>

3. Initialize the counter and specify the end value as follows:

new numberRush('demo', {
    maxNumber: 1024
})

4. You can also specify the end value using the data-max-number attribute:

<div id="example" data-max-number="1024">
  0
</div>

5. Set the animation speed. The higher the value, the slower the speed.

new numberRush('example', {
    speed: 5,
})

6. Set the step size. Default: 1.

new numberRush('example', {
    steps: 10,
})

You Might Be Interested In:


Leave a Reply