fast-forward-numbers
v1.0.20
Published
Animate numbers by incrementing their values until the final number is reached.
Downloads
5
Maintainers
Readme
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:
HTML
<p class="ffn-class">0</p>
JS
import fastForward from 'fast-forward-numbers';
const ffn = document.querySelector(".ffn-class");
fastForward(ffn, 0, 50);
Enjoy!