0.0.4 • Published 3 years ago

@surveyplanet/animation_counter v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Animation counter

Animates a number in the DOM by counting up or down.

Install

npm install --save @surveyplanet/animation_counter

Example

import 'animationCounter' from '@surveyplanet/animation_counter
const el = document.getElementById('#counter');
animationCounter(el, {
   startVal: 5,
   endVal: 1000000,
   interval: 1,
   step: 3000,
   localize: 'de-DE',
});

Options

ParamTypeDescription
elHTMLElement | StringThe element you want to update. You may pass in an HTMLElement or an ID or class name.
optionsoptionsCounter options.
optinos.stepNumberThe amount that the number will increase by each interval.
optinos.startValNumberThe number that the counter will start at.
optinos.endValNumberThe number that the counter will end at.
optinos.intervalNumberThe time in millisecond between each step.
optinos.localizeNumberThe language code for the number to be localized to. For example, 'en-US' for US English, 'de-de' for German, 'fr-fr' for French, etc. The default for this parameter is empty, meaning that your dots and comas won't be displayed at all. Leave this empty if you want the number to be displayed as is.

Testing

npm install
npm run test
0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago