Menu

I made a web odometer that carries like the real one
📰

I made a web odometer that carries like the real one

DEV Community: css·Ciprian Titire·about 5 hours ago
#hGPUSG0w
#devtocss#devto#dev#odometer#drum
Reading 0:00
15s threshold

Most animated counters move every changing digit at once. A real odometer doesn't do that. Going from 1,099 to 1,100, the ones drum turns and the tens and hundreds only get pulled along at the end.

I wanted that on the web so I made one. It's free, MIT, on npm as tactile-odometer .

how it carries

Each drum is a ten-sided prism in CSS 3D. Only the last drum is driven, by one spring on a single number. Every other drum works out its angle from that number. It stays put while the drum to its right goes 0 to 9, and turns when that drum goes 9 to 0.

In the 1,099 to 1,100 test the ones drum is most of the way round before the tens and hundreds start (268 ms in), and all three land together at 417 ms.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.