slotCount.js
Demo
Simple slot machine-like counter, inspired by Google Plus.
No dependencies. AMD and CJS compatible.
Works in modern browsers. Chrome, Firefox, Safari 6+, IE10+.
Installation
Manually
Adding to your HTML file:
<script src="/path_to_http_invoke/slotcount.js"></script>
with Bower
bower install slotcount
with Component
component install auchenberg/slotcount.js
Usage
var counter = new slotCount(container, initialCount);
counter.set(newCount);
counter.dispose();Examples
Random number every 2000ms
var counter = new slotCount(document.querySelector('.counter-box'), 10);
setInterval(function() {
var random = Math.floor(Math.random() * 50);
counter.set(random);
}, 2000);Test
You can test the component implementation of slotCount.js with Mocha in your browser.
Make sure you run component build and then point your browser locally to test/index.html.
Credits
slotCount.js is a project by Kenneth Auchenberg
License
The MIT License (MIT)