@federico.mameli/counter-js
v1.0.4
Published
Simple js counter
Downloads
2
Readme
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