Zum Inhalt springen
Skillpedia
Websites & UI (Frontend)7.2k · #13339

optimize-web-animations

Was er macht

Dieser Skill führt den Agenten durch das Messen der Animationen einer Seite und das Verschlanken. Er richtet sich an Webentwickler, deren Seiten mit der Zeit langsamer werden oder Energie für verborgene Bewegungen verbrauchen.

Wann du ihn nutzt

  • ✓Wenn eine Webseite umso langsamer wird, je länger sie geöffnet bleibt.
  • ✓Wenn Animationen weiterlaufen, obwohl sie nicht im Bild sind.
  • ✓Wenn du einen Speicherverlust durch Timer, Listener oder Effekte vermutest.

Link zum Skill

https://github.com/MengTo/Skills/blob/main/agent-skills/codex/optimize-web-animations/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/MengTo/Skills/blob/main/agent-skills/codex/optimize-web-animations/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Meine Landingpage wird langsamer, je länger sie geöffnet ist. Finde die Animationen, die das verursachen, und behebe sie.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent misst die Seite zuerst im Browser, zählt laufende Animationen und Schleifen, pausiert Bewegungen außerhalb des Bildschirms und räumt Ressourcen auf, wenn eine Seite ihre Ansicht schließt. Danach misst er erneut, um die Korrektur zu bestätigen.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

Optimize Web Animations

Core Rule

Measure the real page before editing. The goal is not to remove motion; it is to make offscreen work stop, visible motion resume correctly, and route/unmount cleanup release long-lived resources.

Use Codex Browser when available, especially for localhost pages. Do not use Chrome unless the user explicitly asks for it.

Workflow

  1. Inspect repo context.

    • Read AGENTS.md or local instructions.
    • Run git status --short early.
    • Find page components, animation hooks, CSS keyframes, requestAnimationFrame, setInterval, setTimeout, canvas/WebGL/physics components, media elements, GSAP timelines/tweens, and existing visibility utilities.
    • Search effect cleanup for event listeners, observers, RAF loops, intervals, timers, external scripts, media streams, WebGL textures/materials/geometries/renderers, and async work that can complete after unmount.
    • If the worktree is dirty, plan narrow staging from the start.
  2. Capture a baseline in the browser.

    • Open the exact route the user named.
    • Profile at top, mid-page, footer/lower content, and one mobile viewport when layout could differ.
    • Count CSS animations by computed animationName, animationPlayState, and visibility. Include ::before and ::after.
    • Inspect canvases/WebGL elements separately; CSS profiling does not prove RAF loops have stopped.
    • Record which animation names are running offscreen and the DOM owners responsible.
    • For memory/leak asks, also record element/canvas/image/iframe counts, exposed JS heap metrics when available, an idle sample after 10-30 seconds, and a short route-cycle sample. If heap APIs return null or the Browser sandbox blocks monkey-patching, say so and rely on stable observable counts plus source audit.
    • Keep stress tests bounded. A Browser tab crash during profiling is evidence of overload, but do not over-attribute the cause unless reproduced by a minimal test.
    • See references/browser-profiling.md for a reusable Codex Browser evaluator.
  3. Patch the smallest owner that controls the motion.

    • Prefer an existing page reveal/visibility hook if the app has one.
    • Otherwise add an IntersectionObserver that toggles a stable class such as is-offscreen on sections and animated child elements.
    • Pause CSS animations with targeted rules:
main > section.is-offscreen .expensive-animation,
.expensive-animation.is-offscreen {
  animation-play-state: paused !important;
}
  • For repeated cards or placeholders, observe the card shell and the animated descendants, not the whole document.
  • For marquee/ticker tracks, pause the track when its section is offscreen.
  • For skeleton loaders and pseudo-element glimmers, include ::before and ::after pause selectors where needed.
  • For canvas/WebGL/physics loops, gate the RAF loop directly:
    • Start when the canvas/container intersects.
    • Cancel requestAnimationFrame when offscreen.
    • Resume on re-entry.
    • Disconnect observers and cancel frames on cleanup.
    • Add a non-visual debug marker such as data-animation-active when it helps browser verification.
  • Respect prefers-reduced-motion if the component already does, and avoid introducing React render loops for scroll/animation state.
  • For leak hardening:
    • Clear every timeout/interval created by the effect.
    • Cancel RAF before unmount and before restarting a loop.
    • Disconnect IntersectionObserver, ResizeObserver, MutationObserver, and custom subscriptions.
    • Remove global/window/document listeners with the same handler reference.
    • Dispose Three/WebGL textures, materials, geometries, renderers, and remove renderer DOM nodes.
    • Kill GSAP tweens/timelines for DOM nodes and mutable objects such as shader uniforms.
    • Stop media streams and pause detached video/audio sources.
    • Guard async loaders with an isDisposed flag and dispose loaded resources if they resolve after unmount.
    • In React cleanup, capture ref.current values inside the effect before returning cleanup if lint warns the ref may change.
    • Cap physics or simulation frame deltas after visibility pauses so delayed frames do not run oversized updates.
  1. Verify behavior, not just builds.
    • Reload the route and rerun the same top/mid/footer/mobile profiles.
    • Target result: offscreenRunningCount: 0 for the page sections under test.
    • Confirm visible anima
Häufige Fragen

Entfernt er die Animationen?

Nein. Ziel ist, Arbeit außerhalb des Bildschirms zu stoppen und Ressourcen aufzuräumen, nicht die Bewegung zu entfernen.

Misst er, bevor er Code ändert?

Ja. Der Skill sagt, die echte Seite zu messen, bevor etwas bearbeitet wird.

Welche Animationswerkzeuge deckt er ab?

CSS-Animationen, Canvas- und WebGL-Schleifen, GSAP, Three.js- und Matter.js-Effekte, Timer und Beobachter.

Details

Originalbeschreibung des Autors

Profile, audit, and optimize frontend page performance with emphasis on animation work, memory-leak risks, long-session slowdowns, CSS animations, canvas/WebGL requestAnimationFrame loops, marquees, skeletons, GSAP/Three/Matter effects, timers, listeners, and observers. Use when the user asks to make animations performant, pause offscreen animations, look for memory leaks, profile pages that slow the computer over time, fix janky scrolling, reduce CPU/GPU use, or repeat the "only play in view" optimization on React/Vite/Next/frontend pages using Codex Browser.

repo: MengTo/Skills

Beliebtheit

GitHub-Sterne
7.2k
Platz im Ranking
#13339
Lizenz
MIT
Aktualisiert
1.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills