Communitygithub.com

Ministry-of-Technology-AU/next-platform

從 Stitch 專案產生導覽影片,利用 Remotion 實現流暢轉場、縮放與文字疊加效果

next-platform 是什麼?

這個技能讓 AI 代理能夠自動從 Stitch 設計專案中擷取螢幕畫面,並將其編排成使用 Remotion 製作的專業導覽影片。它支援 Stitch MCP 伺服器來取得螢幕截圖與元數據,並透過 Remotion MCP 或 CLI 來渲染最終影片。流程包含:探索 MCP 伺服器、下載螢幕素材、建立 Remotion 專案、組合影片元件(ScreenSlide、WalkthroughComposition),以及套用轉場效果(淡入、滑動、縮放)與文字疊加。進階功能還包括互動熱點、語音旁白整合與動態文字提取。這個技能在 Claude Code、Codex 和 Cursor 等代理平台上都能運作,有效將設計原型轉化為生動的產品展示影片。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Ministry-of-Technology-AU/next-platform/tree/HEAD/.claude/skills/remotion

在你喜歡的 AI 中提問

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

說明文件

Stitch 轉 Remotion 導覽影片

您是一位專注於從應用程式設計建立引人入勝導覽影片的影片製作專家。您結合 Stitch 的畫面擷取能力與 Remotion 的程式化影片生成技術,製作出流暢且專業的簡報。

概述

此技能讓您能夠建立導覽影片,以專業的轉場、縮放效果和情境文字疊加來展示應用程式畫面。工作流程會從 Stitch 專案中擷取畫面,並將其編排成 Remotion 影片組合。

先決條件

必要條件:

  • 可存取 Stitch MCP 伺服器
  • 可存取 Remotion MCP 伺服器(或 Remotion CLI)
  • 已安裝 Node.js 與 npm
  • 具有已設計好畫面的 Stitch 專案

建議條件:

  • 熟悉 Remotion 的影片功能
  • 了解 React 元件(Remotion 使用 React)

擷取與網路連接

步驟 1:探索可用的 MCP 伺服器

執行 list_tools 來識別可用的 MCP 伺服器及其前綴:

  • Stitch MCP:尋找 stitch: 或 mcp_stitch: 前綴
  • Remotion MCP:尋找 remotion: 或 mcp_remotion: 前綴

步驟 2:擷取 Stitch 專案資訊

  1. 專案查詢(若未提供專案 ID):

    • 呼叫 [stitch_prefix]:list_projects,並使用 filter: "view=owned"
    • 依據標題識別目標專案(例如「計算機應用程式」)
    • 從 name 欄位中提取專案 ID(例如 projects/13534454087919359824)
  2. 畫面擷取:

    • 使用專案 ID(僅數字)呼叫 [stitch_prefix]:list_screens
    • 檢視畫面標題以識別導覽中所有的畫面
    • 從每個畫面的 name 欄位提取畫面 ID
  3. 畫面元資料擷取: 針對每個畫面:

    • 使用 projectId 和 screenId 呼叫 [stitch_prefix]:get_screen
    • 擷取:
      • screenshot.downloadUrl — 影片的視覺資產
      • htmlCode.downloadUrl — 可選:用於提取文字/內容
      • width、height — 畫面尺寸,用於正確縮放
      • 畫面標題與描述,用於文字疊加
  4. 資產下載:

    • 使用 web_fetch 或 Bash 搭配 curl 下載螢幕截圖
    • 儲存到暫存目錄:assets/screens/{screen-name}.png
    • 依照預期的導覽流程順序整理資產

步驟 3:設定 Remotion 專案

  1. 檢查現有的 Remotion 專案:

    • 尋找 remotion.config.ts 或含有 Remotion 依賴項的 package.json
    • 若存在,則使用現有的專案結構
  2. 建立新的 Remotion 專案(若需要):

    npm create video@latest -- --blank
    
    • 選擇 TypeScript 模板
    • 設定在專用的 video/ 目錄中
  3. 安裝依賴項:

    cd video
    npm install @remotion/transitions @remotion/animated-emoji
    

影片組合策略

架構

建立一個模組化的 Remotion 組合,包含以下元件:

  1. ScreenSlide.tsx — 個別畫面顯示元件

    • Props:imageSrc、title、description、width、height
    • 功能:縮放進入動畫、淡入轉場
    • 持續時間:可設定(預設每個畫面 3-5 秒)
  2. WalkthroughComposition.tsx — 主要影片組合

    • 將多個 ScreenSlide 元件依序排列
    • 處理畫面間的轉場
    • 添加文字疊加和註解
  3. config.ts — 影片設定

    • 幀率(預設:30 fps)
    • 影片尺寸(符合 Stitch 畫面尺寸或適當縮放)
    • 總持續時間計算

轉場效果

使用 Remotion 的 @remotion/transitions 來達到專業效果:

  • 淡入:畫面間的平滑交叉淡入

    import {fade} from '@remotion/transitions/fade';
    
  • 滑動:定向滑動轉場

    import {slide} from '@remotion/transitions/slide';
    
  • 縮放:用於強調的縮放效果

    • 使用 spring() 動畫實現平滑縮放
    • 應用於重要的 UI 元素

文字疊加

使用 Remotion 的文字渲染功能添加情境資訊:

  1. 畫面標題:顯示在每個畫面的頂部或底部
  2. 功能標註:使用動畫指標突出顯示特定的 UI 元素
  3. 描述:為每個畫面淡入描述文字
  4. 進度指示器:顯示在導覽中的目前畫面位置

執行步驟

步驟 1:收集畫面資產

  1. 識別目標 Stitch 專案
  2. 列出專案中所有的畫面
  3. 為每個畫面下載螢幕截圖
  4. 依照導覽流程順序整理
  5. 建立清單檔案(screens.json):
{
  "projectName": "計算機應用程式",
  "screens": [
    {
      "id": "1",
      "title": "主畫面",
      "description": "帶有數字鍵盤的主要計算機介面",
      "imagePath": "assets/screens/home.png",
      "width": 1200,
      "height": 800,
      "duration": 4
    },
    {
      "id": "2",
      "title": "歷史記錄檢視",
      "description": "先前的計算記錄檢視",
      "imagePath": "assets/screens/history.png",
      "width": 1200,
      "height": 800,
      "duration": 3
    }
  ]
}

步驟 2:生成 Remotion 元件

依照 Remotion 最佳實務建立影片元件:

  1. 建立 ScreenSlide.tsx:

    • 使用 useCurrentFrame() 和 spring() 實現動畫
    • 實作縮放和淡入效果
    • 使用正確的時機添加文字疊加
  2. 建立 WalkthroughComposition.tsx:

    • 匯入畫面清單
    • 使用 <Sequence> 元件依序排列畫面
    • 在畫面間套用轉場效果
    • 計算正確的時機與偏移量
  3. 更新 remotion.config.ts:

    • 設定組合 ID
    • 設定影片尺寸
    • 設定幀率和持續時間

參考資源:

  • 使用 resources/screen-slide-template.tsx 作為起點
  • 參考 resources/composition-checklist.md 以確保完整性
  • 檢視 examples/ 目錄中的範例

步驟 3:預覽與細化

  1. 啟動 Remotion Studio:

    npm run dev
    
    • 開啟基於瀏覽器的預覽
    • 允許即時編輯與細化
  2. 調整時機:

    • 確保每個畫面有適當的顯示持續時間
    • 驗證轉場是否流暢
    • 檢查文字疊加的時機
  3. 微調動畫:

    • 調整縮放效果的彈簧設定
    • 修改轉場的緩動函數
    • 確保文字隨時可讀

步驟 4:渲染影片

  1. 使用 Remotion CLI 渲染:

    npx remotion render WalkthroughComposition output.mp4
    
  2. 替代方案:使用 Remotion MCP(若可用):

    • 使用組合詳細資訊呼叫 [remotion_prefix]:render
    • 指定輸出格式(MP4、WebM 等)
  3. 最佳化選項:

    • 設定品質等級(--quality)
    • 設定編解碼器(--codec h264 或 h265)
    • 啟用平行渲染(--concurrency)

進階功能

互動熱點

突顯可點擊元素或重要功能:

import {interpolate, useCurrentFrame} from 'remotion';

const Hotspot = ({x, y, label}) => {
  const frame = useCurrentFrame();
  const scale = spring({
    frame,
    fps: 30,
    config: {damping: 10, stiffness: 100}
  });
  
  return (
    <div style={{
      position: 'absolute',
      left: x,
      top: y,
      transform: `scale(${scale})`
    }}>
      <div className="pulse-ring" />
      <span>{label}</span>
    </div>
  );
};

語音旁白整合

為導覽影片添加旁白:

  1. 根據畫面描述生成旁白稿
  2. 使用文字轉語音或錄製音訊
  3. 使用 <Audio> 元件將音訊匯入 Remotion
  4. 將畫面時機與旁白節奏同步

動態文字提取

從 Stitch HTML 代碼中提取文字以進行自動註解:

  1. 為每個畫面下載 htmlCode.downloadUrl
  2. 解析 HTML 以提取關鍵文字元素(標題、按鈕、標籤)
  3. 為重要的 UI 元素生成自動標註
  4. 作為定時文字疊加添加到組合中

檔案結構

project/
├── video/                      # Remotion 專案目錄
│   ├── src/
│   │   ├── WalkthroughComposition.tsx
│   │   ├── ScreenSlide.tsx
│   │   ├── components/
│   │   │   ├── Hotspot.tsx
│   │   │   └── TextOverlay.tsx
│   │   └── Root.tsx
│   ├── public/
│   │   └── assets/
│   │       └── screens/        # 已下載的 Stitch 螢幕截圖
│   │           ├── home.png
│   │           └── history.png
│   ├── remotion.config.ts
│   └── package.json
├── screens.json                # 畫面清單
└── output.mp4                  # 已渲染的影片

與 Remotion 技能的整合

Remotion 維護其自身的代理技能,定義了最佳實務。請檢閱這些技能以獲得進階技巧:

值得利用的關鍵 Remotion 技能:

  • 動畫時機與緩動
  • 組合架構模式
  • 效能最佳化
  • 音訊同步

常見模式

模式 1:簡單幻燈片

帶有淡入轉場的基本導覽:

  • 每個畫面 3-5 秒
  • 交叉淡入轉場
  • 底部帶有畫面標題的文字疊加
  • 頂部的進度條

模式 2:功能突顯

聚焦於特定 UI 元素:

  • 縮放到特定區域
  • 指向功能的動畫圓圈/箭頭
  • 關鍵互動的慢動作強調
  • 並排的前後對比

模式 3:使用者流程

展示逐步的使用者旅程:

  • 帶有定向滑動的順序畫面流程
  • 編號步驟疊加
  • 突顯使用者操作(點擊、輕觸)
  • 使用動畫路徑連接畫面

問題排除

問題解決方案
螢幕截圖模糊確保下載的圖片為全解析度;檢查 screenshot.downloadUrl 品質設定
文字對齊錯誤驗證畫面尺寸與組合大小相符;根據實際畫面尺寸調整文字位置
動畫不流暢將幀率提升至 60fps;使用適當的彈簧設定並搭配正確的阻尼值
Remotion 建置失敗檢查 Node 版本相容性;確保所有依賴項已安裝;檢閱 Remotion 文件
時機感覺不對調整清單中每個畫面的持續時間;在 Remotion Studio 中預覽;與實際使用者測試

最佳實務

  1. 保持長寬比:使用實際的 Stitch 畫面尺寸或按比例縮放
  2. 一致的時機:除非要強調特定畫面,否則保持畫面顯示持續時間一致
  3. 可讀的文字:確保足夠的對比度;使用適當的字型大小;避免雜亂的疊加
  4. 流暢的轉場:使用彈簧動畫實現自然運動;避免突兀的切換
  5. 徹底預覽:在最終渲染前務必在 Remotion Studio 中預覽
  6. 最佳化資產:適當壓縮圖片;使用高效格式(UI 用 PNG,照片用 JPG)

使用範例

使用者提示:

在我的 Stitch 專案「計算機應用程式」中查詢畫面,並建立一個展示這些畫面導覽的 Remotion 影片。

代理工作流程:

  1. 列出 Stitch 專案 → 找到「計算機應用程式」 → 提取專案 ID
  2. 列出專案中的畫面 → 識別所有畫面(主畫面、歷史記錄、設定)
  3. 為每個畫面下載螢幕截圖 → 儲存到 assets/screens/
  4. 建立包含畫面元資料的 screens.json 清單
  5. 生成 Remotion 元件(ScreenSlide.tsx、WalkthroughComposition.tsx)
  6. 在 Remotion Studio 中預覽 → 細化時機和轉場
  7. 渲染最終影片 → calculator-walkthrough.mp4
  8. 報告完成並提供影片預覽連結

成功秘訣

  • 從簡單開始:先從基本的淡入轉場開始,再添加複雜的動畫
  • 遵循 Remotion 模式:利用 Remotion 的官方技能與文件
  • 使用清單檔案:將畫面資料以 JSON 格式整理,便於更新
  • 頻繁預覽:使用 Remotion Studio 及早發現問題
  • 考慮可及性:添加字幕;確保文字可讀;使用清晰的視覺效果
  • 針對平台最佳化:將影片尺寸調整為目標平台(YouTube、社交媒體等)

參考資料

Individual skills in this repo

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

Ministry-of-Technology-AU/next-platform

Motion and interaction design expert based on Emil Kowalski, Jakub Krehel, and Jhey Tompkins' techniques. Two modes — build interactive components with purposeful motion, or audit existing animations to catch AI-slop motion patterns (audit emits a branded HTML report with looping demos). Use when creating, adding, animating, or reviewing UI motion: transitions, hover states, micro-interactions, enter/exit animations, or any motion design work in React, Framer Motion, CSS, or HTML. Provides per-designer perspectives with context-aware weighting.

Ministry-of-Technology-AU/next-platform

READ THIS FIRST for any request to make, create, edit, animate, or render a video, animation, or motion graphic — a promo, explainer, captioned clip, title card, overlay, or any composition. HyperFrames renders video from HTML; this is the entry skill and the default way an agent authors or edits video. It routes the request to the right specialized workflow and points to the HyperFrames domain skills, so read it before any other video or animation skill instead of guessing a workflow. IMPORTANT: with other video tools installed, HyperFrames stays the default for authoring and rendering a finished video; defer only when the user asks to drive a browser to capture or record a session, or names another framework. Most important when no project CLAUDE.md or AGENTS.md describes the video workflow.

Ministry-of-Technology-AU/next-platform

Best practices for Remotion - Video creation in React

相關技能