Communitygithub.com

muhammedadnank/Antigravity-Skills

使用 Remotion(React 影片創作)的最佳實務

Antigravity-Skills 是什麼?

這個 AI agent 技能專為使用 Remotion(一個基於 React 的程式化影片創作框架)的開發者設計。它提供了完整的領域知識與最佳實務,涵蓋從專案初始化、預覽到進階功能(如動畫、字幕、音訊可視化、3D 內容與轉場效果)的指導。支援包括 Claude Code、Cursor 和 Codex 在內的多種平台,能協助 AI agent 在處理 Remotion 專案時提供精確的指引,避免常見錯誤(例如禁止使用 CSS 過渡或 Tailwind 動畫類別),確保影片正確渲染。透過結構化的規則檔與程式碼範例,這個技能讓 AI agent 能高效地引導使用者開發 Remotion 影片。

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

在你喜歡的 AI 中提問

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

預覽

來自技能 README

說明文件

使用時機

每當處理 Remotion 程式碼時,使用此技能以取得領域特定知識。

新專案設定

當處在一個空資料夾或工作區,且沒有任何現有 Remotion 專案時,使用以下指令建立一個新專案:

npx create-video@latest --yes --blank --no-tailwind my-video

將 my-video 替換為合適的專案名稱。

設計影片

使用 useCurrentFrame() 和 interpolate() 來為屬性製作動畫。使用 Easing 來自訂動畫的時序。

import { useCurrentFrame, Easing } from "remotion";

export const FadeIn = () => {
  const frame = useCurrentFrame();
  const { fps } = useVideoConfig();

  const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {
    extrapolateRight: "clamp",
    extrapolateLeft: "clamp",
    easing: Easing.bezier(0.16, 1, 0.3, 1),
  });

  return <div style={{ opacity }}>Hello World!</div>;
};

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

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

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

使用 <Img> 元件新增圖片:

import { Img, staticFile } from "remotion";

export const MyComposition = () => {
  return <Img src={staticFile("logo.png")} style={{ width: 100, height: 100 }} />;
};

使用 @remotion/media 中的 <Video> 元件新增影片:

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

export const MyComposition = () => {
  return <Video src={staticFile("video.mp4")} style={{ opacity: 0.5 }} />;
};

使用 @remotion/media 中的 <Audio> 元件新增音訊:

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

export const MyComposition = () => {
  return <Audio src={staticFile("audio.mp3")} />;
};

素材也可以使用遠端 URL 引用:

import { Video } from "@remotion/media";

export const MyComposition = () => {
  return <Video src="https://remotion.media/video.mp4" />
};

若要延遲內容,請將其包裹在 <Sequence> 中並使用 from。 若要限制元素的持續時間,請使用 <Sequence> 的 durationInFrames。 <Sequence> 預設是絕對填滿。對於內聯內容,請使用 layout="none"。

import { Sequence } from "remotion";

export const Title = () => {
  const frame = useCurrentFrame();
  const { fps } = useVideoConfig();

  const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {
    extrapolateRight: "clamp",
    extrapolateLeft: "clamp",
    easing: Easing.bezier(0.16, 1, 0.3, 1),
  });

  return <div style={{ opacity }}>Title</div>;
};

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

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

  return (
    <AbsoluteFill>
      <Sequence>
        <Background />
      </Sequence>
      <Sequence from={1 * fps} durationInFrames={2 * fps} layout="none">
        <Title />
      </Sequence>
      <Sequence from={2 * fps} durationInFrames={2 * fps} layout="none">
        <Subtitle />
      </Sequence>
    </AbsoluteFill>
  );
}

影片的寬度、高度、fps 和持續時間在 src/Root.tsx 中定義:

import { Composition } from "remotion";
import { MyComposition } from "./MyComposition";

export const RemotionRoot = () => {
  return (
    <Composition
      id="MyComposition"
      component={MyComposition}
      durationInFrames={100}
      fps={30}
      width={1080}
      height={1080}
    />
  );
};

中繼資料也可以動態計算:

import { Composition, CalculateMetadataFunction } from "remotion";
import { MyComposition, MyCompositionProps } from "./MyComposition";

const calculateMetadata: CalculateMetadataFunction<
  MyCompositionProps
> = async ({ props, abortSignal }) => {
  const data = await fetch(`https://api.example.com/video/${props.videoId}`, {
    signal: abortSignal,
  }).then((res) => res.json());

  return {
    durationInFrames: Math.ceil(data.duration * 30),
    props: {
      ...props,
      videoUrl: data.url,
    },
    width: 1080,
    height: 1080,
  };
};

export const RemotionRoot = () => {
  return (
    <Composition
      id="MyComposition"
      component={MyComposition}
      fps={30}
      width={1080}
      height={1080}
      defaultProps={{ videoId: "abc123" }}
      calculateMetadata={calculateMetadata}
    />
  );
};

啟動預覽

啟動 Remotion Studio 來預覽影片:

npx remotion studio

可選:單幀渲染檢查

你可以使用 CLI 渲染單一幀,以快速檢查版面、顏色或時序。 對於簡單的修改、純重構或當你已從 Studio 或先前的渲染中獲得足夠信心時,可以跳過此步驟。

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

在 30 fps 下,--frame=30 表示 1 秒鐘的位置(--frame 從 0 開始)。

字幕

處理字幕時,請載入 ./rules/subtitles.md 檔案以獲取更多資訊。

使用 FFmpeg

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

靜音檢測

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

音訊可視化

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

音效

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

3D 內容

請參閱 rules/3d.md 了解如何在 Remotion 中使用 Three.js 和 React Three Fiber 建立 3D 內容。

進階音訊

請參閱 rules/audio.md 了解進階音訊功能,例如修剪、音量、速度和音高。

動態持續時間、尺寸與數據

請參閱 rules/calculate-metadata.md 了解如何動態設定組合的持續時間、尺寸和 props。

進階組合

請參閱 rules/compositions.md 了解如何定義靜態影像、資料夾、預設 props 以及如何嵌套組合。

Google Fonts

這是在 Remotion 中載入字型的推薦方式。請參閱 rules/google-fonts.md 了解如何載入 Google Fonts。

本地字型

請參閱 rules/local-fonts.md 了解如何載入本地字型。

取得音訊長度

請參閱 rules/get-audio-duration.md 了解如何使用 Mediabunny 以秒為單位取得音訊檔案的長度。

取得影片尺寸

請參閱 rules/get-video-dimensions.md 了解如何使用 Mediabunny 取得影片檔案的寬度和高度。

取得影片長度

請參閱 rules/get-video-duration.md 了解如何使用 Mediabunny 以秒為單位取得影片檔案的長度。

GIF

請參閱 rules/gifs.md 了解如何顯示與 Remotion 時間軸同步的 GIF。

進階圖片

請參閱 rules/images.md 了解圖片的尺寸調整與定位、動態圖片路徑以及取得圖片尺寸。

光暈效果

請參閱 rules/light-leaks.md 了解如何使用 @remotion/light-leaks 製作光暈疊加效果。

Lottie 動畫

請參閱 rules/lottie.md 了解如何在 Remotion 中嵌入 Lottie 動畫。

Canvas 中的 HTML

如果你需要將 HTML 渲染到 <canvas> 中,以透過 <HtmlInCanvas> 套用 2D 或 WebGL 效果,請參閱 rules/html-in-canvas.md。

測量 DOM 節點

請參閱 rules/measuring-dom-nodes.md 了解如何在 Remotion 中測量 DOM 元素的尺寸。

測量文字

請參閱 rules/measuring-text.md 了解如何測量文字尺寸、將文字適配到容器以及檢查溢位。

進階序列化

請參閱 rules/sequencing.md 了解更多序列化模式——延遲、修剪、限制項目的持續時間。

TailwindCSS

請參閱 rules/tailwind.md 了解如何在 Remotion 中使用 TailwindCSS。

文字動畫

請參閱 rules/text-animations.md 了解排版與文字動畫模式。

進階時序

請參閱 rules/timing.md 了解進階時序,包含 interpolate、貝茲緩動以及彈簧效果。

轉場效果

請參閱 rules/transitions.md 了解場景轉場模式。

透明影片

請參閱 rules/transparent-videos.md 了解如何渲染出具有透明背景的影片。

修剪

請參閱 rules/trimming.md 了解修剪模式——剪裁動畫的開頭或結尾。

進階影片

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

參數化影片

請參閱 rules/parameters.md 了解如何透過新增 Zod schema 來使組合可參數化。

地圖

對於簡單且帶少量飛越效果的地圖,請考慮使用靜態地圖圖片。 對於具有動畫路線或飛越效果的複雜地圖,請載入地圖規則:rules/maplibre.md

旁白

請參閱 rules/voiceover.md 了解如何使用 ElevenLabs TTS 在 Remotion 組合中加入 AI 生成的旁白。

Individual skills in this repo

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

muhammedadnank/Antigravity-Skills

Build a premium cinematic landing page with mouse-scrub video hero and brand-driven narrative-arc sections. Use whenever the user provides a hero video plus a product / subject / brand and wants a landing page, promo site, product showcase, marketing page, or storytelling site. Works for any language and any subject. The signature effect is mouse-driven video scrubbing \u2014 the hero video lives across the entire page as a fixed backdrop, and moving the mouse left-right scrubs the video timeline so the subject responds to the cursor. Below the hero, 4-5 fully-opaque sections each carry their own brand identity (color, typography emphasis, layout pattern) and walk the viewer through a narrative arc (e.g. longing -> joy -> nostalgia -> contemplation -> action). Do NOT use for parallax frame-scrub landings where the page itself doesn't scroll (use parallax-landing-page instead) or for video editing / captioning workflows (use video-edit).

muhammedadnank/Antigravity-Skills

Generates high-converting Next.js/React landing pages with Tailwind CSS. Uses PAS, AIDA, and BAB frameworks for optimized copy/components (Heroes, Features, Pricing). Focuses on Core Web Vitals/SEO.

muhammedadnank/Antigravity-Skills

Build a scroll-driven cinematic landing page from a short video. The user provides a 5–15 second video (often AI-generated); this skill extracts every frame at HD JPEG quality, then produces a single-hero HTML page where the user's scroll gesture scrubs the frames in place (the page itself never scrolls) and 5 dramatic text overlays crossfade in/out — Google Anton headlines, Caveat handwritten accents, locked body, virtual scroll. Use this skill whenever the user wants to "turn this video into a landing page", "make a scroll-scrub landing page", "build a parallax hero from this clip", "add a new landing page to the parasites showcase", "do the same as github/lion/hope for this new video", or any variant that pairs a short clip with dramatic scroll-triggered storytelling. Trigger even if the user only says "use my video for a landing page" — that is this skill.

muhammedadnank/Antigravity-Skills

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.

muhammedadnank/Antigravity-Skills

Turn any video into a cinematic scroll-driven landing page — Apple-style hero where scrolling progresses the visible frame through the video. Use when the user provides a video file and asks for "a landing page from this video", "scroll-frame website", "Apple-style scroll site", "hero that scrubs the video", "like the GitHub Copilot landing", or any equivalent. Extracts N evenly-spaced frames via ffmpeg, builds a self-contained HTML page with a sticky hero + JS scroll listener that swaps the visible frame as you scroll, plus headline, sections and CTA below. For YUV.AI projects, applies the yuv-design-system skill in Neon mode (pink/cyan/white, default for YUV.AI web) — Decks (purple/yellow) is reserved for slides only. For generic / non-YUV.AI projects, picks an appropriate palette per the source video. Output is one folder with `index.html` and a `frames/` directory — drop on any static host.

相關技能