slot-rolling-number

A customized slot-machine-style rolling number tool for web pages.

Usage no npm install needed!

<script type="module">
  import slotRollingNumber from 'https://cdn.skypack.dev/slot-rolling-number';
</script>

README

Usage:

  1. put HTML element in your page:
  2. import rollingNumberCreator from 'package'
  3. init instance: let rollingNumberInstance = rollingNumberCreator();
  4. create rolling number: rollingNumberInstance.default({ el: document.getElementById('digit'), from: '?', to: '1', animationDelay: 0 })
  5. please note: I changed some variables in the original file, see comments in index.js, if animationDelay is not 0, there will be blinks at the start and the end of the animation. If there is any other character you want you roll, find u = "?0123456789" and include them.

Example: img