Communitygithub.com

hanimaru1121/animation-implementer

此技能用於將 `ui-microinteraction-designer` 產生的互動規格實際接線到運行的實作中,根據每個規格選擇最適合的函式庫(簡單懸停用 Vanilla CSS、複雜滾動編舞用 GSAP、進入視口顯現用 AOS、React 用 Framer Motion),並始終尊重 `prefers-reduced-motion`,且將動畫限制在 `transform`/`opacity` 以達到 60fps。

animation-implementer 是什麼?

Animation-Implementer 是介於設計規格與實際動畫實作之間的橋樑技能。它接受 `ui-microinteraction-designer` 產生的 `interactions.json` 作為輸入,其中定義了每個互動(例如 hover-lift、scroll-reveal、parallax、counter、stagger 等)的目標元素、類型、建議函式庫與動作參數。 此技能會智慧選擇最適合的動畫函式庫:簡單的 hover/focus 效果使用零依賴的 Vanilla CSS;進入視口的顯現效果使用輕量的 AOS;複雜的滾動編舞或時間軸編排使用功能強大的 GSAP;在 Next.js 路徑中,React Client Component 則使用 Framer Motion,以與元件生命週期整合。 此技能支援 HTML 與 Next.js 兩種實作平台,並在實作過程中嚴格執行兩項非妥協的品質要求:(1) 所有動畫僅使用 `transform` 和 `opacity` 屬性,以確保 GPU 合成且維持 60fps;(2) 全面尊重使用者的 `prefers-reduced-motion` 偏好設定,透過 Tailwind 的 `motion-reduce:` 變體、JS 的媒體查詢檢查、以及 Framer Motion 的 `useReducedMotion()` 鉤子來實現,以避免引發前庭障礙使用者的不適。 執行完成後,它會產生一份詳細的動畫實作報告 (`animation-report.json`),記錄每個互動的實作狀態、使用的函式庫、是否僅使用可合成屬性、以及是否尊重減少動作偏好,並提供任何替代決策的警告。

相容平台✓Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/hanimaru1121/claude-skills/tree/HEAD/plugins/lp-maker/skills/animation-implementer

在你喜歡的 AI 中提問

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

說明文件

animation-implementer 是做什麼的?

此技能是意圖與動作之間的橋樑。ui-microinteraction-designer 為每個互動產生了規格——hover-lift、scroll-reveal、parallax、counter、stagger、magnetic button、marquee 等——並附帶動作參數(duration、easing、distance、trigger)。lp-coder-html / lp-coder-nextjs 已提供基礎的 JS 實作,但僅涵蓋最簡單的互動;複雜的編舞需要真正的函式庫。此技能會根據每個規格選擇正確的函式庫、實作每個項目,並確認頁面依然尊重 prefers-reduced-motion,且僅對 transform/opacity 進行動畫(這是 GPU 無需重新計算版面就能合成的唯二兩個 CSS 屬性——對 width、height、top、left、margin 進行動畫會在每一影格觸發 reflow,嚴重拖慢 fps)。

選擇函式庫:Vanilla CSS 用於 hover/focus 和簡單的轉場(零依賴,最快)、AOS 用於簡單的「區塊進入視口時淡入」(約 3KB,安裝簡單)、GSAP 用於複雜的滾動編舞或時間軸編排(最強大,約 30KB,但必要時值得)、Framer Motion 用於 Next.js 路徑中的 React Client Component(宣告式,能與 React 狀態整合,約 50KB,但對於尊重元件生命週期的 React 動畫是必需的)。

何時使用此技能

當以下情況發生時,執行此技能:

  • lp-workspace/03-design/interactions.json 存在
  • 實作存在於 lp-workspace/04-implementation/html/ 或 nextjs/
  • 編排器在 lp-coder-* 之後達到 Tier 4
  • 使用者說出「アニメーション実装して」/「wire up animations」/「GSAP入れて」/「scroll reveal を動かして」

當以下情況發生時,請勿使用此技能:

  • interactions.json 不存在——請先導向 ui-microinteraction-designer
  • 實作不存在——請先導向 lp-coder-*
  • 使用者想要設計新的互動(那是 ui-microinteraction-designer 的事)
  • 使用者只需要無障礙審計(請導向 a11y-auditor)

輸入

必要條件:

  1. lp-workspace/03-design/interactions.json——每個互動的規格。每個項目應有 id、target(選取器或區塊 ID)、type(例如 "fade-up"、"parallax"、"hover-lift"、"counter"、"stagger")、library(推薦)以及動作參數(duration、easing、distance、delay、trigger)。原因:此技能負責實作,不重新設計動作。
  2. lp-workspace/04-implementation/html/ 或 nextjs/——要編輯的檔案。

可選: 3. lp-workspace/03-design/design-tokens.json——用於任何動作 token(easing 曲線、duration 尺度)。 4. lp-workspace/02-strategy/ia.json——用於解析目標的區塊 ID。

如果缺少任何必要輸入,請停止:

アニメーション実装には以下が必要です:
- lp-workspace/03-design/interactions.json [✓ 或 不足 → ui-microinteraction-designer]
- lp-workspace/04-implementation/html/ or nextjs/ [✓ 或 不足 → lp-coder-html or lp-coder-nextjs]

流程

步驟 1. 驗證上游並偵測目標

讀取 interactions.json。偵測實作是 HTML(04-implementation/html/index.html 存在)還是 Next.js(04-implementation/nextjs/app/page.tsx 存在)。選擇對應的程式碼路徑。

步驟 2. 為每個互動決定函式庫

對於 interactions.json 中的每個互動,根據下表選擇函式庫:

互動類型HTML 目標 → 函式庫Next.js 目標 → 函式庫
hover-lift、hover-tilt、focus-glow、button-pressVanilla CSS(:hover、:focus-visible)透過 Tailwind 實用類別的 Vanilla CSS
fade-up、fade-in、slide-up(進入視口時)AOS(data-aos="fade-up")Framer Motion whileInView
stagger-children(進入視口時)GSAP ScrollTriggerFramer Motion variants + stagger
parallax、scrub、pin(滾動驅動的編舞)GSAP ScrollTriggerGSAP ScrollTrigger(Client Component)
counter(0 → 目標數字)Vanilla JS IntersectionObserver + rAFVanilla JS 或 Framer Motion animate()
marquee、infinite-scrollVanilla CSS @keyframes(成本低)Vanilla CSS
magnetic-button、游標效果Vanilla JS(體積小)Vanilla JS
page-load entranceVanilla CSS + 小型 JS 類別切換版面層級的 Framer Motion
複雜時間軸(順序式、編舞式)GSAP timelineGSAP timeline(Client Component)

如果規格已經指定 library,除非它與平台衝突(例如 React 中的 AOS——改為 Framer Motion 等效項並在報告中註記),否則就使用它。

原因:每個函式庫都會增加位元組和學習成本。懸停效果不需要函式庫。顯現效果可以用一個小函式庫完成。只有複雜的編舞才值得使用 GSAP。

步驟 3. 安裝或接入函式庫

HTML 路徑:

  • 在 <head> 中透過 CDN 加入 AOS:
    <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/aos.css">
    <script src="https://unpkg.com/[email protected]/dist/aos.js" defer></script>
    
    在 scripts/main.js 結尾初始化:
    AOS.init({
      duration: 600,
      easing: 'ease-out',
      once: true,
      disable: () => window.matchMedia('(prefers-reduced-motion: reduce)').matches,
    });
    
  • 透過 CDN 加入 GSAP:
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js" defer></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ScrollTrigger.min.js" defer></script>
    
    在 scripts/main.js 中註冊並使用:
    if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
      gsap.registerPlugin(ScrollTrigger);
      // ...時間軸
    }
    

Next.js 路徑:

  • Framer Motion:已根據 lp-coder-nextjs 存在於 package.json 中。將互動基本組件包裝在 components/interactions/ 中。
  • GSAP:加入到 package.json(gsap),在 Client Component('use client')中使用,在 useEffect 內部註冊 ScrollTrigger,使其僅在客戶端執行。
  • AOS:在 Next.js 中避免使用——改用 Framer Motion whileInView。

步驟 4. 實作每個規格

對於每個互動,編輯適當的檔案。範例:

卡片上的 Hover-lift(HTML、Vanilla CSS):

<!-- 之前 -->
<article class="bg-white rounded-lg shadow-md p-6">
<!-- 之後 -->
<article class="bg-white rounded-lg shadow-md p-6 transition-transform transition-shadow duration-200 ease-out hover:-translate-y-1 hover:shadow-lg motion-reduce:hover:transform-none motion-reduce:hover:shadow-md">

原因:motion-reduce: 變體:Tailwind 內建了這些變體;當使用者偏好減少動作時,它們會中和動作。比圍繞自訂 CSS 撰寫媒體查詢更簡潔。

進入視口時的 Fade-up(HTML、AOS):

<section id="benefits" data-aos="fade-up" data-aos-delay="0">
  <div data-aos="fade-up" data-aos-delay="100">...</div>
  <div data-aos="fade-up" data-aos-delay="200">...</div>
</section>

Stagger 顯現(HTML、GSAP):

if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
  gsap.from('#benefits .benefit-card', {
    scrollTrigger: { trigger: '#benefits', start: 'top 80%' },
    opacity: 0,
    y: 24,
    duration: 0.6,
    stagger: 0.08,
    ease: 'power2.out',
  });
}

主視覺圖片的視差效果(HTML、GSAP):

if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
  gsap.to('#hero img', {
    scrollTrigger: {
      trigger: '#hero',
      start: 'top top',
      end: 'bottom top',
      scrub: true,
    },
    yPercent: 30,
    ease: 'none',
  });
}

計數器(HTML、vanilla):

function animateCounter(el, target, duration = 1200) {
  if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
    el.textContent = String(target);
    return;
  }
  const start = performance.now();
  function tick(now) {
    const t = Math.min(1, (now - start) / duration);
    el.textContent = Math.round(target * (1 - Math.pow(1 - t, 3))).toString();
    if (t < 1) requestAnimationFrame(tick);
  }
  requestAnimationFrame(tick);
}
const io = new IntersectionObserver((entries) => {
  for (const e of entries) {
    if (e.isIntersecting) {
      animateCounter(e.target, parseInt(e.target.dataset.counter || '0'));
      io.unobserve(e.target);
    }
  }
});
document.querySelectorAll('[data-counter]').forEach((el) => io.observe(el));

顯現包裝器(Next.js、Framer Motion):

'use client';
import { motion, useReducedMotion } from 'framer-motion';
import { ReactNode } from 'react';

export function Reveal({ children, delay = 0 }: { children: ReactNode; delay?: number }) {
  const reduced = useReducedMotion();
  if (reduced) return <>{children}</>;
  return (
    <motion.div
      initial={{ opacity: 0, y: 24 }}
      whileInView={{ opacity: 1, y: 0 }}
      viewport={{ once: true, margin: '-10%' }}
      transition={{ duration: 0.5, delay, ease: [0.2, 0.8, 0.2, 1] }}
    >
      {children}
    </motion.div>
  );
}

步驟 5. 強制執行 60fps 紀律

對於每個動畫,檢查:

  • 動畫化的 CSS 屬性僅限於 transform(translate、scale、rotate、skew)或 opacity。絕不能是 width、height、top、left、right、bottom、margin、padding、font-size、border-radius。原因:只有 transform 和 opacity 能被 GPU 合成而無需重新執行版面或繪製;其他所有屬性都會在每個影格觸發 reflow。
  • will-change: transform, opacity 僅在執行大量動畫的地方添加,並在完成後移除(不要地毯式轟炸頁面——will-change 會為每個元素分配一個圖層)。
  • 滾動驅動的動畫沒有 scroll 事件監聽器——改用 IntersectionObserver 或 GSAP ScrollTrigger。
  • 影格動畫沒有 setInterval——改用 requestAnimationFrame。

如果某個規格要求對非可合成屬性進行動畫(例如為手風琴展開對 height 進行動畫),請改用 transform: scaleY() + transform-origin: top 並調整外層版面——或者接受成本並標記它。

步驟 6. 全面尊重 prefers-reduced-motion

這是非妥協的要求:

  • WCAG 2.3.3:必須尊重使用者的動作偏好。
  • Tailwind 的 motion-reduce: 變體用於 CSS 驅動的動畫。
  • window.matchMedia('(prefers-reduced-motion: reduce)') 包覆 JS 動畫。
  • AOS disable 回呼設定為媒體查詢。
  • Framer Motion useReducedMotion() 鉤子。
  • GSAP:將時間軸包覆在媒體查詢保護中。

原因:對於前庭障礙使用者,視差和劇烈移動可能導致身體不適。這不是一個修飾項目——這是傷害減輕。

步驟 7. 驗證無回歸問題

每次編輯後:

  • 確認沒有引入新的 console.error(例如 GSAP 插件未註冊)。
  • 確認在沒有 JS 的情況下頁面內容仍然正常運作(靜態 HTML 達到相同的繪製結果)。
  • 確認 focus、FAQ、表單、導覽仍然正常運作。
  • 確認關鍵 CSS 路徑沒有顯著增長。

步驟 8. 撰寫動畫報告

撰寫 lp-workspace/05-optimization/animation-report.json:

{
  "implementedAt": "2026-05-29T..",
  "platform": "html",
  "interactionsImplemented": 12,
  "librariesUsed": {
    "vanilla-css": 5,
    "aos": 4,
    "gsap": 3,
    "framer-motion": 0
  },
  "items": [
    {
      "id": "hero-headline-fade",
      "type": "fade-up",
      "target": "#hero h1",
      "library": "aos",
      "params": { "duration": 600, "easing": "ease-out", "delay": 0 },
      "status": "implemented",
      "compositableOnly": true,
      "reducedMotionRespected": true
    }
    // ...每個互動一個項目
  ],
  "warnings": [
    {
      "id": "accordion-expand",
      "issue": "規格要求 height 動畫;為了 60fps 已替換為 scaleY",
      "decision": "auto-substituted"
    }
  ]
}

確保 lp-workspace/05-optimization/ 存在。將先前的報告備份到 .backup。

步驟 9. 回報

アニメーション実装が完了しました:
実装件数: [N] 件
使用ライブラリ:
- Vanilla CSS: [N] 件 (hover, focus)
- AOS: [N] 件 (in-view fade)
- GSAP ScrollTrigger: [N] 件 (parallax, stagger choreography)
- (Next.jsの場合) Framer Motion: [N] 件
prefers-reduced-motion: 全件で尊重
60fpsチェック: transform/opacity のみで構成

修正ファイル: lp-workspace/04-implementation/{html 或 nextjs}/
レポート: lp-workspace/05-optimization/animation-report.json

次のステップ: performance-optimizer / a11y-auditor / cross-browser-tester

輸出

修改的檔案: lp-workspace/04-implementation/html/* 或 lp-workspace/04-implementation/nextjs/**/*(直接編輯以接入動畫)。

寫入的檔案: lp-workspace/05-optimization/animation-report.json——每個規格的實作記錄。

品質檢查

在宣告完成之前:

  • interactions.json 中的每個互動都已實作或標記了原因
  • 每個動畫僅針對 transform 和/或 opacity(沒有 width、height、top、left 等)
  • prefers-reduced-motion: reduce 已在每個 JS 動畫、AOS 初始化、GSAP 時間軸和 Framer Motion 元件中得到尊重(或透過 Tailwind motion-reduce: 變體)
  • 沒有 scroll 事件監聽器(使用 IntersectionObserver 或 ScrollTrigger)
  • 動畫沒有使用 setInterval(使用 requestAnimationFrame)
  • will-change 被節制地設定(僅在正在動畫的元素上,完成後移除)
  • 沒有引入新的 console 錯誤
  • FAQ、表單、導覽、focus 環仍然正常運作
  • 函式庫腳本已設定為延遲載入(HTML 中的 defer 屬性;React 中的 'use client')
  • 報告 JSON 有效且每個規格一個項目

如果任何檢查失敗,請不要回報成功——修復它。

參考資料

  • ${CLAUDE_PLUGIN_ROOT}/skills/lp-maker/references/workspace-schema.md
  • skills/ui-microinteraction-designer/SKILL.md——上游;規格來源
  • skills/lp-coder-html/SKILL.md、skills/lp-coder-nextjs/SKILL.md——上游;正在修改的程式碼
  • skills/responsive-optimizer/SKILL.md——同級
  • skills/a11y-auditor/SKILL.md——同級;驗證減少動作的尊重
  • skills/performance-optimizer/SKILL.md——下游;測量 Core Web Vitals 影響

Individual skills in this repo

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

hanimaru1121/image-asset-generator

This skill should be used when the user wants the actual image files for the landing page generated and placed in the implementation folder — based on the specs from `image-asset-planner`. If the user has an image generation MCP (DALL-E, Imagen, Stable Diffusion, Midjourney bridge) it calls that; otherwise produces a usable placeholder (labeled SVG with correct dimensions, or a CSS gradient with text). Triggers include "画像生成して", "画像を作って", "ヒーロー画像", "OG画像作成", "generate images", "create hero image", "make placeholder images", "image assets", "画像アセット", or when the orchestrator (`lp-maker`) reaches Tier 4. Note that founder/customer/real-person portraits MUST NOT be AI-generated and are flagged for the user to provide real photos. Make sure to use this skill whenever the LP has image slots that need files, so `lp-coder-*` can reference real paths.

hanimaru1121/image-asset-planner

This skill should be used when the user wants a complete spec list of every image, illustration, and icon the LP needs — file names, exact dimensions (1x/2x/3x), formats, purposes, alt text, and ready-to-paste generative-AI prompts for Midjourney/DALL·E/Imagen/Adobe Firefly. Triggers include "画像仕様", "image plan", "画像リスト", "画像プロンプト", "AI画像", "Midjourneyプロンプト", "image spec", "what images do we need", "ヒーロー画像どうする", "アイコン仕様", or when the orchestrator (`lp-maker`) reaches Tier 3 Step 4. It reads `02-strategy/ia.json`, `02-strategy/copy.json`, and `03-design/design-tokens.json`, and writes `03-design/image-spec.json`. Make sure to use this skill BEFORE `image-asset-generator` in Tier 4 — without specs, generation is random and brand-inconsistent. Every needed image is enumerated so generation can be batched.

hanimaru1121/visual-mockup-designer

This skill should be used when the user wants a high-fidelity, openable HTML+Tailwind mockup of the entire landing page — colors applied from design tokens, real copy from `copy.json`, placeholder images sized correctly, and all sections from IA visible end-to-end. Triggers include "モックアップ", "mockup", "モックアップ作って", "プレビュー", "preview", "high-fidelity comp", "デザインカンプ", "デザイン案", "ビジュアル案見せて", or when the orchestrator (`lp-maker`) reaches Tier 3 Step 3. It reads `03-design/design-tokens.json`, `03-design/wireframe.svg`, `02-strategy/copy.json`, and `02-strategy/ia.json`, and writes a single-file `03-design/mockup.html` (CDN Tailwind, no build step) the user can open in any browser. This is NOT the final shippable code — it's a designed comp. Animations and interactions are marked with HTML comments for `ui-microinteraction-designer` and `animation-implementer` downstream. Make sure to use this skill whenever the user wants to "see what the LP would look like" BEFORE committing to production

相關技能