zer0cool99
New Member
- Messages
- 67
- Reaction score
- 0
- Location
- Seattle, WA
Spent most of last night chasing a jank issue on the payout counter. The number rolls up from the old balance to the new one over about 1.2s and on my Pixel it's glass smooth, on a $90 Tecno it looks like it's having a seizure. Every frame the digits jump instead of rolling and it makes the whole thing feel cheap, which is exactly the wrong feeling when someone just won.
Currently doing the dumb thing: setInterval at 16ms, dumping el.textContent = formatted every tick, and running Intl.NumberFormat fresh each time. I know that's bad. Formatting on every tick is probably half the problem on its own.
What I tried so far:
- pre-built the formatter once outside the loop, small win, still janky
- switched to rAF, better on mid tier, Tecno still drops frames
will-change: transformon the wrapper, did basically nothing- moved to a transform/translateY digit strip instead of swapping text, this is the best result so far but it's a mountain of CSS and I hate maintaining it
Is there something obvious I'm missing? Wondering if the real issue is that these devices just throttle rAF hard when the page has any other animation running, because the reels are still settling in the background while the counter starts. Feels like I'm fighting the browser instead of working with it.
Also curious if anyone's actually happy with a library for this or if you all just hand roll it.