Communitygithub.com

Lottie 애니메이션

After Effects에서 제품으로 이어지는 벡터 애니메이션을 JSON 또는 .lottie 형식으로 내보내고, 웹/모바일/React Native에서 재생, 제어, 테마 변경까지 다루는 스킬입니다.

Lottie 애니메이션란 무엇인가요?

이 스킬은 After Effects로 만든 벡터 애니메이션을 제품에 통합하는 전체 과정을 다룹니다. 디자이너가 작업한 AE 컴포지션을 Bodymovin으로 내보내 JSON 또는 압축된 .lottie 파일로 만든 뒤, 웹(바닐라/React/React Native), iOS, Android에서 재생하는 방법을 설명합니다. @lottiefiles/dotlottie-web 및 @lottiefiles/dotlottie-react를 이용한 dotLottie 런타임 설치, 재생/일시정지/정지/속도/모드 제어, setSegment로 특정 프레임 구간 반복, 스크롤 연동 애니메이션(setFrame으로 스크롤 진행률 매핑), 런타임 테마 전환 및 색상 오버라이드, 모바일 플랫폼(iOS lottie-ios, Android lottie-android, React Native lottie-react-native) 동등 구현, 그리고 파일 최적화(압축, 지연 로딩, 작은 AE 컴포지션 유지)까지 폭넓게 다룹니다. 또한 단일 HTML 파일로 직접 브라우저에서 열 수 있는 배포 가능한 예제를 만들고, ?t=N 쿼리로 정확한 프레임을 고정해 스크린샷으로 검증하는 방법을 제시합니다. 이 스킬은 설계된 대로 애니메이션이 정확히 작동하는지 확인하고, prefers-reduced-motion을 존중하며, 의도한 이징과 속도를 유지하는 모범 사례를 강조합니다.

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

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

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

문서

Lottie 애니메이션은(는) 무엇을 하나요?

After Effects에서 제품으로 이어지는 다리: 벡터 애니메이션을 JSON(또는 압축된 .lottie)으로 내보내면, 용량이 작고 해상도에 독립적이며 웹, iOS, Android, React Native에서 런타임이 재생합니다. 이 스킬은 Lottie 통합, 제어 및 내보내기를 다룹니다.

사용 시기

  • 디자이너의 AE 애니메이션을 웹/iOS/Android/React Native로 전달
  • 반복 일러스트레이션, 온보딩, 빈 상태, 애니메이션 아이콘
  • 스크롤 기반 또는 상호작용 기반(호버, 클릭, 커서) 벡터 재생
  • 브랜드별 재내보내기 대신 런타임 테마/색상 변경

형식: .json vs .lottie

  • .json — Bodymovin 원본 출력. 사람이 읽을 수 있고, 크기가 더 큽니다.
  • .lottie — 압축된 컨테이너(보통 60~80% 더 작음)로 여러 애니메이션, 이미지, 테마를 묶을 수 있습니다. 배포에 선호됩니다. 플레이어: @lottiefiles/dotlottie-web (최신, 캔버스 + WASM)이 기존 lottie-web을 대체합니다.

새 작업에는 dotLottie 런타임을 선호하고, 레거시 .json + SVG 렌더러가 필요한 경우에만 lottie-web을 사용하세요.

핵심 워크플로 (웹, dotLottie)

npm i @lottiefiles/dotlottie-web        # 바닐라
npm i @lottiefiles/dotlottie-react      # React 래퍼

바닐라:

import { DotLottie } from "@lottiefiles/dotlottie-web";

const dotLottie = new DotLottie({
  canvas: document.querySelector("#lottie"),  // <canvas> 요소
  src: "/hero.lottie",                         // 또는 .json
  loop: true,
  autoplay: true,
  // speed: 1, mode: "forward" | "reverse" | "bounce", renderConfig: { autoResize: true }
});

React:

import { DotLottieReact } from "@lottiefiles/dotlottie-react";

function Hero() {
  return <DotLottieReact src="/hero.lottie" loop autoplay style={{ width: 320 }} />;
}

인스턴스를 캡처하여 제어:

const [dl, setDl] = useState(null);
<DotLottieReact src="/icon.lottie" dotLottieRefCallback={setDl} />;
// dl?.play(); dl?.pause(); dl?.setSpeed(2);

재생 제어

dotLottie.play();
dotLottie.pause();
dotLottie.stop();
dotLottie.setSpeed(1.5);
dotLottie.setMode("bounce");        // forward | reverse | bounce | reverse-bounce
dotLottie.setFrame(42);             // 특정 프레임으로 이동
dotLottie.setSegment(30, 90);       // 프레임 범위로 재생 제한 (예: "로딩" 루프)

이벤트는 시퀀싱과 UI를 구동합니다:

dotLottie.addEventListener("load", () => { /* totalFrames 사용 가능 */ });
dotLottie.addEventListener("complete", () => { /* 비반복 재생 완료 */ });
dotLottie.addEventListener("frame", ({ currentFrame }) => { /* 프레임별 */ });

상태 머신 스타일 (예: "완료" 세그먼트를 재생한 후 대기하는 버튼): 세그먼트 재생, complete 리스닝, 그 후 setSegment로 대기 루프 설정.

스크롤 기반 Lottie (GSAP 불필요)

스크롤 진행률(0–1)을 프레임에 매핑합니다. 자동 재생을 비활성화하고 직접 프레임을 구동합니다.

const dotLottie = new DotLottie({ canvas, src: "/scroll.lottie", autoplay: false });
let total = 0;
dotLottie.addEventListener("load", () => { total = dotLottie.totalFrames; });

window.addEventListener("scroll", () => {
  const el = canvas.closest(".scrolly");
  const rect = el.getBoundingClientRect();
  const p = clamp(-rect.top / (rect.height - window.innerHeight), 0, 1); // 섹션 내 0..1
  dotLottie.setFrame(p * (total - 1));
}, { passive: true });

const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));

더 풍부한 상호작용(호버 시 재생, 클릭 토글, 커서 따라가기)을 위한 배선을 직접 작성하지 않으려면 @lottiefiles/lottie-interactivity를 사용하세요. 이 라이브러리는 scroll, hover, click, play, cursor 모드를 프레임 범위에 선언적으로 매핑합니다.

런타임 테마 / 색상 변경

두 가지 경로:

  • dotLottie 테마: .lottie 파일에 명명된 색상 테마를 포함할 수 있습니다. dotLottie.setTheme("dark") / loadTheme(...)로 전환합니다. LottieFiles 도구에서 제작 — 색상 변경을 위해 재내보낼 필요가 없습니다.
  • 수동 색상 오버라이드: JSON을 로드하고 layers[].shapes[]를 탐색하여 c.k 색상 배열(정규화된 0–1 RGBA)을 패치한 후, 수정된 객체로 플레이어를 초기화합니다. 레이어 구조에 의존하므로 깨지기 쉽습니다. 클래스별로 스타일을 다시 지정해야 하는 경우 테마 또는 CSS 기반 SVG 렌더러(lottie-web rendererSettings)를 선호하세요.

모바일 런타임 (동등함)

  • iOS — lottie-ios (LottieAnimationView): .play(), .currentProgress, .play(fromFrame:toFrame:).
  • Android — lottie-android (LottieAnimationView / Compose LottieAnimation): setMinAndMaxFrame, progress.
  • React Native — lottie-react-native (<LottieView source={...} progress={anim} />, Animated으로 progress 구동).

동일한 .lottie/.json이 모든 플랫폼에서 재생됩니다. 세그먼트 및 진행률 개념은 웹 API와 일치합니다.

최적화

  • 원시 .json 대신 .lottie(압축)를 배포하세요. 화면 밖 플레이어는 지연 로딩하고, 보이지 않을 때 일시정지하세요(IntersectionObserver → play/pause).
  • 여러 애니메이션을 동시에 실행할 때는 캔버스/WASM dotLottie 렌더러를 선호하세요. SVG 렌더러(lottie-web)는 선명한 아이콘 하나에는 괜찮지만, 복잡한 파일에서는 DOM 비용이 더 듭니다.
  • AE 컴포지션을 작게 유지하세요: 적은 레이어/키프레임, 큰 내장 래스터 없음, 가능하면 프리컴포지션 평탄화. 파일 크기는 키프레임 및 경로 복잡성에 비례하며, 지속 시간에는 비례하지 않습니다.
  • 브랜드/테마별 파일을 내보내는 대신 런타임에 색상 변경(테마)을 수행하세요.

전달 및 검증 (단독 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를 참조하세요.

자체 포함 Lottie 데모(반복 일러스트레이션, 애니메이션 아이콘, 빈 상태)의 경우, 전달물은 브라우저에서 직접 열리는 하나의 HTML 파일입니다 — dotLottie/lottie-web 런타임(CDN에서), <canvas>, 그리고 여러분의 .lottie/.json(상대 파일 또는 data URL). 빌드 단계가 없습니다. 하나의 파일이 플레이어를 제공하기에 적절한 수준입니다. 번들러를 찾지 마세요.

출력 계약:

  • 하나의 .html 파일: CDN을 통한 런타임(@lottiefiles/dotlottie-web), 캔버스, autoplay:false (프레임을 직접 제어).
  • 스크린샷을 위해 어떤 프레임이든 고정할 수 있도록 seek 하네스 포함.

Seek 하네스 — 정확한 프레임 고정. ?t=N은 프레임으로 이동하여 그 상태를 유지하므로 스크린샷이 고정된 결정적 프레임에 찍힙니다. Lottie의 재생 헤드는 프레임 단위이므로 프레임에서 직접 멈춥니다:

<script>
  const dl = new DotLottie({ canvas, src: "/icon.lottie", autoplay: false });
  dl.addEventListener("load", () => {
    const t = new URLSearchParams(location.search).get("t");
    if (t !== null) dl.setFrame(parseFloat(t));      // 프레임 N에서 고정 (lottie-web: anim.goToAndStop(N, true))
    else dl.play();
    console.log("totalFrames", dl.totalFrames);       // 종료 프레임 확인용
    window.__ready = true;
  });
</script>

검증 루프 — 렌더링 → 고정 → 스크린샷 → 확인: 첫 프레임, 중간 프레임, 마지막 프레임에서 파일을 열고(?t=0, ?t=<total/2>, ?t=<total-1>; totalFrames는 콘솔에서 확인), 각각 스크린샷을 찍어 충실도(색상/테마 정확, 의도한 세그먼트 루프)와 아티팩트(autoResize/DPR 누락으로 인한 캔버스 흐림, 컴포지션 잘림, 파일 로드 전 FOUC, 버벅임)를 확인하세요. 모든 헤드리스 도구가 작동합니다:

npx playwright screenshot --wait-for-timeout=600 "file://$PWD/lottie.html?t=42" frame-mid.png

마치기 전에:

  1. 단독 실행 — 콘솔 오류 없음, CDN 런타임과 .lottie/.json이 로드됨.
  2. ?t=N (setFrame/goToAndStop)이 올바른 결정적 프레임으로 고정됨.
  3. 첫/중간/마지막 프레임에서 스크린샷 — 요구사항과 일치, 선명함, 잘림 없음.
  4. prefers-reduced-motion 준수 — 루프를 autoplay하지 말고, 정적 프레임을 표시하거나 재생 컨트롤을 제공하세요.
  5. 이징이 의도적임 — 재생 속도/세그먼트가 의도적으로 선택되었으며, AE에서 구운 모션이 설계된 대로 읽힘.

빠른 참조

목표호출
범위 재생setSegment(start, end)
프레임으로 이동setFrame(n)
역방향 / 바운스`setMode("reverse"
스크롤 구동autoplay:false + setFrame(p*totalFrames)
테마 전환setTheme("dark")
길이 확인load 이벤트 후 totalFrames
선언적 상호작용@lottiefiles/lottie-interactivity

참조 파일

  • references/integration-and-export.md — 전체 dotLottie-web + React 설정 및 이벤트/세그먼트 제어, lottie-interactivity 모드 구성, 스크롤/커서 패턴, 런타임 테마 세부 정보, 그리고 After Effects → Bodomovin 내보내기 체크리스트(지원되지 않는 AE 기능 목록 및 해결 방법 포함).

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 "fix janky CSS animation", "make animation 60fps", "stop layout thrashing", "animate width/height/top/left smoothly", "convert animation to transform", "animate box-shadow performantly", "animate height auto", "FLIP animation", or "why is my scroll/hover animation choppy".

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 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.

관련 스킬