1.0.4 • Published 3 years ago

@federico.mameli/counter-js v1.0.4

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

counter

Simple counter built in js

Usage

Module

npm install @federico.mameli/counter

or 

yarn add @federico.mameli/counter
import Counter from '@federico.mameli/counter'

const counterEl = document.querySelector('.counter')
const counter = new Counter({
  el: counterEl,
  from = 0,
  to = 100,
  incRange = 10,
  overflow = 0,
  time = 50,
  start = false
})

counter.start()

options properties

options.el

The element where to print the counter values.

options.from

start value, default 0

options.to

end value, default 100

options.incRange

value added each time

options.overflow

default is 0, if a percentage is defined the counter will count until to + (to * overflow) and will count down until to.

options.time

velocity of each change, default 50 ms

options.start

if true starts the counter

METHODS

start()

Start the counter

1.0.2

3 years ago

1.0.1

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago