fast-forward-numbers
Version:
Animate numbers by incrementing their values until the final number is reached.
51 lines (35 loc) • 1.13 kB
Markdown
**Fast Forward Numbers**
A library used to animate numbers, incrementing them until the final number is reached.
**How to use?**
**Step 1:** Install with NPM.
```
npm install --save fast-forward-numbers
```
**Step 2:** Using Webpack, load the required JS:
```
import fastForward from 'fast-forward-numbers';
```
**Step 3:** Call the function below inside your code:
```
fastForward(element, startNumber, endNumber, time(optional), speed(optional));
```
where...
```
element - an element the function is called on.
startNumber - animation will start with this number.
endNumber - animation will end with this number.
time (optional) - time it takes for numbers to be animated. Expressed in ms (default: 3000).
speed (optional) - speed at which numbers are animated. Increase to increase increment count, decrease to decrease increment count (default: 1).
```
Example:
<b>HTML</b>
```
<p class="ffn-class">0</p>
```
<b>JS</b>
```
import fastForward from 'fast-forward-numbers';
const ffn = document.querySelector(".ffn-class");
fastForward(ffn, 0, 50);
```
**Enjoy!**