Communitygithub.com

고성능 웹 애니메이션

사용자가 "CSS 애니메이션 버벅임 수정", "애니메이션 60fps로 만들기", "레이아웃 쓰래싱 중단", "width/height/top/left 부드럽게 애니메이션", "transform으로 애니메이션 전환", "box-shadow 성능 개선", "height auto 애니메이션", "FLIP 애니메이션", 또는 "스크롤/호버 애니메이션이 끊기는 이유"와 같은 질문을 할 때 이 스킬을 사용해야 합니다.

고성능 웹 애니메이션란 무엇인가요?

이 스킬은 웹 애니메이션의 성능 문제 중 가장 큰 원인인 브라우저의 레이아웃 재계산(리플로) 또는 다시 그리기(리페인트)를 유발하는 속성 애니메이션을 제거하는 방법을 제공합니다. 브라우저 렌더링은 **레이아웃 → 페인트 → 합성** 단계를 거치며, `width`, `height`, `top`, `left`, `margin`, `padding`, `box-shadow`, `filter`와 같은 속성을 애니메이션하면 매 프레임마다 레이아웃이나 페인트가 다시 실행되어 메인 스레드를 차단합니다. 반면 `transform`과 `opacity`는 합성기(GPU)에서만 실행되어 레이아웃과 페인트를 건너뛰므로 60/120fps의 부드러운 애니메이션을 구현할 수 있습니다. Claude Code, Cursor(ESM 기반 Agent 모드) 및 기타 웹 기술 스킬을 지원하는 모든 플랫폼에서 사용할 수 있으며, FLIP 기법, `height: auto` 애니메이션, 레이아웃 쓰래싱 방지 방법 등을 포함한 상세한 코드 예제와 실용적인 전략을 제공합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/nehakanjamala/personal_website/tree/HEAD/.agents/skills/60fps-animation

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

고성능 웹 애니메이션은(는) 무엇을 하나요?

버벅거리는 웹 애니메이션의 가장 큰 원인인 브라우저가 매 프레임마다 레이아웃을 재계산(리플로)하거나 다시 그리도록(리페인트) 강제하는 속성 애니메이션을 제거합니다. 브라우저는 레이아웃 → 페인트 → 합성 단계로 렌더링합니다. width, height, top, left, margin, padding, box-shadow, filter를 애니메이션하면 매 프레임마다 레이아웃과/또는 페인트가 다시 실행되어 메인 스레드를 차단합니다. **transform**과 **opacity**를 애니메이션하면 레이아웃과 페인트를 건너뛰고 합성기(종종 GPU)에서 전적으로 실행되므로 60/120fps에서 부드러운 애니메이션을 만듭니다.

사용 시기

애니메이션이 끊기거나 프레임 드롭이 발생할 때, 호버/스크롤 효과가 무거울 때, 크기/위치/그림자를 애니메이션할 때, 레이아웃 변경(카드 재정렬, 요소가 컨테이너 간 이동)을 부드럽게 애니메이션해야 할 때, height: auto를 애니메이션할 때, 또는 애니메이션 코드의 성능을 검토할 때 사용합니다.

핵심 규칙: transform과 opacity만 애니메이션

모든 "비싼" 애니메이션을 저렴한 동등 애니메이션으로 매핑합니다.

애니메이션 대상 (비쌈)트리거대체 방법 (저렴함)
width / height레이아웃 + 페인트transform: scaleX()/scaleY() (+ 실제 크기를 위한 FLIP)
top / left / margin레이아웃 + 페인트transform: translate()
box-shadow페인트그림자를 가진 의사 요소의 opacity 애니메이션
filter: blur()페인트 (무거움)opacity를 통한 두 레이어 교차 페이드, 또는 드물게 허용
background-position페인트하위 레이어의 transform: translate()
color / background페인트종종 허용됨; 또는 레이어 교차 페이드

transform을 이용한 위치 및 크기

/* 나쁨: 매 프레임마다 레이아웃을 애니메이션 */
.box { transition: left 300ms, width 300ms; left: 0; width: 100px; }
.box:hover { left: 200px; width: 200px; }

/* 좋음: 합성기 전용 */
.box {
  transition: transform 300ms ease;
  transform: translateX(0) scaleX(1);
  transform-origin: left center;
}
.box:hover { transform: translateX(200px) scaleX(2); }

scaleX는 내부 콘텐츠(텍스트)를 왜곡합니다. 왜곡 없이 실제 크기를 조정하려면 FLIP을 사용하세요.

의사 요소 투명도를 이용한 저렴한 box-shadow

box-shadow를 애니메이션하면 매 프레임마다 큰 흐림 영역을 다시 그립니다. 대신 그림자를 ::after에 한 번 그리고 opacity만 애니메이션합니다.

.card { position: relative; }
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
}
.card:hover::after { opacity: 1; }

흐린 그림자는 한 번 래스터화되고, 호버링 시 합성기 투명도만 변경되므로 모든 프레임 속도에서 부드럽습니다.

FLIP: 레이아웃 변경을 저렴하게 애니메이션

FLIP(First, Last, Invert, Play)은 transform만 사용하여 레이아웃 변경(재정렬, 크기 조정, 컨테이너 간 이동)을 애니메이션합니다. 요소가 있던 위치(First)와 있을 위치(Last)를 측정하고, 반전 변환을 적용하여 시각적으로 움직이지 않은 것처럼 보이게 한 다음 변환을 다시 identity로 애니메이션합니다(Play). DOM은 실제 최종 레이아웃으로 끝나고, 움직임은 순수 합성기 작업입니다.

function flip(el, mutate) {
  const first = el.getBoundingClientRect();   // First
  mutate();                                    // DOM/레이아웃 변경
  const last = el.getBoundingClientRect();     // Last

  const dx = first.left - last.left;
  const dy = first.top - last.top;
  const sx = first.width  / last.width;
  const sy = first.height / last.height;

  el.animate(
    [
      { transformOrigin: 'top left',
        transform: `translate(${dx}px, ${dy}px) scale(${sx}, ${sy})` }, // Invert
      { transformOrigin: 'top left', transform: 'none' },               // Play
    ],
    { duration: 300, easing: 'cubic-bezier(0.2, 0, 0, 1)' }
  );
}

// 사용법: 새 그리드 위치로 이동하는 요소 애니메이션
flip(card, () => targetContainer.appendChild(card));

Web Animations API animate()는 합성기에서 변환을 실행합니다. 여러 요소의 경우 모든 getBoundingClientRect() 읽기를 어떤 변형보다 먼저 일괄 처리합니다(아래 레이아웃 쓰래싱 참조).

height: auto 애니메이션

height: auto는 역사적으로 보간이 불가능했습니다. 최신 및 폴백 접근 방식:

/* 최신 (Chrome 129+/지원 브라우저): opt size 키워드를 애니메이션에 포함 */
.panel {
  interpolate-size: allow-keywords;   /* auto로/로부터 애니메이션 활성화 */
  height: 0;
  overflow: clip;
  transition: height 300ms ease;
}
.panel.open { height: auto; }
/* calc-size()도 작동: height: calc-size(auto, size); */
/* 현재 견고한 폴백: CSS 그리드 1fr -> 0fr */
.wrapper {
  display: grid;
  grid-template-rows: 0fr;            /* 접힘 */
  transition: grid-template-rows 300ms ease;
}
.wrapper.open { grid-template-rows: 1fr; }
.wrapper > .content { overflow: hidden; min-height: 0; }

그리드 트릭은 트랙 크기를 애니메이션합니다(합성기 친화적이며 널리 지원됨). JS 높이 측정이 필요 없습니다. 대상 브라우저가 지원하는 곳에서는 interpolate-size: allow-keywords / calc-size(auto, size)를 사용하고, 크로스 브라우저 기본값으로 그리드 기술을 유지하세요.

레이아웃 쓰래싱 방지 (읽기 일괄 처리 후 쓰기)

레이아웃 속성(offsetWidth, getBoundingClientRect, scrollTop, getComputedStyle)을 쓰기 후에 읽으면 동기식 리플로가 강제됩니다. 루프에서 읽기와 쓰기를 번갈아 수행하면("레이아웃 쓰래싱") 프레임당 수십 번의 강제 리플로가 발생할 수 있습니다.

// 나쁨: 읽기, 쓰기, 읽기, 쓰기... 각 반복에서 리플로 강제
items.forEach((el) => {
  const w = el.offsetWidth;          // 읽기 (레이아웃 강제)
  el.style.width = w * 1.5 + 'px';   // 쓰기 (레이아웃 무효화)
});

// 좋음: 모든 읽기 먼저 일괄 처리, 그 다음 모든 쓰기
const widths = items.map((el) => el.offsetWidth);  // 모든 읽기
items.forEach((el, i) => {                          // 모든 쓰기
  el.style.width = widths[i] * 1.5 + 'px';
});

프레임 동기화 작업의 경우 requestAnimationFrame 콜백에서 읽고 쓰기를 적용합니다. fastdom과 같은 라이브러리는 이 읽기/쓰기 스케줄링을 공식화합니다.

will-change: 제한적으로 사용

will-change: transform은 요소를 미리 자체 합성기 레이어로 승격시켜 애니메이션 시작 시 발생하는 끊김을 방지합니다. 그러나 승격된 레이어마다 GPU 메모리가 소모되므로 과도하게 사용하면 성능이 저하됩니다.

.menu { will-change: transform; }   /* 애니메이션 직전 요소에만 */

규칙: 애니메이션 직전에만 적용하고(예: 호버/부모 상태), 유휴 상태일 때 제거합니다(will-change: auto). 많은 요소에 무차별 적용하지 말고, 크거나 많은 노드에 영구적으로 남겨두지 마십시오. 단일 transform: translateZ(0) 핵도 동일한 승격을 수행하지만 취소하기 어렵습니다. will-change를 선호하세요.

제공 및 확인 (독립형 HTML)

패키징된 헬퍼 (scripts/): scripts/seek-shot.sh anim.html 0 1.5 3은 ?t=N 하네스를 고정하고 각 순간을 스크린샷합니다. scripts/contact-sheet.sh sheet.png frame-*.png는 한눈에 검토할 수 있도록 타일링합니다. scripts/README.md를 참조하세요.

산출물은 브라우저에서 직접 열리는 하나의 독립형 .html 파일입니다. 마크업, CSS/JS 애니메이션, 그리고 하나의 파일에 고정 하네스를 포함합니다. 이 스킬의 경우 검증은 두 가지 측면에서 이루어집니다. 프레임이 올바르게 보여야 하고 저렴하게(합성기 전용) 생성되어야 합니다.

출력 계약:

  • 하나의 .html 파일, 필요시 CDN을 통한 종속성, CSS 전환/@keyframes 또는 Web Animations API로 구동되는 애니메이션.
  • 스크린샷이 결정적 프레임에 고정되도록 하는 메커니즘:
    • CSS @keyframes → ?t=N은 el.style.animationDelay = (-N)+'s'; el.style.animationPlayState = 'paused'를 설정합니다.
    • WAAPI / JS → 애니메이션 객체를 유지하고 anim.pause(); anim.currentTime = N*1000을 수행합니다.

검증 루프 — 고정 → 스크린샷, 그런 다음 버벅임 프로파일링:

  1. 시작/중간/끝(?t=0, 중간, 끝)에서 헤드리스로 열고 각각 스크린샷을 찍습니다. 움직임이 시각적으로 올바른지 확인합니다(scaleX로 인한 잘리거나 늘어난 텍스트 없음, FLIP이 실제 레이아웃에 도달, 그림자/높이 전환이 올바르게 보임).
  2. 합성기 전용인지 확인 — 이 스킬의 핵심입니다. 다음 중 하나를 수행합니다.
    • DevTools → Performance: 애니메이션을 기록하고 프레임당 보라색 "Layout" 또는 녹색 "Paint" 밴드가 없는지 확인합니다("Composite Layers"만 있어야 함).
    • 또는 헤드리스 추적: 시각적 확인을 위한 npx playwright screenshot과 CDP/tracing 캡처를 통해 애니메이션 창 동안 Layout/Paint 이벤트가 발생하지 않는지 확인합니다.
  3. FPS/"Frame Rendering Stats" 오버레이가 60fps를 유지하는지 확인합니다. 드롭된 프레임은 값비싼 속성이 다시 포함되었음을 의미합니다.
npx playwright screenshot --wait-for-timeout=500 "file://$PWD/anim.html?t=0.3" frame.png

완료 전:

  1. 독립형으로 열림 — 콘솔 오류 없음.
  2. 프레임당 transform / opacity만 애니메이션됨. DevTools에 프레임당 Layout/Paint가 표시되지 않음.
  3. 시작/중간/끝에서 스크린샷 — 올바르며, scaleX 텍스트 왜곡 없음, FLIP이 정확히 도달.
  4. 60fps 유지. will-change가 적시에 적용되고 유휴 상태일 때 제거됨(남은 레이어 없음).
  5. prefers-reduced-motion 준수.

빠른 참조

목표이렇게 하세요
요소 이동transform: translate()
왜곡 없이 크기 조정FLIP + transform
호버 시 그림자그림자 의사 요소의 opacity 애니메이션
콘텐츠 높이로 확장그리드 0fr→1fr, 또는 interpolate-size: allow-keywords
여러 요소 이동getBoundingClientRect 읽기와 쓰기 일괄 처리
부드러운 애니메이션 시작will-change 적시 적용, 유휴 시 제거
합성기 전용 확인DevTools Performance: 프레임당 보라색 "Layout"/녹색 "Paint" 없음

주의사항

  • scaleX/scaleY는 텍스트와 자식을 늘립니다. 콘텐츠가 선명해야 하는 경우 FLIP을 사용하세요.
  • transform 백분율은 요소 자체의 상자에 상대적이며 부모에 상대적인 left: %와 다릅니다.
  • will-change 또는 translateZ(0)을 과도하게 사용하면 너무 많은 레이어가 생성되어 성능이 저하됩니다. 애니메이션되는 것만 승격하세요.
  • filter와 backdrop-filter는 합성기와 관련이 있지만 여전히 비쌉니다. 블러 반경을 애니메이션하는 대신 투명도 교차 페이드를 통해 존재를 애니메이션하세요.
  • 그리드 1fr→0fr 콘텐츠는 overflow: hidden과 min-height: 0이 있어야 축소됩니다.
  • 필수가 아닌 움직임은 항상 @media (prefers-reduced-motion: reduce) 뒤에 게이트하세요.

참고 파일

  • references/patterns-and-profiling.md — 전체 실행 가능한 예제(아코디언, 목록 재정렬, 패럴랙스), 합성기 전용 프레임 확인을 위한 DevTools 프로파일링 안내, 축소된 동작 패턴 및 속성 비용 치트 시트.

Individual skills in this repo

This repo contains 13 individual skills — each has its own dedicated page.

nehakanjamala/personal_website

This skill should be used when the user asks to "respect prefers-reduced-motion", "honor reduced motion", "make my animations accessible", "fix vestibular / motion-sickness issues", "add a useReducedMotion hook", "gate GSAP / Framer Motion / Lenis for reduced motion", or "meet WCAG 2.3.3 / C39". Provides tiered (not all-or-nothing) reduced-motion patterns in CSS and JS.

nehakanjamala/personal_website

Create, modify, debug, and deploy Apify Actors, and write their input and output schemas. Use when building an Actor from scratch, changing or troubleshooting Actor code, generating or updating .actor schema files, or pushing an Actor to the Apify platform. To wrap an existing non-Actor project, use apify-actorization instead.

nehakanjamala/personal_website

Convert existing projects into Apify Actors - serverless cloud programs. Actorize JavaScript/TypeScript (SDK with Actor.init/exit), Python (async context manager), or any language (CLI wrapper). Use when migrating code to Apify, wrapping CLI tools as Actors, or adding Actor SDK to existing projects.

nehakanjamala/personal_website

Deprecated. Output schema generation moved to the apify-actor-development skill; prefer that skill whenever it is available.

nehakanjamala/personal_website

Design and build an official Apify integration for a company's product - workflow-automation apps (Zapier/n8n-style), AI agent plugins (coding-agent skills+MCP bundles or OpenClaw/Hermes-style harnesses), AI framework packages (LangChain/LlamaIndex-style), or direct application clients via apify-client. Use when planning, creating, or reviewing an integration that exposes Apify Actors, runs, datasets, or key-value stores inside another product.

nehakanjamala/personal_website

Universal AI-powered web scraper for any platform. Scrape data from Instagram, Facebook, TikTok, YouTube, LinkedIn, X/Twitter, Google Maps, Google Search, Google Trends, Reddit, Airbnb, Yelp, and 15+ more platforms. Use for lead generation, brand monitoring, competitor analysis, influencer discovery, trend research, content analytics, audience analysis, review analysis, SEO intelligence, recruitment, or any data extraction task.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a glassmorphism effect", "frosted glass UI", "Apple liquid glass style", "frosted blur card", "translucent glass panel animation", "make a frosted nav bar", "build a glass modal/dialog", "animate a glass card on hover", or "add a refracting liquid-glass hero". Covers frosted translucent panels with backdrop-filter blur, edge/specular highlights, SVG liquid-glass refraction, motion on hover/scroll/enter, and accessible reduced-transparency fallbacks.

nehakanjamala/personal_website

This skill should be used when the user asks to "build a scroll animation", "add ScrollTrigger", "pin a section while scrolling", "scrub an animation to scroll", "create a hero timeline", "do a horizontal scroll section", "split text and animate words", "animate a layout change with GSAP Flip", "sync ScrollTrigger with Lenis", "Lenis smooth scroll jittery", "ScrollTrigger markers drift", "ScrollTrigger pins break with Lenis/Locomotive", or "set up smooth scroll with GSAP pinning". Covers GSAP timelines, ScrollTrigger, SplitText, Flip, and Lenis/Locomotive smooth-scroll sync for code-driven web motion.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a Lottie animation", "play a .lottie or .json animation", "integrate a Bodymovin/After Effects animation on web or mobile", "control Lottie playback / segments", "make a scroll-driven Lottie", "recolor a Lottie at runtime", or "export an AE animation to Lottie". Covers dotLottie/lottie-web integration, playback control, interactivity, theming, and the AE export checklist.

nehakanjamala/personal_website

This skill should be used when the user asks to "add a hover/press effect", "animate a toggle or switch", "build an animated like button", "make a toast/snackbar slide in", "animate a drawer or modal", "animate list reordering or add/remove", "do a shared-element layout transition", or "polish UI feedback". Covers UI motion with Framer Motion (motion/react) and modern CSS.

nehakanjamala/personal_website

This skill should be used when the user asks to "animate page or route transitions", "add a page transition or crossfade between views", "animate route changes in Next.js App Router", "use the View Transitions API", "AnimatePresence exit doesn't fire on navigation", or "Framer Motion exit animation not working / exit animation before unmount in Next.js". Covers enter/exit page-transition animation with the View Transitions API and Framer Motion, for Next.js App Router and general SPA routing.

nehakanjamala/personal_website

Scrape web pages using Scrapling with anti-bot bypass (like Cloudflare Turnstile), stealth headless browsing, spiders framework, adaptive scraping, and JavaScript rendering. Use when asked to scrape, crawl, or extract data from websites; web_fetch fails; the site has anti-bot protections; write Python code to scrape/crawl; or write spiders.

nehakanjamala/personal_website

This skill should be used when the user asks to "animate an SVG", "make a line draw itself on", "do a stroke draw-on / signature animation", "morph one shape into another", "move an element along a path", "animate an icon/logo", or "animate an SVG gradient or filter". Covers stroke-dashoffset draw-on, path morphing, motion-along-path, and animated icons/gradients/filters via CSS, SMIL, and GSAP.

관련 스킬