Skills2026年3月29日·1 分钟阅读

Remotion Rule: 3D

Remotion skill rule: 3D content in Remotion using Three.js and React Three Fiber.. Part of the official Remotion Agent Skill for programmatic video in React.

TO
TokRepo精选 · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

npx skills add remotion-dev/skills

This rule activates automatically when working with 3d in a Remotion project.


介绍

3D content in Remotion using Three.js and React Three Fiber.. Part of the Remotion AI Skill — the official Agent Skill for programmatic video creation in React.

Best for: Developers using Remotion for 3d Works with: Claude Code, OpenAI Codex, Cursor


Rule Content

Using Three.js and React Three Fiber in Remotion

Follow React Three Fiber and Three.js best practices.
Only the following Remotion-specific rules need to be followed:

Prerequisites

First, the @remotion/three package needs to be installed.
If it is not, use the following command:

npx remotion add @remotion/three # If project uses npm
bunx remotion add @remotion/three # If project uses bun
yarn remotion add @remotion/three # If project uses yarn
pnpm exec remotion add @remotion/three # If project uses pnpm

Using ThreeCanvas

You MUST wrap 3D content in <ThreeCanvas> and include proper lighting.
<ThreeCanvas> MUST have a width and height prop.

import { ThreeCanvas } from "@remotion/three";
import { useVideoConfig } from "remotion";

const { width, height } = useVideoConfig();

<ThreeCanvas width={width} height={height}>
  <ambientLight intensity={0.4} />
  <directionalLight position={[5, 5, 5]} intensity={0.8} />
  <mesh>
    <sphereGeometry args={[1, 32, 32]} />
    <meshStandardMaterial color="red" />
  </mesh>
</ThreeCanvas>;

No animations not driven by useCurrentFrame()

Shaders, models etc MUST NOT animate by themselves.
No animations are allowed unless they are driven by useCurrentFrame().
Otherwise, it will cause flickering during rendering.

Using useFrame() from @react-three/fiber is forbidden.

Animate using useCurrentFrame()

Use useCurrentFrame() to perform animations.

const frame = useCurrentFrame();
const rotationY = frame * 0.02;

<mesh rotation={[0, rotationY, 0]}>
  <boxGeometry args={[2, 2, 2]} />
  <meshStandardMaterial color="#4a9eff" />
</mesh>;

Using <Sequence> inside <ThreeCanvas>

The layout prop of any <Sequence> inside a <ThreeCanvas> must be set to none.

import { Sequence } from "remotion";
import { ThreeCanvas } from "@remotion/three";

const { width, height } = useVideoConfig();

<ThreeCanvas width={width} height={height}>
  <Sequence layout="none">
    <mesh>
      <boxGeometry args={[2, 2, 2]} />
      <meshStandardMaterial color="#4a9eff" />
    </mesh>
  </Sequence>
</ThreeCanvas>;

🙏

来源与感谢

Created by Remotion. Licensed under MIT. remotion-dev/skills — Rule: 3d

Part of the Remotion AI Skill collection on TokRepo.

相关资产