← Back to Desktop app developers
See how it helps
Verify animation performance
Profiles animation work, resource lifetimes and interaction interruptions across browsers, viewports and visibility changes.
animation-performance-verification
Team members using this skill
When is it useful?
Use when motion stutters, consumes resources offscreen or behaves badly after switching tabs.
What does it help you do?
- Separates layout reads and writes and limits expensive painting or GPU layers.
- Pauses invisible work and releases animation, observer and graphics resources.
- Checks rapid interruptions, resized layouts and resumed background tabs.
Try asking this
Profile our animated hero on mobile, then verify offscreen pausing, repeated navigation and returning from a background tab. Repeat entry and exit several times. Compare frame timing and retained resources; a visually smooth first visit must not hide accumulating animation instances.
Detailed documentation
Read the skill’s original instructions, examples and checks in their authored language.
Show less
Animation Performance & Verification
Smooth motion requires staying within the frame budget ($16.6\text{ms}$ at 60Hz, $8.3\text{ms}$ at 120Hz ProMotion) while keeping main-thread input responsiveness (INP) crisp and GPU memory bounded.
Eliminating Layout Thrashing & Paint Bottlenecks
- Batch DOM reads before DOM writes:
- Reading layout properties (
offsetWidth,getBoundingClientRect(),scrollTop,getComputedStyle()) immediately after mutating styles forces a synchronous browser reflow. Perform all measurements in a single read pass before applying style mutations or scheduling writes insiderequestAnimationFrame.
- Reading layout properties (
- Disciplined GPU layer promotion (
will-change):- Never apply
will-change: transform, opacityglobally (*or hundreds of list items), which exhausts GPU VRAM (especially on mobile Safari and high-DPI displays). - Apply
will-changeonly to elements actively animating or about to animate, and remove it when the animation settles if layer count is high. - Watch out for expensive paint properties: animating large
blur()filters,box-shadow, ormask-imagerepaints textures every frame. Instead, pre-render blurred shadows onto a pseudo-element (::after) and animate only the pseudo-element'sopacityandtransform.
- Never apply
Visibility Lifecycle & Resource Cleanup
Never waste CPU/GPU cycles animating elements the user cannot see:
- Offscreen pausing (
IntersectionObserver): Pause continuousrequestAnimationFrameloops, Canvas/WebGL renderers, SVG loops, and video/timeline playback as soon as the container leaves the viewport (!entry.isIntersecting). - Background tab suspension (
visibilitychange): Pause timers and customrAFdelta clocks ondocument.hidden === true, and clampdeltaTime(Math.min(dt, 0.05)) on resume so physics or particle simulations do not explode after a 10-minute background pause. - Deterministic teardown on unmount:
- Cancel active
requestAnimationFrameIDs,AbortControllerlisteners,ResizeObserver, andIntersectionObserverinstances. - Revert animation contexts (
ctx.revert(),ScrollTrigger.kill(),animation.cancel()) and dispose WebGL geometries, materials, textures, and render targets.
- Cancel active
Browser Verification Checklist
Verify every significant animation against concrete conditions before handoff:
- Input & interruption stress test: Rapidly hover/unhover, click repeatedly mid-transition, press
Escape, and trigger browser Back/Forward during the animation. - Viewport & mid-page load test: Reload the page while scrolled halfway down a scroll-triggered scene; resize across mobile (
375px) and desktop (1440px+) breakpoints; test both touch/trackpad and wheel scrolling. - Reduced-motion & keyboard walkthrough: Toggle
prefers-reduced-motion: reduceand navigate the entire scene using onlyTab,Shift+Tab,Enter,Space, and arrow keys. - Performance profiling: Inspect Chrome DevTools Performance / Rendering tracks (Layout Shift regions, Paint flashing, Frame timing, and Heap/GPU memory after 5 mount/unmount cycles).
Included files 1
SKILL.md
