Animations that sleep
Engineering
3 December 2026
Our home page felt heavy. The cause was not the download. Animation loops ran 60 times a second, also when nothing moved.
The download was small: about 245 KB of compressed JavaScript, and the images load lazily. We recorded performance traces and found the real cause. Animation loops ran on each frame, also when the page was still.
What ran when nothing moved
- The dot logo in the hero calculated about 7,600 dots on each frame.
- On touch screens, a virtual finger moved through the logo without end.
- The custom cursor measured the layout on each frame.
- Smooth scroll and the header logo had their own loops.
- The footer clock rendered the full footer again each second.
What we changed
- The hero calculates only the logo dots and the dots near the pointer. A dot that is home and still stops. At rest, the logo breathes at 20 frames a second, not 60.
- The virtual finger on touch screens stops after 8 seconds.
- The loops of the cursor, smooth scroll and header stop when they settle. A pointer, scroll or key event starts them again.
- The slow spin of the header logo moved to CSS.
- Only the clock text updates, and only when the footer is on the screen.
The result
We measured the page in headless Chrome with touch emulation, so the numbers show the phone case.
| Before | After | |
|---|---|---|
| CPU use on a still page | about 30% | about 17% |
| Hero dot field, JavaScript per 5 seconds | 338 ms | 50 ms |
| Main thread work during scroll | 758 ms | 455 ms |
The rule
An animation loop must have a reason to run. When nothing moves, it sleeps.
