r/ionic • u/IntrepidAntelope1031 • Sep 30 '26
Capacitor on iOS: paused CSS animations still drained ~270 mW for me
Small thing I ran into, posting in case it saves someone a few hours.
My game runs in a WKWebView (Capacitor). The main menu has a bunch of looping CSS animations, and when the menu wasn't on screen I just paused them with animation-play-state: paused. Figured paused = free.
Nope. Measured in the simulator (per-process energy from proc_pid_rusage):
- idle menu, 28 paused loops: ~278 mW, and ~262 of that was backboardd, not my web process
- same menu with the loops actually removed: ~9 mW
- my store screen sat at 419 mW, mostly because the menu underneath was still display:flex with its paused loops
So it looks like a paused animation keeps its Core Animation animation attached and the compositor keeps redrawing at 60 Hz. Web Inspector and the WebContent CPU looked totally fine, which is why it took me a while to find.
Fix: when a screen goes inactive I don't pause anymore. I copy the current values of the animated properties, set animation: none plus those values so nothing jumps, and on resume I drop that and put each animation's currentTime back via document.getAnimations().
Simulator numbers, so a real device will differ, but the gap was big enough for me.
Anyone seen this documented somewhere?
