Communitygithub.com

JantonioFC/skillsbank

Remotion React 標記撰寫最佳實務指南

skillsbank 是什麼?

這個技能是為使用 Remotion 進行 React 動畫開發的工程師設計的。它涵蓋了所有核心模式:使用 `useCurrentFrame()` 和 `interpolate()` 進行精確幀控制,在 Studio 中利用 `Interactive` 元件實現互動,以及使用 `staticFile()` 和 `@remotion/media` 的資產管理。它明確禁止 CSS 轉場和 Tailwind 動畫類別,因為它們無法正確渲染,並強調在樣式中內聯插值、偏好 `scale`/`translate`/`rotate` 屬性而非單一 `transform` 字串。該技能支援各種 Remotion 平台(CLI、Studio、程式化渲染),也涵蓋地圖、語音旁白、字幕、音訊視覺化、Lottie 動畫、自訂效果、3D 內容(Three.js)、參數化影片(Zod 模式)和 DOM 測量等高階主題。它透過連結到專門的 `.md` 文件提供樹狀結構的指導,並使用 `npx remotion add` 進行套件安裝和 `npx remotion studio` 進行預覽。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/JantonioFC/skillsbank/tree/HEAD/skills/remotion-markup

在你喜歡的 AI 中提問

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

預覽

來自技能 README

說明文件

這是 Remotion React 標記的撰寫指導。 如果此主題不相關,請改為載入 Remotion 最佳實務。

通用規則

使用 useCurrentFrame() 和 interpolate() 來處理屬性動畫。

優先使用 interpolate() 而非 spring()。

使用 Easing.bezier() 自訂時間曲線,包含跳躍或過衝的動態效果。 若需彈簧動畫,則使用 Easing.spring()。

在 Studio 中需要互動的 HTML 元素應使用 Interactive:<div> -> <Interactive.Div>。

為 Interactive、Solid、Sequence 設定描述性的 name 屬性,例如 name="Hero title"。

import { useCurrentFrame, Easing, interpolate, Interactive } from "remotion";

export const FadeIn = () => {
  const frame = useCurrentFrame();

  return (
    <Interactive.Div
      name="Title"
      style={{
        opacity: interpolate(frame, [0, 60], [0, 1], {
          extrapolateRight: "clamp",
          extrapolateLeft: "clamp",
          easing: Easing.bezier(0.16, 1, 0.3, 1),
        }),
      }}
    >
      Hello World!
    </Interactive.Div>
  );
};

將 interpolate() 呼叫內聯在 style 屬性中。

優先使用 scale、translate、rotate 等 CSS 屬性,而非 transform。

// 👍 可內聯編輯的關鍵影格與變形簡寫
style={{
  scale: interpolate(frame, [0, 100], [0, 1]),
  translate: interpolate(frame, [0, 100], ["0px 0px", "100px 100px"]),
  rotate: interpolate(frame, [0, 100], ["20deg", "90deg"]),
}}

// 👎 隱藏的值與 transform 字串在 Studio 中更難編輯
const scale = interpolate(frame, [0, 100], [0, 1]);

style={{
  transform: `scale(${scale})`,
}}

禁止使用 CSS 轉場或動畫——它們無法正確渲染。 禁止使用 Tailwind 動畫類別名稱——它們無法正確渲染。

將素材放在專案根目錄的 public/ 資料夾中。

使用 staticFile() 來引用 public/ 資料夾中的檔案。

使用 @remotion/media 加入影片和音訊。

使用 <Img> 元件加入圖片。

使用 staticFile() 存取 public/ 中的檔案,或直接傳入遠端 URL:

import { Audio, Video } from "@remotion/media";
import { staticFile } from "remotion";

export const MyComposition = () => {
  return (
    <>
      <Video src={staticFile("video.mp4")} style={{ opacity: 0.5 }} />
      <Audio src={staticFile("audio.mp3")} />
      <Img src={staticFile("logo.png")} style={{ width: 100, height: 100 }} />
      <Video src="https://remotion.media/video.mp4" />
    </>
  );
};

若要延遲內容,請用 <Sequence> 包裝並使用 from。 若要限制元素的持續時間,請使用 <Sequence> 的 durationInFrames。

<Sequence> 預設為覆蓋整個場景的絕對填滿佈局。 若需內聯內容,請使用 layout="none"。

const Main = () => {
  const {fps} = useVideoConfig();

  return (
    <AbsoluteFill>
      <Sequence name="Background">
        <Background />
      </Sequence>
      <Sequence name="Title" from={30} durationInFrames={60} layout="none">
        <Title />
      </Sequence>
      <Sequence name="Subtitle" from={60} durationInFrames={60} layout="none">
        <Subtitle />
      </Sequence>
    </AbsoluteFill>
  );
}

export const Title = () => {
  const frame = useCurrentFrame();

  return (
    <div
      style={{
        opacity: interpolate(frame, [0, 60], [0, 1], {
          extrapolateRight: "clamp",
          extrapolateLeft: "clamp",
          easing: Easing.bezier(0.16, 1, 0.3, 1),
        }),
      }}
    >
      Title
    </div>
  );
};

export const Subtitle = () => {
  return <div>Subtitle</div>;
};

地圖

關於選擇簡單靜態地圖、Mapbox 地圖與 MapLibre 地圖,請參閱 map.md。

語音旁白

關於使用 ElevenLabs TTS 為 Remotion 合成加入 AI 語音旁白,請參閱 voiceover.md。

修剪

關於修剪模式——裁剪動畫的開頭或結尾,請參閱 trimming.md。

嵌入影片

關於嵌入影片的進階知識——修剪、音量、速度、循環、音高,請參閱 embedding-videos.md。

嵌入音訊

關於進階音訊功能——修剪、音量、速度、音高,請參閱 audio.md。

轉場

關於場景轉場模式,請參閱 transitions.md。

視覺與像素效果

建立視覺效果時,優先順序:1. 一般 Remotion/HTML/CSS/SVG/濾鏡/混合/遮罩動畫;2. 透過 effects.md 列出的效果(包含在 <HtmlInCanvas> 中渲染的 HTML);3. 當使用者需要可重複使用或專案特定的效果時,透過 effects.md 使用自訂 createEffect();4. 僅在沒有任何效果適合時使用自訂 <HtmlInCanvas onPaint>(參考 html-in-canvas.md)。

關於漏光疊加,請參閱 light-leaks.md。文件:https://www.remotion.dev/docs/effects

可用效果:brightness(), contrast(), colorKey(), duotone(), grayscale(), hue(), invert(), saturation(), tint(), linearGradient(), linearGradientTint(), thermalVision(), blur(), linearProgressiveBlur(), radialProgressiveBlur(), zoomBlur(), dropShadow(), glow(), lightTrail(), evolve(), venetianBlinds(), mirror(), scale(), uvTranslate(), xyTranslate(), barrelDistortion(), chromaticAberration(), fisheye(), cornerPin(), wave(), burlap(), emboss(), dotGrid(), halftone(), noise(), noiseDisplacement(), paper(), roughenEdges(), pattern(), pixelate(), pixelDissolve(), scanlines(), speckle(), shine(), shrinkwrap(), vignette(), contourLines(), checkerboard(), halftoneLinearGradient(), gridlines(), whiteNoise(), tvSignalOff(), lines(), rings(), waves(), zigzag(), lightLeak(), starburst()。

3D 內容

關於使用 Three.js 和 React Three Fiber 在 Remotion 中處理 3D 內容,請參閱 3d.md。

音效

當需要使用音效時,請載入 ./sfx.md 檔案以取得更多資訊。

音訊視覺化

當需要將音訊視覺化(頻譜條、波形、低音反應效果)時,請載入 ./audio-visualization.md 檔案以取得更多資訊。

字幕

處理字幕時,請載入 Remotion 字幕 技能以取得更多資訊。

Google 字型

這是 Remotion 載入字型的建議方式。關於如何載入 Google 字型,請參閱 google-fonts.md。

本地字型

關於如何載入本地字型,請參閱 local-fonts.md。

GIF

關於如何顯示與 Remotion 時間軸同步的 GIF,請參閱 gifs.md。

進階圖片

關於調整圖片大小與位置、動態圖片路徑以及取得圖片尺寸,請參閱 images.md。

Lottie 動畫

關於在 Remotion 中嵌入 Lottie 動畫,請參閱 lottie.md。

進階時間控制

關於使用 interpolate 與貝茲曲線緩動以及彈簧的進階時間控制,請參閱 timing.md。

參數化影片

關於透過加入 Zod 模式使合成可參數化,請參閱 parameters.md。

測量 DOM 節點

關於在 Remotion 中測量 DOM 元素尺寸,請參閱 measuring-dom-nodes.md。

測量文字

關於測量文字尺寸、將文字置入容器以及檢查溢出,請參閱 measuring-text.md。

使用 FFmpeg

對於某些影片操作,例如修剪影片或偵測靜音,應使用 FFmpeg。請載入 ./ffmpeg.md 檔案以取得更多資訊。

靜音偵測

當需要偵測並修剪影片或音訊檔案中的靜音片段時,請載入 ./silence-detection.md 檔案。

動態持續時間、尺寸與資料

關於動態設定合成持續時間、尺寸與 props,請參閱 calculate-metadata.md。

進階合成

關於定義靜態圖片、資料夾、預設 props 以及巢狀合成,請參閱 compositions.md。

進階排序

關於更多排序模式——延遲、修剪、限制項目持續時間,請參閱 sequencing.md。

安裝模組

使用 npx remotion add 以正確版本加入新套件:

npx remotion add @remotion/media

此命令適用於 @remotion/* 套件、mediabunny、@mediabunny/* 以及 zod。

預覽標記

僅在使用者想要查看預覽時才執行此操作。

npx remotion studio --no-open

這會啟動一個長時間運行的程序,並輸出預覽伺服器的 URL。 如果伺服器已啟動,則會直接輸出 URL。

選擇性:單幀渲染檢查

你可以使用 CLI 渲染單個影格,以驗證佈局、顏色或時間。 對於簡單的修改、純重構或當你已從 Studio 或先前的渲染中獲得足夠信心時,可以跳過此步驟。

npx remotion still [composition-id] --scale=0.25 --frame=30

在 30 fps 下,--frame=30 表示第一秒的位置(--frame 從 0 開始計數)。

Individual skills in this repo

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

JantonioFC/skillsbank

AI-powered image editing with style transfer and object removal

JantonioFC/skillsbank

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

JantonioFC/skillsbank

Analise e auditoria de editais de leilao judicial e extrajudicial. Riscos ocultos, clausulas perigosas, debitos, ocupante e classificacao da oportunidade.

JantonioFC/skillsbank

Embed Photopea in web apps using photopea.js. Covers embedding, file I/O, scripting, exporting, layers, text, filters, and the full Photoshop-compatible API.

JantonioFC/skillsbank

Best practices for Remotion - Video creation in React

JantonioFC/skillsbank

Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays

JantonioFC/skillsbank

Seek and analyze video content using Memories.ai Large Visual Memory Model for persistent video intelligence

JantonioFC/skillsbank

Writes complete, structured landing pages optimized for SEO ranking, AEO citation, and visitor conversion. Activate when the user wants to write or generate a landing page for a product, service, or offer.

JantonioFC/skillsbank

Video and audio perception, indexing, and editing. Ingest files/URLs/live streams, build visual/spoken indexes, search with timestamps, edit timelines, add overlays/subtitles, generate media, and create real-time alerts.

JantonioFC/skillsbank

Upload, stream, search, edit, transcribe, and generate AI video and audio using the VideoDB SDK.

JantonioFC/skillsbank

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

JantonioFC/skillsbank

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

JantonioFC/skillsbank

Tool lifecycle UI components for React/Next.js from ui.inference.sh. Display tool calls: pending, progress, approval required, results. Capabilities: tool status, progress indicators, approval flows, results display. Use for: showing agent tool calls, human-in-the-loop approvals, tool output. Triggers: tool ui, tool calls, tool status, tool approval, tool results, agent tools, mcp tools ui, function calling ui, tool lifecycle, tool pending

JantonioFC/skillsbank

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

JantonioFC/skillsbank

When the user wants help with paid advertising campaigns on Google Ads, Meta (Facebook/Instagram), LinkedIn, Twitter/X, or other ad platforms. Also use when the user mentions 'PPC,' 'paid media,' 'ROAS,' 'CPA,' 'ad campaign,' 'retargeting,' 'audience targeting,' 'Google Ads,' 'Facebook ads,'...

JantonioFC/skillsbank

Create AI avatar and talking head videos with OmniHuman, Fabric, PixVerse via inference.sh CLI. Models: OmniHuman 1.5, OmniHuman 1.0, Fabric 1.0, PixVerse Lipsync. Capabilities: audio-driven avatars, lipsync videos, talking head generation, virtual presenters. Use for: AI presenters, expla...

JantonioFC/skillsbank

Create AI marketing videos for ads, promos, product launches, and brand content. Models: Veo, Seedance, Wan, FLUX for visuals, Kokoro for voiceover. Types: product demos, testimonials, explainers, social ads, brand videos. Use for: Facebook ads, YouTube ads, product launches, brand awarene...

JantonioFC/skillsbank

Generate AI videos with Google Veo, Seedance, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 1.5 Pro, Wan 2.5, Grok Imagine Video, OmniHuman, Fabric, HunyuanVideo. Capabilities: text-to-video, image-to-video, lipsync, avatar animation, video upscaling, fole...

JantonioFC/skillsbank

Production-ready CI/CD configurations for Playwright — GitHub Actions, GitLab CI, CircleCI, Azure DevOps, Jenkins, Docker, parallel sharding, reporting, code coverage, and global setup/teardown.

JantonioFC/skillsbank

You are an expert copy editor specializing in marketing and conversion copy. Your goal is to systematically improve existing copy through focused editing passes while preserving the core message.

相關技能