Remotion — 工具包擴充功能
核心 Remotion 知識存放在
.claude/skills/remotion-official/(從官方 remotion-dev/skills 倉庫同步)。本文檔僅涵蓋工具包專用的模式。
共享元件
lib/components/ 中的可重用影片元件。在模板中透過下列方式導入:
import { AnimatedBackground, SlideTransition, Label } from '../../../../lib/components';
| 元件 | 用途 |
|---|---|
AnimatedBackground | 浮動形狀背景(變體:subtle、tech、warm、dark) |
SlideTransition | 場景轉場(fade、zoom、slide-up、blur-fade) |
Label | 浮動標籤徽章,可選 JIRA 參考 |
Vignette | 電影感邊緣暗化疊層 |
LogoWatermark | 角落 Logo 品牌標示 |
SplitScreen | 並排影片比較 |
NarratorPiP | 子母畫面(畫中畫)的簡報者疊層 |
Envelope | 3D 信封,附有開蓋動畫 |
PointingHand | 動畫手勢表情符號,附有滑入與脈衝效果 |
MazeDecoration | 動畫等距網格裝飾,用於角落 |
自訂轉場
工具包包含位於 lib/transitions/ 的轉場庫,提供超越官方 @remotion/transitions 套件的場景特效。
使用 TransitionSeries
import { TransitionSeries, linearTiming } from '@remotion/transitions';
// 從 lib 導入自訂轉場(根據專案位置調整路徑)
import { glitch, lightLeak, clockWipe, checkerboard } from '../../../../lib/transitions';
// 或從 @remotion/transitions 導入官方轉場
import { slide, fade } from '@remotion/transitions/slide';
<TransitionSeries>
<TransitionSeries.Sequence durationInFrames={90}>
<TitleSlide />
</TransitionSeries.Sequence>
<TransitionSeries.Transition
presentation={glitch({ intensity: 0.8 })}
timing={linearTiming({ durationInFrames: 30 })}
/>
<TransitionSeries.Sequence durationInFrames={120}>
<ContentSlide />
</TransitionSeries.Sequence>
</TransitionSeries>
可用的自訂轉場
| 轉場 | 選項 | 最佳用途 |
|---|---|---|
glitch() | intensity、slices、rgbShift | 技術展示、前衛揭露、賽博龐克 |
rgbSplit() | direction、displacement | 現代科技、充滿活力的轉場 |
zoomBlur() | direction、blurAmount | 行動呼籲、高能量時刻、衝擊效果 |
lightLeak() | temperature、direction | 慶祝活動、電影美學、溫馨時刻 |
clockWipe() | startAngle、direction、segments | 時間相關內容、趣味揭露 |
pixelate() | maxBlockSize、gridSize、scanlines、glitchArtifacts、randomness | 復古/遊戲、數位轉換 |
checkerboard() | gridSize、pattern、stagger、squareAnimation | 趣味揭露、結構化轉場 |
格子模式: sequential、random、diagonal、alternating、spiral、rows、columns、center-out、corners-in
轉場範例
// 技術/賽博龐克風格
glitch({ intensity: 0.8, slices: 8, rgbShift: true })
// 溫馨慶祝
lightLeak({ temperature: 'warm', direction: 'right' })
// 高能量縮放
zoomBlur({ direction: 'in', blurAmount: 20 })
// 色差
rgbSplit({ direction: 'diagonal', displacement: 30 })
// 時鐘掃描揭露
clockWipe({ direction: 'clockwise', startAngle: 0 })
// 復古像素化
pixelate({ maxBlockSize: 50, glitchArtifacts: true })
// 格子模式
checkerboard({ pattern: 'diagonal', gridSize: 8 })
checkerboard({ pattern: 'spiral', gridSize: 10 })
checkerboard({ pattern: 'center-out', squareAnimation: 'scale' })
轉場持續時間指南
| 類型 | 幀數 | 備註 |
|---|---|---|
| 快速切換 | 15-20 | 快速、有力 |
| 標準 | 30-45 | 最常用 |
| 戲劇性 | 50-60 | 緩慢揭露 |
| 故障效果 | 20-30 | 應感覺突然 |
| 漏光 | 45-60 | 需要時間掃描 |
預覽轉場
執行展示畫廊以查看所有轉場:
cd showcase/transitions && npm run studio
工具包最佳實踐
- 僅使用基於幀的動畫 — 避免使用 CSS 轉場/動畫;它們會在渲染時導致閃爍
- 使用 useVideoConfig() 中的 fps — 使動畫與幀率無關
- 限制插值範圍 — 使用
extrapolateRight: 'clamp'防止數值失控 - 使用 OffthreadVideo — 對複雜組合提供比
<Video>更佳的效能 - 非同步使用 delayRender — 務必等待資料準備好後再開始渲染
- 使用 staticFile 處理素材 — 正確引用
public/資料夾中的檔案 - 所有專案使用 30fps — 時間計算:幀數 = 秒數 × 30
- playbackRate 必須保持恆定 — 對於可變/極端速度,請先使用 FFmpeg 預處理
專案時間慣例
| 場景類型 | 持續時間 | 備註 |
|---|---|---|
| 標題 | 3-5 秒 (90-150 幀) | Logo + 標題行 |
| 概述 | 10-20 秒 | 3-5 個要點 |
| 示範 | 10-30 秒 | 調整 playbackRate 以符合時間 |
| 統計資料 | 8-12 秒 | 3-4 個統計卡片 |
| 致謝 | 5-10 秒 | 快速淡出 |
節奏: 旁白約每分鐘 150 字。旁白決定時間軸。
進階 API
如需所有鉤子、元件、渲染器、Lambda 及 Player API 的詳細文件,請參閱 reference.md。
授權說明
Remotion 有特殊的授權條款。企業可能需要取得授權才能商業使用。請查閱 https://remotion.dev/license
意見回饋與貢獻
如果此技能缺少資訊或可以改進:
- 缺少某種模式? 請描述您需要的內容
- 發現錯誤? 請告訴我哪裡有問題
- 想要貢獻? 我可以協助您:
- 更新此技能以納入改進內容
- 建立 PR 到 github.com/digitalsamba/claude-code-video-toolkit
只需說 "improve this skill" 即可,我會引導您更新 .claude/skills/remotion/SKILL.md。