Sarthk Kharwal• 80
@SarthkK
Submitted
How would you animate the numbers? Also, some input on how to make the responsiveness better would be much appreciated :)
@liix5
@SarthkK
Submitted
How would you animate the numbers? Also, some input on how to make the responsiveness better would be much appreciated :)
@liix5
Posted
for the animation use setInterval define a new value and tell it to increase that value by one. set it to run every half a second (or choose the time that you see fitting) and inside the setInterval make this new value equal to the innerText that you want to animate. last clear the interval ( tell it to stop counting) if the number that has been adding up is equal to the result of the age math you did(the final result)
you can check my solution for it and explore the code to understand it better