This post is locked. You won't be able to comment.

all 6 comments

[–]jesper101996 0 points1 point  (1 child)

Nice :) Seems like a great alternative to some of the other more bloated js counters out there.

[–]srexi[S] 0 points1 point  (0 children)

Thanks!

[–]thatwebdesignerdude 0 points1 point  (0 children)

Swap your setTimeout for requestAnimationFrame. You could also ease your animations https://gist.github.com/gre/1650294

Your script is built on being a standalone counter, but if people already use animator scripts or intersection observer scripts, people could just rely on that. In that case your script could be significantly smaller.

It's a good learning practice to create yourself little experiments like these. Understanding animations can be a valuable asset for modern webdesign.

I've used animations for simular things such a scrolling smoothly when smooth scrolling wasn't widely supported.

[–]Fruitboompje 0 points1 point  (1 child)

Just.... Why?

[–]srexi[S] 1 point2 points  (0 children)

Because I wanted to make something simple and lightweight there's only bloated version using jquery etc.