본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)7.2k · #13339

optimize-web-animations

하는 일

이 스킬은 페이지의 애니메이션을 측정하고 더 가볍게 만드는 과정을 안내합니다. 시간이 지날수록 느려지거나 숨겨진 움직임에 전력을 낭비하는 웹 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓웹 페이지를 열어 둘수록 점점 느려질 때.
  • ✓화면 밖에 있어도 애니메이션이 계속 돌아갈 때.
  • ✓타이머, 리스너, 효과에서 메모리 누수가 의심될 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/MengTo/Skills/blob/main/agent-skills/codex/optimize-web-animations/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 랜딩 페이지가 열어 둘수록 느려져요. 원인이 되는 애니메이션을 찾아서 고쳐 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 먼저 브라우저에서 페이지를 측정하고, 실행 중인 애니메이션과 루프를 셉니다. 그다음 화면 밖의 움직임을 멈추고, 페이지가 보기를 닫을 때 자원을 정리합니다. 수정 후 다시 측정해 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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
자주 묻는 질문

애니메이션을 없애나요?

아닙니다. 목표는 움직임을 없애는 것이 아니라 화면 밖의 작업을 멈추고 자원을 정리하는 것입니다.

코드를 바꾸기 전에 측정하나요?

네. 스킬은 편집하기 전에 실제 페이지를 측정하라고 설명합니다.

어떤 애니메이션 도구를 다루나요?

CSS 애니메이션, 캔버스와 WebGL 루프, GSAP, Three.js와 Matter.js 효과, 타이머와 옵서버를 다룹니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
7.2k
순위
#13339
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬