Battery-Friendly Animation: Motion That Does Not Drain Phones
How to keep animation from draining battery: pause when hidden, stop infinite loops, avoid expensive effects, respect low power modes and measure energy use.
Core Takeaway
Animation drains battery when it runs continuously, does expensive work each frame or keeps the screen refreshing at high rates. Pause animations that are off screen or in hidden tabs, avoid endless loops, prefer cheap properties such as transform and opacity, reduce motion in low power or reduced-motion modes, and measure energy use on real devices.
Stop what nobody sees
The cheapest frame is the one you do not draw.
- Pause when the tab is hidden, using the Page Visibility API
- Pause elements scrolled out of view, using an IntersectionObserver
- Pause when the app goes to the background on mobile
- Stop loops after a few cycles if they are decorative
Cheaper frames
Each frame costs less when it avoids layout and paint. Web.dev's rendering guidance recommends sticking to compositor-friendly properties such as transform and opacity. Large blurs, shadows and filters that change every frame cost far more.
Respect user and system settings
Reduced motion is a strong hint to stop non-essential animation. Low power modes on phones also reduce refresh rates and background work; treat them as a signal to simplify. Do not force high frame rates for slow ambient motion.
Measure it
Use platform energy tools, such as Xcode's energy reports and Android's profilers, and browser performance panels to see CPU and GPU use during animation. Test long sessions, not just the first few seconds.
Building this in ExodeUI
ExodeUI components, which we make, move in response to inputs, so an interactive component that nobody touches mostly rests. Avoid endless decorative loops in your states, and pause components that are off screen.
Key Principles to Remember
- Pause hidden, off-screen and backgrounded animations
- Avoid endless decorative loops
- Animate cheap properties; avoid per-frame blur and shadow
- Respect reduced motion and low power modes; measure on devices
Frequently Asked Questions
Sources
- Page Visibility API — MDN Web Docs
- Rendering performance — web.dev
- prefers-reduced-motion — MDN Web Docs