Communitygithub.com

접근성 애니메이션 (모션 축소, 계층화)

사용자의 `prefers-reduced-motion` 설정을 존중하여 모든 애니메이션을 완전히 제거하는 대신, 전정기관을 자극하는 위험한 모션만 제거하고 유용한 전환 효과는 유지하는 계층화된 접근 방식을 제공합니다.

접근성 애니메이션 (모션 축소, 계층화)란 무엇인가요?

이 스킬은 웹 UI에서 접근성 있는 애니메이션을 구현하기 위한 실용적인 가이드입니다. `prefers-reduced-motion: reduce` 미디어 쿼리를 단순한 '모든 애니메이션 제거' 스위치가 아닌, 모션을 3단계로 분류하여 처리하는 **점진적 저하(graceful degradation)** 전략으로 사용합니다. Tier 1(전정기관 유발 동작, 예: 패럴랙스, 대규모 슬라이드)은 완전히 제거하고, Tier 2(작은 동작, 예: 밀어넣기 효과)는 짧은 페이드(≤200ms)로 대체하며, Tier 3(필수 동작, 예: 페이드, 포커스 링)은 유지합니다. CSS 미디어 쿼리와 함께 JS 라이브러리(GSAP, Framer Motion, Lenis)에서도 `matchMedia`를 사용하여 동일한 설정을 적용하고, React용 `useReducedMotion` 훅도 제공합니다. 또한 WCAG 2.3.3(AAA), C39 기법, 2.2.2(A) 기준을 충족하며, 최종 검증을 위해 일반 상태와 축소 상태 두 가지를 스크린샷으로 확인하는 방법을 포함합니다. 이는 Claude Code, Cursor, Codex 등 모든 AI 에이전트에서 웹 접근성 감사나 애니메이션 구현 시 참고할 수 있는 표준 기술입니다.

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

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

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

문서

접근성 애니메이션 (모션 축소, 계층화)은(는) 무엇을 하나요?

prefers-reduced-motion: reduce를 킬 스위치가 아닌 점진적 저하로 존중하세요. OS 수준 설정(macOS: 설정 > 손쉬운 사용 > 디스플레이 > 모션 줄이기; Windows: 설정 > 접근성 > 시각 효과 > 애니메이션 효과; iOS/Android 동일)은 전정기관을 자극하는 움직임이 메스꺼움, 어지러움, 편두통을 유발할 수 있음을 알립니다. 올바른 대응은 위험한 움직임을 제거하면서 방향 감각을 유지하는 것입니다.

사용 시기

웹 UI에 애니메이션을 추가하거나 감사할 때, 사용자가 멀미나 WCAG 소견을 보고할 때, 또는 애니메이션 라이브러리(GSAP, Framer Motion, Lenis 부드러운 스크롤, Anime.js, CSS 키프레임)를 접근성 있는 제품에 통합할 때 사용합니다.

핵심 원칙: 모션을 계층화하고, 없애지 마세요

모든 애니메이션을 제거하는 것은 흔한 과잉 교정입니다. 전환 없이 즉시 상태가 변경되면 요소가 순간이동하는 것처럼 느껴져 더 혼란스러울 수 있으며, 유용한 어포던스(포커스 링, 진행 상황을 알리는 로딩 스피너)가 사라집니다. 모든 애니메이션을 세 가지 계층으로 분류하세요:

  • Tier 1 — 완전히 제거 (전정기관 유발). 패럴랙스; 뷰포트를 가로지르는 대규모 슬라이드/이동; 큰 요소의 크기 조정/확대; 3D 회전 및 회전; 연속 자동 재생 캐러셀 및 마키; 부드러운 스크롤 하이재킹(Lenis/Locomotive); 스크롤 잠금 고정 장면; 모션 경로 애니메이션; 화면의 큰 부분을 움직이거나 깊이/자기 운동을 암시하는 모든 것.
  • Tier 2 — 부드럽게 / 단축. 움직임을 짧은 불투명도 페이드(≤200ms)로 대체합니다. 거리와 지속 시간을 줄입니다. 전환의 사실은 유지(요소가 순간이동하지 않도록)하지만 변위는 제거합니다. 600ms 왼쪽에서 슬라이드 인을 150ms 크로스페이드로 대체합니다.
  • Tier 3 — 항상 유지. 불투명도 페이드, 색상/배경 전환, 포커스 링 전환, 로딩 표시기, 그리고 의미에 필수적인 움직임(WCAG는 필수 애니메이션 허용). 이는 자기 운동을 암시하지 않기 때문에 거의 전정기관 반응을 유발하지 않습니다.

CSS 계층: 미디어 쿼리 게이팅

모션을 기본값으로 작성한 다음, 축소 쿼리 아래에서 재정의합니다. 전역 안전망과 대상 재정의를 선호합니다.

/* 전역 안전망: 폭주하는 모션을 중화하지만 맹목적으로 0s로 설정하지 마세요.
   transitionend/animationend를 기다리는 JS가 손상될 수 있습니다. 0.01ms를 사용하세요. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;   /* 무한 회전/마키 중지 */
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;          /* 부드러운 스크롤 제거 */
  }
}

전역 네트는 백스톱입니다. 그 위에 의도적이고 계층화된 재정의를 적용하여 Tier 3 모션이 유지되도록 합니다:

.card {
  transition: transform 400ms ease, opacity 400ms ease, background-color 200ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .card {
    /* Tier 2: transform(움직임) 제거, opacity + color(Tier 3) 유지 */
    transition: opacity 150ms ease, background-color 150ms ease;
  }
  .parallax-layer { transform: none !important; }        /* Tier 1: 제거 */
  .hero-zoom      { animation: none !important; }        /* Tier 1: 제거 */
}

긍정 쿼리 (prefers-reduced-motion: no-preference)를 사용하여 모션을 IN으로 선택하는 것이 정교한 효과에 가장 안전한 패턴입니다:

.hero { opacity: 1; } /* 기본적으로 보이는 정적 상태 */
@media (prefers-reduced-motion: no-preference) {
  .hero { animation: zoom-in 1.2s ease both; } /* 허용될 때만 애니메이션 적용 */
}

JS 계층: matchMedia 게이팅

CSS는 JS 기반 애니메이션(GSAP 타임라인, Framer의 animate, 캔버스/WebGL, Lenis)을 게이트할 수 없습니다. matchMedia를 통해 동일한 신호를 읽고 실시간 변경에 반응합니다(사용자가 새로고침 없이 OS 설정을 전환).

const REDUCE_QUERY = '(prefers-reduced-motion: reduce)';

export function prefersReducedMotion() {
  return typeof window !== 'undefined'
    && window.matchMedia
    && window.matchMedia(REDUCE_QUERY).matches;
}

// 실시간 업데이트: OS 설정 전환이 즉시 적용되도록 수신합니다.
export function onReducedMotionChange(cb) {
  const mq = window.matchMedia(REDUCE_QUERY);
  const handler = (e) => cb(e.matches);
  mq.addEventListener('change', handler);          // 최신 API
  return () => mq.removeEventListener('change', handler);
}

라이브러리 게이팅, 재사용 가능한 단일 계층으로 적용

// GSAP — matchMedia() 사용: GSAP는 변경 시 조건부 설정을 되돌립니다.
import gsap from 'gsap';
const mm = gsap.matchMedia();
mm.add({
  motionOK: '(prefers-reduced-motion: no-preference)',
  motionReduce: '(prefers-reduced-motion: reduce)',
}, (ctx) => {
  const { motionOK } = ctx.conditions;
  if (motionOK) {
    gsap.from('.hero', { y: 80, opacity: 0, duration: 1 });   // Tier 1 이동
  } else {
    gsap.from('.hero', { opacity: 0, duration: 0.15 });        // Tier 2 페이드
  }
});

// Lenis 부드러운 스크롤 — 축소된 경우 아예 인스턴스화하지 않습니다.
import Lenis from 'lenis';
let lenis = null;
if (!prefersReducedMotion()) {
  lenis = new Lenis();
  const raf = (t) => { lenis.raf(t); requestAnimationFrame(raf); };
  requestAnimationFrame(raf);
}

React: useReducedMotion 훅

import { useState, useEffect } from 'react';

export function useReducedMotion() {
  const query = '(prefers-reduced-motion: reduce)';
  const get = () =>
    typeof window !== 'undefined' && window.matchMedia
      ? window.matchMedia(query).matches
      : false;
  const [reduced, setReduced] = useState(get);

  useEffect(() => {
    const mq = window.matchMedia(query);
    const onChange = () => setReduced(mq.matches);
    onChange();                                   // 하이드레이션 후 동기화
    mq.addEventListener('change', onChange);
    return () => mq.removeEventListener('change', onChange);
  }, []);

  return reduced;
}
// Framer Motion에는 자체 useReducedMotion()이 있습니다. 위의 훅도 작동합니다.
import { motion } from 'framer-motion';
function Card() {
  const reduced = useReducedMotion();
  return (
    <motion.div
      initial={reduced ? { opacity: 0 } : { opacity: 0, y: 40 }}
      animate={{ opacity: 1, y: 0 }}
      transition={{ duration: reduced ? 0.15 : 0.5 }}
    />
  );
}

SSR 렌더링 상태를 false(모션)로 초기화하고 useEffect에서 다시 동기화하여 하이드레이션 불일치를 방지합니다. OS 값은 클라이언트 측에서만 알 수 있습니다.

WCAG 매핑

  • 2.3.3 상호작용으로 인한 애니메이션 (AAA). 상호작용(스크롤, 호버)으로 트리거되는 모션은 필수가 아닌 경우 비활성화할 수 있어야 합니다. prefers-reduced-motion을 존중하는 것이 표준 기술입니다.
  • C39 (CSS 기술). prefers-reduced-motion 쿼리를 사용하여 모션을 방지합니다. 이것은 명명된 충분 기술입니다.
  • 2.2.2 일시 정지, 중지, 숨김 (A). 5초 이상 지속되는 자동 재생 모션은 일시 정지/중지 컨트롤을 제공해야 합니다. 자동 캐러셀과 마키는 미디어 쿼리와 관계없이 이 기준을 충족하지 못합니다. 컨트롤을 제공하세요.

전달 및 확인 (독립형 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(GSAP/matchMedia CDN)가 인라인으로 포함되며 빌드 단계가 없습니다. 이 스킬의 경우 확인이 핵심입니다. 일반 모션 경로와 축소 모션 경로 모두를 스크린샷으로 촬영하고 계층화가 올바른지 확인해야 합니다.

출력 계약:

  • 전체 모션과 계층화된 축소 모션 재정의(CSS 쿼리 + JS 기반 모션을 위한 matchMedia/gsap.matchMedia())가 포함된 하나의 .html 파일.
  • 프레임을 고정하는 탐색 하네스와 스크린샷을 위해 축소 모션 코드 경로를 강제하는 방법.

탐색 하네스 — 프레임 고정, 기본 설정 강제. ?t=N은 타임라인을 고정합니다. ?reduce=1은 OS 설정이 꺼져 있어도 축소 경로를 강제합니다(CSS는 JS에서 토글할 수 없으므로, JS를 게이트하는 동일한 플래그를 쿼리하고 CSS 계층에 대해 OS/브라우저 기본 설정을 에뮬레이트하여 스크린샷을 촬영합니다):

<script>
  const q = new URLSearchParams(location.search);
  const reduce = q.get("reduce") === "1"
    || window.matchMedia("(prefers-reduced-motion: reduce)").matches;
  // `reduce`에 따라 조건부로 모션 빌드 (Tier-1 제거, Tier-2 부드럽게, Tier-3 유지)
  const t = q.get("t");
  if (t !== null) { tl.pause(); tl.seek(parseFloat(t)); }      // GSAP; CSS: el.style.animationDelay=(-t)+"s"; playState="paused"
  window.__ready = true;
</script>

확인 루프 — 두 상태 모두 스크린샷: 일반 경로와 축소 경로를 각각 애니메이션 중간에 캡처하고 Tier-1 모션이 사라졌는지, Tier-2가 짧은 페이드인지, Tier-3이 유지되는지 확인합니다. CSS 계층에 대한 기본 설정을 에뮬레이트합니다(Playwright --reduced-motion=reduce; 에이전트의 브라우저 도구도 이를 에뮬레이트할 수 있습니다):

npx playwright screenshot --wait-for-timeout=500 "file://$PWD/demo.html?t=0.6" normal.png
npx playwright screenshot --reduced-motion=reduce --wait-for-timeout=500 "file://$PWD/demo.html?t=0.6&reduce=1" reduced.png

완료하기 전에:

  1. 독립형으로 열림 — 콘솔 오류 없음, CDN(있는 경우) 로드.
  2. 고정 + ?reduce=1 (및 --reduced-motion=reduce)이 두 코드 경로를 안정적으로 실행합니다.
  3. 애니메이션 중간에 두 상태 모두 스크린샷 촬영 — 일반 상태는 의도적으로 보이고, 축소 상태는 Tier-1을 제거하고 Tier-2를 부드럽게 합니다.
  4. prefers-reduced-motion이 킬 스위치가 아닌 계층화로 존중됨 — 순간이동 없음, Tier-3 페이드/포커스 링/스피너 유지; 5초 이상 자동 모션은 여전히 일시 정지 컨트롤 (2.2.2) 보유.
  5. 두 경로 모두에서 이징이 의도적임 — 우발적인 linear 없음, 지속 시간이 적절함(축소 페이드 ≤200ms, 0.01ms가 0s가 아님).

빠른 참조

모션 유형계층축소 시 동작
패럴랙스 / 깊이1제거 (transform: none)
대규모 슬라이드 / 이동1제거 또는 페이드로 대체
크기 조정 / 확대 (대규모)1제거
회전 / 3D 회전1제거 (animation: none)
자동 캐러셀 / 마키1중지 + 일시 정지 컨트롤 제공 (2.2.2)
부드러운 스크롤 (Lenis)1인스턴스화하지 않음
작은 슬라이드 / 팝인2크로스페이드 ≤200ms
불투명도 페이드3유지 (길면 단축)
색상 / 포커스 링 전환3유지
로딩 스피너3유지 (필수 피드백)

주의 사항

  • animation-duration: 0s는 animationend/transitionend를 기다리는 코드를 중단시킬 수 있습니다. 이벤트가 여전히 발생하도록 0.01ms를 사용하세요.
  • 전역 * 재설정만으로는 Tier 3 모션이 과도하게 제거됩니다. 항상 의도적인 재정의를 계층화하세요.
  • animation-iteration-count: 1을 잊어버리면 거의 0에 가까운 지속 시간으로 무한 회전이 실행됩니다(CPU 소모, 여전히 애니메이션 중).
  • 미디어 쿼리는 JS/캔버스/WebGL을 다루지 않습니다. matchMedia로 게이트하거나 루프가 멈추지 않습니다.
  • OS 설정을 전환해도 페이지가 다시 로드되지 않습니다. change 리스너가 없으면 페이지는 오래된 상태를 유지합니다.
  • SSR: 렌더링 중 matchMedia를 읽으면 오류가 발생하거나 불일치가 발생합니다. 모션을 기본값으로 설정하고 effect에서 동기화하세요.
  • 자동 재생 모션은 축소 모션이 꺼져 있을 때도 눈에 보이는 일시 정지 컨트롤이 필요합니다(2.2.2는 Level A).

참조 파일

  • references/patterns.md — 전체 GSAP matchMedia 분해, Framer Motion MotionConfig, 실시간 전환 시 Lenis 시작/중지, 재사용 가능한 animateWithMotionPreference 래퍼, 일시 정지 컨트롤이 있는 마키, 계층 분류 감사 체크리스트.

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

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.

관련 스킬