Sha256: c97b84ea269b4e1856bd4a1597a4133535c05e6b401706c8d64e16ecff22ab6e
Contents?: true
Size: 562 Bytes
Versions: 58
Compression:
Stored size: 562 Bytes
Contents
mumuki.animateNumberCounter = (selector, valueTo, seconds = 1) => { const $numberCounter = $(selector); if ($numberCounter.text()) return; const millis = seconds * 1000; const incrementStep = valueTo / (millis / 10); _increment(); function _increment(initValue = 0, delay = 10) { if (initValue >= valueTo) return; const nextValue = initValue + incrementStep; // TODO: this one should be xp agnostic $numberCounter.text(`+${Math.min(Math.round(nextValue), valueTo)}exp`); setTimeout(() => _increment(nextValue), delay); } };
Version data entries
58 entries across 58 versions & 1 rubygems