remotion-markup
它能做什么
这项技能为使用 Remotion 编写 React 代码提供指导。Remotion 是一种用代码制作视频的工具。适用于制作动画视频、并希望代码能正确渲染的开发者。
适用场景
- ✓当你请智能体在 Remotion 视频中制作动画标题或场景的时候。
- ✓当使用 CSS 过渡或动画制作的动效没有出现在渲染的视频中的时候。
- ✓当你希望 Remotion 组件随时间淡入、滑动或缩放的时候。
技能链接
https://github.com/remotion-dev/remotion/blob/main/packages/codex-plugin/skills/remotion-markup/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请让我的 Remotion 视频中的标题在前两秒内淡入并向上滑动。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能告诉你的智能体,动效应由当前帧数和插值计算驱动,这是 Remotion 制作视频所需的方法。它还展示了应遵循的代码模式。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
This is guidance for writing Remotion React Markup. If this is not relevant, load Remotion Best Practices instead.
Preserve user changes
Users may make edits in the code outside of the conversation.
If you detect a surprising change made in the meanwhile, don't overwrite it, assume it was intentional or ask for confirmation.
General rules
Drive animations using useCurrentFrame() and interpolate().
CSS transition or animation will not render correctly, they need to refactored.
Tailwind animation class will not render correctly, they need to be refactored.
Use Easing.bezier() and Easing.spring() to customize timing.
Structure your markup according to Remotion Interactivity Best Practices
import { useCurrentFrame, Easing, interpolate, Interactive } from "remotion";
export const FadeIn = () => {
const frame = useCurrentFrame();
return (
<Interactive.Div
name="Title"
style={{
opacity: interpolate(frame, [0, 2 * fps], [0, 1], {
extrapolateRight: "clamp",
extrapolateLeft: "clamp",
easing: Easing.bezier(0.16, 1, 0.3, 1),
}),
}}
>
Hello World!
</Interactive.Div>
);
};
Keep the interpolate() call inline in the style prop.
Use scale, translate, rotate CSS properties over transform.
// 👍 Inline editable keyframes and transform shorthands
style={{
scale: interpolate(frame, [0, 100], [0, 1], {
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
easing: Easing.spring({damping: 200}),
output: 'perceptual-scale' // For `scale` animations, use "output: 'perceptual-scale'"
}),
translate: interpolate(frame, [0, 100], ["0px 0px", "100px 100px"], {
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
easing: Easing.spring({damping: 200}),
}),
rotate: interpolate(frame, [0, 100], ["20deg", "90deg"], {
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
easing: Easing.spring({damping: 200}),
}),
}}
// 👎 Non-inline values and transform strings become harder to edit in Studio
const scale = interpolate(frame, [0, 100], [0, 1]);
style={{
transform: `scale(${scale})`,
}}
Assets
Place assets in the public/ folder at your project root.
Use staticFile() to reference files from the public/ folder.
Media components
Add video and audio using <Video> and <Audio> from @remotion/media.
Add images using the <CanvasImage> component.
Add animated GIFs, APNG, WebP or AVIF images using <AnimatedImage>, use @remotion/gif if not using Chrome.
Use staticFile() for files in public/ or pass a remote URL directly:
import { Audio, Video } from "@remotion/media";
import { staticFile, CanvasImage, AnimatedImage } from "remotion";
export const MyComposition = () => {
return (
<>
<Video src={staticFile("video.mp4")} style={{ opacity: 0.5 }} />
<Audio src={staticFile("audio.mp3")} />
<CanvasImage
src={staticFile("logo.png")}
style={{ width: 100, height: 100 }}
/>
<Video src="https://remotion.media/video.mp4" />
<AnimatedImage src={staticFile('nyancat.gif')} />
</>
);
};
Example scene
import {
AbsoluteFill,
Easing,
Interactive,
interpolate,
useCurrentFrame,
useVideoConfig
} from "remotion";
export const Empty = () => {
const {fps} = useVideoConfig();
const frame = useCurrentFrame();
return (
<AbsoluteFill
name="Scene"
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white'
}}
>
<Interactive.Div
name="Title"
style={{
opacity: interpolate(frame, [1 * fps, 2 * fps], [0, 1], {
extrapolateRight: "clamp",
extrapolateLeft: "clamp",
easing: Easing.bezier(0.16, 1, 0.3, 1),
}),
fontSize: 88
}}
>
Title
</Interactive.Div>
<Interactive.Div
name="Subtitle"
style={{
opacity: interpolate(frame, [2 * fps, 3 * fps, 8 * fps, 10 * fps], [0, 1, 1, 0], {
extrapolateRight: "clamp",
extrapolateLeft: "clamp",
easing: [Easing.bezier(0.16, 1, 0.3, 1), Easing.linear, Easing.bezier(0.16, 1, 0.3, 1)],
}),
fontSize: 32
}}
>
Subtitle
</Interactive.D
常见问题
使用这项技能需要懂 React 吗?
Remotion 视频是用 React 编写的,因此有一些了解会有帮助。你的智能体会根据你的简单请求编写大部分代码。
为什么我的智能体不能在这里使用普通 CSS 动画?
CSS 过渡和动画无法在 Remotion 视频中正确渲染。这项技能引导智能体改用基于帧的动效。
这项技能会替我制作视频吗?
它只指导你的智能体为 Remotion 项目编写代码。你仍需要设置好 Remotion 项目才能渲染视频。
详情
热度
- GitHub 星标
- 70k
- 排名
- #3150
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …