Loading lesson…
Level 1 · Apprentice0 XP
Why animations stutter, and how to move work off the thread that handles taps.
Step 1 / 5
ProblemYou parse a big JSON file when a screen opens. For half a second taps do nothing and the animation freezes. The code is correct. The thread is busy.
← → step
Before this: Animations and gestures
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Put a 500 ms blocking loop in a button handler and tap during an animation: watch it freeze. Then move the work to when the JS thread is idle with requestIdleCallback and try again.