Inflearn Card Rolling Animation Optimization: Performance Improvements with rAF and transform
·2026.11.23 13:32
Key point
Inflearn secured the performance and stability of the card rolling animation by implementing an rAF loop and applying transform.
Details
- Summary of the optimization process for the card rolling animation in the 'Now on Inflearn' section of the Inflearn main page
- Introduced a single master clock to resolve draft issues caused by independent timers per column
- Incremented masterTick every second, using masterTick % 5 (rollingPeriod) to control rolling only one column per second
- Replaced the timer with a requestAnimationFrame (rAF) loop to resolve the issue of timers continuing to run in background tabs
- rAF automatically pauses in hidden tabs, and upon returning, rolling resumes from the paused column while maintaining masterTick
- Removed reflow (Jank) caused by top property transitions, using only transform (translateY) and opacity
- transform and opacity execute only the GPU composite stage, reducing main thread load
- Synchronized items using useRef to maintain existing slots and resolve the card jumping issue during refetch
- Included the number of columns in the key to handle conditional remounting in response to column count changes during responsive transitions
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.