Communitygithub.com

JantonioFC/skillsbank

编写 Remotion React 标记的最佳实践指南。

skillsbank 是什么?

此技能为使用 Remotion 框架开发 React 动画提供了一套全面的最佳实践。它涵盖了从基本动画属性(如使用 `useCurrentFrame()` 和 `interpolate()` 进行关键帧插值)到高级主题(如地图集成、配音、音频/视频修剪和过渡效果)的所有内容。该技能强调将 `interpolate()` 调用内联在 `style` 属性中,并优先使用 `scale`、`translate` 和 `rotate` 等 CSS 属性而非 `transform`,以在 Remotion Studio 中获得更好的可编辑性。它还提供了关于资源管理(`staticFile()` 和 `public/` 文件夹)、使用 `<Sequence>` 组件进行时间排序以及严格禁止使用可能无法正确渲染的 CSS 过渡或动画的关键指导。支持平台包括 Remotion Studio 和 CLI,此技能旨在帮助用户编写可维护、高性能且符合官方 Remotion 惯例的代码。此外,它还包含了大量指向更详细子文档的链接,内容涵盖音效、Lottie 动画、Google 字体、DOM 节点测量和 FFmpeg 集成等。

兼容平台✓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"]),
}}

// 👎 隐藏的值和变换字符串在 Studio 中更难编辑
const scale = interpolate(frame, [0, 100], [0, 1]);

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

禁止使用 CSS 过渡或动画——它们无法正确渲染。 禁止使用 Tailwind 动画类名——它们无法正确渲染。

将资源放置在项目根目录的 public/ 文件夹中。

使用 staticFile() 引用 public/ 文件夹中的文件。

使用 @remotion/media 添加视频和音频。 使用 <Img> 组件添加图片。 对 public/ 中的文件使用 staticFile(),或直接传入远程 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-fonts.md 了解如何加载 Google 字体。

本地字体

请参看 local-fonts.md 了解如何加载本地字体。

GIF

请参看 gifs.md 了解如何显示与 Remotion 时间线同步的 GIF。

高级图片

请参看 images.md 了解图片的尺寸和定位、动态图片路径以及获取图片尺寸。

Lottie 动画

请参看 lottie.md 了解如何在 Remotion 中嵌入 Lottie 动画。

高级时序

请参看 timing.md 了解使用 interpolate 和贝塞尔缓动、弹簧的高级时序。

参数化视频

请参看 parameters.md 了解如何通过添加 Zod 模式使组件可参数化。

测量 DOM 节点

请参看 measuring-dom-nodes.md 了解如何在 Remotion 中测量 DOM 元素尺寸。

测量文本

请参看 measuring-text.md 了解如何测量文本尺寸、使文本适应容器以及检查溢出。

使用 FFmpeg

对于某些视频操作,例如修剪视频或检测静音,应使用 FFmpeg。请加载 ./ffmpeg.md 文件了解更多信息。

静音检测

当需要检测并修剪视频或音频文件中的静音片段时,请加载 ./silence-detection.md 文件。

动态持续时间、尺寸和数据

请参看 calculate-metadata.md 了解如何动态设置组件的持续时间、尺寸和 props。

高级组件

请参看 compositions.md 了解如何定义静态图片、文件夹、默认 props 以及如何嵌套组件。

高级排序

请参看 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

在 30fps 时,--frame=30 代表第 1 秒标记(--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.

相关技能