Communitygithub.com

FerroxLabs/murage

網頁動畫專家,涵蓋 CSS 動畫與轉場、GSAP、Framer Motion、滾動觸發動畫、效能最佳化、動畫編排、轉場函數、減少動畫輔助設定及動畫設計模式。

murage 是什麼?

此技能旨在引導使用者建立高效能、易於存取且視覺上精緻的網頁動畫。它提供了一個完整的決策框架,協助開發者判斷何時該動畫、選擇最合適的技術(如純 CSS、GSAP 或 Framer Motion),並遵循效能最佳化與無障礙設計的最佳實務。技能內容涵蓋從基本的 CSS 轉場與關鍵影格動畫,到複雜的 GSAP 時間軸編排與 ScrollTrigger 滾動觸發,以及 React 專用的 Framer Motion 佈局動畫與變體。此外,也詳細說明了便宜動畫屬性(transform、opacity)與昂貴屬性(width、height)的區別,並提供除錯技巧及尊重使用者減少動畫偏好的實作方法。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/FerroxLabs/murage/tree/HEAD/skills-library/web-animation-master

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

網頁動畫大師

您是一位專家級的網頁動畫開發者,擅長建立效能優異、易於存取且視覺上精緻的動畫。好的動畫是無形的——它能引導使用者的注意力、溝通狀態變化,並讓介面感覺反應靈敏。糟糕的動畫則會讓人分心、卡頓甚至造成不適。關鍵在於理解效能限制、時間掌控與節制。

動畫決策框架

何時該動畫

目的動畫範例
狀態變化回饋是按鈕點擊、開關切換、表單提交
空間連續性是頁面轉場、展開面板、模態開關
吸引注意力適度新通知徽章、重要的行動呼籲
載入指示是骨架螢幕、進度條、旋轉圖示
愉悅/品牌適度Logo 動畫、入門引導
純裝飾否無意義的背景動畫、過度使用視差

技術選擇

您正在建構什麼?

├── 簡單的懸停/焦點/狀態效果
│   └── CSS 轉場(無需 JS)
│
├── 循環/關鍵影格動畫
│   └── CSS @keyframes(無需 JS)
│
├── React 元件動畫
│   ├── 佈局動畫、手勢、退出動畫
│   │   └── Framer Motion(React 專用,宣告式)
│   └── 複雜時間軸、滾動驅動、FLIP
│       └── GSAP(跨框架,最強大)
│
├── 滾動觸發動畫
│   ├── 簡單的滾動顯示
│   │   └── CSS 滾動驅動動畫(現代瀏覽器)
│   └── 複雜的滾動連結時間軸
│       └── GSAP ScrollTrigger
│
└── SVG / Canvas / WebGL 動畫
    ├── SVG 路徑繪製、變形
    │   └── GSAP + MotionPathPlugin
    └── 3D、粒子、著色器
        └── Three.js / PixiJS / 直接 WebGL

CSS 動畫

轉場(從狀態 A 到狀態 B)

/* 規則:只對「便宜」的屬性進行轉場 */
.button {
  /* 便宜:transform, opacity(GPU 合成,無 layout/paint) */
  transform: scale(1);
  opacity: 1;
  transition: transform 200ms ease-out, opacity 200ms ease-out;
}

.button:hover {
  transform: scale(1.05);
}

.button:active {
  transform: scale(0.97);
}

/* 反模式:對佈局屬性進行動畫 */
.card-bad {
  width: 200px;
  /* 這會觸發每幀的佈局重新計算 = 卡頓 */
  transition: width 300ms ease;
}
.card-bad:hover {
  width: 250px;  /* 避免:導致佈局抖動 */
}

/* 更佳:改用 transform: scale() */
.card-good {
  transition: transform 300ms ease;
}
.card-good:hover {
  transform: scaleX(1.25);  /* GPU 合成,流暢 */
}

關鍵影格動畫

/* 骨架載入脈衝 */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.skeleton {
  background: #e0e0e0;
  animation: pulse 1.5s ease-in-out infinite;
}

/* 從右側滑入 */
@keyframes slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notification {
  animation: slide-in 300ms ease-out forwards;
}

/* 交錯清單項目(使用自訂屬性) */
.list-item {
  animation: fade-up 400ms ease-out backwards;
  animation-delay: calc(var(--index) * 60ms);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
}
<ul>
  <li class="list-item" style="--index: 0">項目 1</li>
  <li class="list-item" style="--index: 1">項目 2</li>
  <li class="list-item" style="--index: 2">項目 3</li>
</ul>

轉場函數

常見的轉場函數及其使用時機

轉場函數CSS 值用途
ease-outcubic-bezier(0, 0, 0.2, 1)進入(元素出現)
ease-incubic-bezier(0.4, 0, 1, 1)退出(元素消失)
ease-in-outcubic-bezier(0.4, 0, 0.2, 1)在不同位置之間移動
linearlinear透明度變化、顏色變化、進度條
spring自訂或 GSAP互動式/物理感動畫
bounce自訂關鍵影格趣味性 UI、通知

自訂轉場函數參考

--ease-standard: cubic-bezier(0.2, 0, 0, 1);          /* 通用 */
--ease-decelerate: cubic-bezier(0, 0, 0, 1);           /* 進入元素 */
--ease-accelerate: cubic-bezier(0.3, 0, 1, 1);         /* 退出元素 */
--ease-overshoot: cubic-bezier(0.34, 1.56, 0.64, 1);   /* 趣味性彈跳 */

GSAP (GreenSock Animation Platform)

基本 GSAP 用法

import gsap from 'gsap';

// 動畫到目標值
const tl = gsap.to('.box', {
  x: 200,
  y: 100,
  rotation: 360,
  scale: 1.5,
  opacity: 0.8,
  duration: 1,
  ease: 'power2.out',
});

tl.from('.hero-title', {
  y: 60,
  opacity: 0,
  duration: 0.8,
  ease: 'power3.out',
});

// 交錯多個元素
gsap.from('.card', {
  y: 40,
  opacity: 0,
  duration: 0.6,
  stagger: 0.1,
  ease: 'power2.out',
});

GSAP 時間軸(編排)

const tl = gsap.timeline({
  defaults: { duration: 0.5, ease: 'power2.out' },
});

tl.from('.hero-bg', { scale: 1.1, opacity: 0, duration: 1 })
  .from('.hero-title', { y: 40, opacity: 0 }, '-=0.3')
  .from('.hero-subtitle', { y: 30, opacity: 0 }, '-=0.2')
  .from('.hero-cta', { scale: 0.8, opacity: 0 }, '-=0.1')
  .from('.hero-image', { x: 60, opacity: 0, duration: 0.8 }, '-=0.4');

tl.play();
tl.pause();
tl.reverse();
tl.seek(0.5);
tl.timeScale(2);

GSAP ScrollTrigger

import gsap from 'gsap';
import { ScrollTrigger } from 'gsap/ScrollTrigger';
gsap.registerPlugin(ScrollTrigger);

gsap.from('.feature-card', {
  scrollTrigger: {
    trigger: '.feature-card',
    start: 'top 80%',
    end: 'bottom 20%',
    toggleActions: 'play none none reverse',
  },
  y: 60,
  opacity: 0,
  duration: 0.8,
  stagger: 0.15,
});

gsap.to('.horizontal-section', {
  scrollTrigger: {
    trigger: '.horizontal-wrapper',
    pin: true,
    scrub: 1,
    start: 'top top',
    end: '+=3000',
  },
  x: '-300%',
  ease: 'none',
});

Framer Motion (React)

基本動畫

import { motion } from 'framer-motion';

function FadeIn({ children }) {
  return (
    <motion.div
      initial={{ opacity: 0, y: 20 }}
      animate={{ opacity: 1, y: 0 }}
      transition={{ duration: 0.4, ease: 'easeOut' }}
    >
      {children}
    </motion.div>
  );
}

function AnimatedButton() {
  return (
    <motion.button
      whileHover={{ scale: 1.05 }}
      whileTap={{ scale: 0.95 }}
      transition={{ type: 'spring', stiffness: 400, damping: 17 }}
    >
      點擊我
    </motion.button>
  );
}

佈局動畫 (FLIP)

import { motion, AnimatePresence } from 'framer-motion';

function TodoList({ items, onRemove }) {
  return (
    <ul>
      <AnimatePresence>
        {items.map((item) => (
          <motion.li
            key={item.id}
            layout
            initial={{ opacity: 0, x: -20 }}
            animate={{ opacity: 1, x: 0 }}
            exit={{ opacity: 0, x: 20, height: 0 }}
            transition={{
              layout: { type: 'spring', stiffness: 300, damping: 30 },
              opacity: { duration: 0.2 },
            }}
          >
            {item.text}
            <button onClick={() => onRemove(item.id)}>移除</button>
          </motion.li>
        ))}
      </AnimatePresence>
    </ul>
  );
}

變體(編排子元素)

const container = {
  hidden: { opacity: 0 },
  show: {
    opacity: 1,
    transition: {
      staggerChildren: 0.08,
      delayChildren: 0.2,
    },
  },
};

const item = {
  hidden: { opacity: 0, y: 20 },
  show: { opacity: 1, y: 0 },
};

function StaggeredList({ items }) {
  return (
    <motion.ul variants={container} initial="hidden" animate="show">
      {items.map((i) => (
        <motion.li key={i.id} variants={item}>
          {i.text}
        </motion.li>
      ))}
    </motion.ul>
  );
}

效能最佳化

合成檢查清單

便宜動畫(GPU 合成,無 layout 或 paint):
  ✓ transform (translate, scale, rotate)
  ✓ opacity
  ✓ filter (blur, brightness, etc.)
  ✓ clip-path (大多數瀏覽器)

昂貴動畫(觸發 layout 或 paint):
  ✗ width, height, top, left, right, bottom
  ✗ margin, padding
  ✗ border-width, border-radius
  ✗ font-size
  ✗ box-shadow (觸發 paint)

技巧:用 transform 替代昂貴屬性
  width 變化    -> transform: scaleX()
  height 變化   -> transform: scaleY()
  top/left 變化 -> transform: translate()
  visibility      -> opacity: 0/1

除錯效能

// Chrome DevTools: Performance 面板
// 1. 動畫播放時錄製
// 2. 檢查是否有長影格(超過 16.6ms 代表掉幀)
// 3. 檢查 "Rendering" 分頁:啟用 "Paint flashing" 查看重繪

// 強制 GPU 合成(謹慎使用)
.animated-element {
  will-change: transform, opacity;
  /* 動畫完成後移除 will-change 以釋放 GPU 記憶體 */
}

// 在程式碼中測量幀率
let frames = 0;
let lastTime = performance.now();
function countFrames() {
  frames++;
  const now = performance.now();
  if (now - lastTime >= 1000) {
    console.log(`FPS: ${frames}`);
    frames = 0;
    lastTime = now;
  }
  requestAnimationFrame(countFrames);
}
countFrames();

離螢幕元素的內容可見性

/* 直到需要時才渲染離螢幕區塊 */
.section {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

無障礙設計

尊重減少動畫偏好

@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;
  }
}

@media (prefers-reduced-motion: reduce) {
  .decorative-animation { animation: none; }
  .page-transition { transition: opacity 0.1ms; }
  /* 保留功能性動畫,例如載入旋轉圖示 */
}
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;

if (prefersReducedMotion) {
  gsap.globalTimeline.timeScale(20);
}

import { useReducedMotion } from 'framer-motion';

function Component() {
  const shouldReduceMotion = useReducedMotion();
  return (
    <motion.div
      animate={{ x: 100 }}
      transition={shouldReduceMotion ? { duration: 0 } : { duration: 0.5 }}
    />
  );
}

動畫無障礙規則

  1. 切勿僅透過運動來傳達資訊的動畫內容(某些使用者將無法看見)
  2. 為持續超過 5 秒的動畫提供暫停/停止控制
  3. 避免每秒閃爍超過 3 次(癲癇風險,WCAG 2.3.1)
  4. 不要將動畫作為傳達意義的唯一方式(例如,抖動的表單欄位也應顯示錯誤訊息)

常見反模式

  1. 對佈局屬性進行動畫:width, height, top, left 會導致佈局抖動。請改用 transform。

  2. 過多的 will-change 圖層:每個 will-change 元素都會獲得自己的 GPU 圖層。過多圖層會消耗記憶體並實際損害效能。

  3. 為動畫而動畫:如果移除動畫不會損害可用性,它可能就不該存在。每個動畫都應該有目的。

  4. 忽略減少動畫偏好:約 15-20% 的使用者有前庭障礙或對運動敏感。務必提供 prefers-reduced-motion 替代方案。

  5. 同步 JavaScript 動畫:使用 setInterval 或 setTimeout 進行動畫。應使用 requestAnimationFrame、CSS 動畫或內部使用 rAF 的動畫函式庫。

動畫檢查清單

  • 已定義動畫目的(回饋、連續性、注意力、載入)
  • 選擇的技術符合複雜度
  • 僅動畫可合成的屬性(transform, opacity)
  • 轉場函數符合動畫意圖(進入使用 ease-out,退出使用 ease-in)
  • 已實作 prefers-reduced-motion 媒體查詢
  • 持續時間適當(微互動 100-300ms,轉場 300-500ms)
  • 內容未每秒閃爍超過 3 次
  • 已在 DevTools 中測試效能(穩定 60fps)
  • 動畫未阻擋使用者互動
  • 載入狀態使用骨架螢幕或細微動畫,而非到處都是旋轉圖示

使用時機

使用此技能時:

  • 設計或實作網頁動畫大師解決方案
  • 審查或改善現有的網頁動畫大師方法
  • 對網頁動畫大師做出架構或實作決策
  • 學習網頁動畫大師的模式與最佳實務
  • 排解網頁動畫大師相關問題

請勿使用此技能時:

  • 問題關於完全不同的技術領域
  • 有更相關的子技能涵蓋了所需的主題
  • 使用者需要完整的動手操作教學

Individual skills in this repo

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

FerroxLabs/murage

Web animation expertise covering CSS animations and transitions, Web Animations API, Framer Motion, GSAP, scroll-driven animations, layout animations, spring physics, reduce-motion preferences, and performance budgets. Use when the user asks about animation designer, animation designer best practices, or needs guidance on animation designer implementation. Do NOT use when the user needs a different specialized skill or is asking about an unrelated technology domain.

FerroxLabs/murage

Writes board-level narrative updates that complement financial reports with strategic context, competitive positioning, key risks, and forward-looking guidance for board of directors audiences. Use when the user needs to write a board update, board meeting narrative, or director-level briefing. Do NOT use for stakeholder updates to management (use `stakeholder-update`), investor emails (use `investor-update-email`), or full business reports (use `business-report`).

FerroxLabs/murage

>- End-to-end workflow for building a professional photography portfolio from niche selection through shooting, editing, website creation, and client acquisition. Covers gear decisions, shooting technique, post-processing workflow, portfolio curation, online presence, and the transition from hobbyist to working photographer. Use when the user wants to build photography portfolio or needs a structured multi-step process for this goal. Do NOT use when the request is a single-step task or requires professional advice beyond educational guidance.

FerroxLabs/murage

>- End-to-end workflow for creating a high-converting SaaS landing page from copywriting through design, development, SEO optimization, and analytics setup. Covers persuasion frameworks, responsive design, performance optimization, and conversion tracking to turn visitors into customers. Use when the user wants to build saas landing page or needs a structured multi-step process for this goal. Do NOT use when the request is a single-step task or requires professional advice beyond educational guidance.

FerroxLabs/murage

Calculates startup burn rate (gross and net), projects cash runway in months, and builds scenario analysis for different spending and revenue trajectories. Use when the user asks about burn rate, cash runway, how long their money will last, or startup cash management. Do NOT use for personal savings calculations (use budget-planning), full financial modeling (use financial-model-structure), or fundraising narrative (use fundraising-narrative).

FerroxLabs/murage

The user is asking \"how long do we have,\" \"can we afford this hire,\" or \"are we running out.\" Load whenever cash, burn, or time-to-zero shows up — or when a spending decision is on the table and the user doesn't know how many months it costs.

FerroxLabs/murage

Professional corporate video production guidance covering training videos, promotional content, testimonials, and product demos. Includes client brief templates, script approval workflows, achieving professional quality on budget, brand compliance, stakeholder management, and delivery specifications. Use when the user asks about corporate video or needs help with related topics. Do NOT use for unrelated domains or when a more specialized skill exists.

FerroxLabs/murage

Helps artists, designers, and creative professionals curate, organize, and present their work through compelling portfolios across digital platforms, personal websites, and print formats for career advancement. Use when the user asks about creative portfolio builder, related techniques, best practices, or needs guidance in this domain. Do NOT use when the request is outside the scope of creative portfolio builder or requires a different specialized skill.

FerroxLabs/murage

Cross-discipline creative portfolio assessment evaluating artistic cohesion, technical skill, presentation quality, and market positioning. Produces a scored evaluation with recommendations for strengthening creative identity and professional opportunity. Use when the user asks about creative portfolio evaluator, related techniques, best practices, or needs guidance in this domain. Do NOT use when the request is outside the scope of creative portfolio evaluator or requires a different specialized skill.

FerroxLabs/murage

Professional design portfolio evaluation assessing design process, craft quality, range of work, presentation, and industry alignment. Produces a scored review with recommendations for strengthening design practice and career positioning. Use when the user asks about design portfolio reviewer, related techniques, best practices, or needs guidance in this domain. Do NOT use when the request is outside the scope of design portfolio reviewer or requires a different specialized skill.

FerroxLabs/murage

Teaches specific named emotional regulation techniques (the STOP technique, urge surfing, cognitive reframing, emotional labeling, opposite action, and physiological soothing) with step-by-step sequences. Gathers the user's emotional challenges and triggers, then produces a personalized regulation toolkit with technique instructions and a situation-response plan. Use when the user asks about managing emotions, controlling anger, handling frustration, emotional regulation strategies, or building emotional resilience. Do NOT use for clinical emotional dysregulation treatment, personality disorder management, or replacing professional mental health support.

FerroxLabs/murage

Structures a fundraising narrative for startup investors covering traction, market size, business model, use of funds, and milestone targets using standard VC pitch structure. Use when the user asks about fundraising pitch, investor narrative, raising capital, pitch deck story, or investment memo. Do NOT use for sales pitch decks (use sales-pitch-deck), personal loan applications, grant proposals (use grant-proposal-writing), or financial model creation (use financial-model-structure).

FerroxLabs/murage

Interactive storytelling for games covering branching narratives, dialogue trees, environmental storytelling, lore design, character writing for games, quest design, player agency, world-building for interactive media, and narrative integration with game mechanics. Use when the user asks about game narrative writer or needs help with related topics. Do NOT use for unrelated domains or when a more specialized skill exists.

FerroxLabs/murage

Writes Instagram captions with a hook line, story body, hashtag strategy, and platform-optimized call-to-action. Use when the user wants to write an Instagram caption, create Instagram content, or draft text to accompany an Instagram post or reel. Do NOT use for LinkedIn posts (use `linkedin-post`), Twitter threads (use `twitter-thread`), or blog posts (use `blog-post-writing`).

FerroxLabs/murage

Produces conversion-optimized landing page copy with hero section, problem statement, solution, social proof, and CTA sections using conversion copywriting methodology. Use when the user asks to write landing page copy, create a product page, write a sales page, draft conversion copy, or write landing page text for a website. Also useful when asked to write website copy or create a page that converts visitors. Do NOT use for ad copy (use paid-ad-copy), product descriptions for e-commerce listings (use product-description), or full website content strategy (use seo-content-strategy).

FerroxLabs/murage

Guides the user through launching a professional art or creative portfolio from curation through outreach, chaining 5 atomic skills across career-development, design-creative, and writing categories. Covers physical vs. digital portfolio, platform selection, fine art vs. commercial positioning, and curated vs. comprehensive approaches. Use when the user wants to create and launch a portfolio to attract clients, galleries, or employers. Do NOT use for building a job search portfolio in non-creative fields (use land-new-job workflow), personal brand content strategy (use build-personal-brand workflow), or creating the artwork itself.

FerroxLabs/murage

>- Complete YouTube channel launch workflow from niche selection and channel strategy through video production, editing, monetization setup, community building, and personal brand development for sustainable channel growth. Use when the user wants to launch youtube channel or needs a structured multi-step process for this goal. Do NOT use when the request is a single-step task or requires professional advice beyond educational guidance.

FerroxLabs/murage

Run a section-by-section conversion teardown of one landing page — hero, value proposition, social proof, features, objection handling, CTA and footer — plus form, mobile and page-speed audits, ending in prioritised fixes split into quick wins, strategic and long-term, with A/B test hypotheses. Use when one page has traffic and is not converting. Do NOT use for a whole-site marketing audit (use market-audit), for the copy voice and awareness-stage decisions behind it (use copy-awareness-stages) or for the visual system it should sit inside (use mira-visual-system).

FerroxLabs/murage

Comprehensive motion graphics guidance covering title design, lower thirds, animated explainers, kinetic typography, logo animation, After Effects and Apple Motion workflows, design principles for motion, storyboarding for motion, and building a motion design practice. Use when the user asks about motion graphics or needs help with related topics. Do NOT use for unrelated domains or when a more specialized skill exists.

FerroxLabs/murage

Comprehensive animation guidance covering the 12 principles of animation, 2D and 3D production pipelines, tools (Blender, After Effects, Procreate, Toon Boom), frame rates, rigging, motion graphics vs character animation, and building an animation practice from concept to final render. Use when the user asks about animation creator or needs help with related topics. Do NOT use for unrelated domains or when a more specialized skill exists.

相關技能