@surveyplanet/animation_counter

0.0.4 • Public • Published

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

Param Type Description
el HTMLElement | String The element you want to update. You may pass in an HTMLElement or an ID or class name.
options options Counter options.
optinos.step Number The amount that the number will increase by each interval.
optinos.startVal Number The number that the counter will start at.
optinos.endVal Number The number that the counter will end at.
optinos.interval Number The time in millisecond between each step.
optinos.localize Number The 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

Readme

Keywords

none

Package Sidebar

Install

npm i @surveyplanet/animation_counter

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

12 kB

Total Files

8

Last publish

Collaborators

  • serferdinand2
  • jwerre
  • jw310