lundi 28 février 2022

onClick rolling number animations in javascript

im starting to figure out how I can do rolling numbers animation in javascript onClick.

So basically I have:

const button = document.getElementById("generate");

button.onclick = function generate(){

const randomNum = Math.floor((Math.random() * 10000) + 1);

const el = document.getElementById('ranNum');

el.innerHTML = randomNum;
}

And what I would like to do is have numbers from from their current position if the person pressing a button and got 2434 and the next time the press the button the next answer would be like 132, but there would be a rolling up animation to get the next number of 132, and so on..

I seen this on google when I asked for a number generator, and their animation was sick. But sadly no documentation on googles scrolling numbers.

Does anyone have any ideas where I can go try and find documentation?

Thanks!




Aucun commentaire:

Enregistrer un commentaire