跳到正文
Skillpedia
视频剪辑48k · #5611

remotion-interactivity

它能做什么

这个工具可以让你的 Remotion 视频变得更具交互性。它允许你直接在编辑器里控制文字、图片等元素,比如选中、移动、缩放和旋转。

适用场景

  • ✓当你希望观众能够与视频中的元素互动时。
  • ✓当你要制作某些部分需要可编辑的视频时。
  • ✓想要简化 Remotion 视频中样式和动画的编辑方式时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/remotion-interactivity/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/remotion-interactivity/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我怎样才能让视频标题在编辑器里可以被选中和缩放?”

每周 5 个新技能,1 分钟读完。

工作原理

你需要在想要变得可交互的 HTML 元素外面包裹一种特殊代码 `Interactive`。同时要为每个元素起一个名字,并且把样式和动画写得简单直接。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

When to Use

  • Use when this upstream workflow matches the user's stated goal.
  • Use when the task requires the procedures documented in this skill.

By writing Remotion markup in a specific way, the Remotion Studio is able to recognize the structure of the code and makes it interactive:

  • Allowing items to be selected by clicking on them
  • Allowing drag+drop, resizing and rotation
  • Editing the CSS styles
  • Making keyframes and easing values editable

If the markup is too complex for the Studio to make it interactive, then the values become grayed out.

Make an HTML element interactive using Interactive

Every HTML and SVG element (except <Img>, it already is interactive) such as <div> can be turned interactive using Interactive:

<Interactive.Div
  name="Greeting card"
  style={{fontSize: 80, padding: 24}}
>
  Hello
</Interactive.Div>

This allows styles and keyframes to be set in the Studio. Be sensible, if a component has many elements, the timeline might get messy.

Prefer inline text

If text is fixed and only used once, write it directly inside the interactive element instead of extracting it into a constant.

// 👍 Fixed copy stays editable
<Interactive.Div name="Title">
  Remotion Best Practices
</Interactive.Div>

Use a prop or variable only when the text is dynamic or reused.

Give interactive elements a descriptive name

Add a name prop to elements to make them easily identifyable. Avoid computed names, hardcode them.

<>
  <Interactive.Div name="Hero title" style={{fontSize: 80}}>
    Launch day
  </Interactive.Div>
  <Img name="Avatar" src="https://remotion.media/image.jpeg" />
  <Video name="Background" src="https://remotion.media/video.mp4" />
  <Sequence name="Title">
    Launch day
  </Sequence>
</>

Keep all CSS styles inline

The best way is to just pass a plain object to style - no referring to constants, no object spreading, no math.

<Interactive.Div
  style={{
    fontSize: 80,
    color: 'red',
  }}
>
  Hello World!
</Interactive.Div>
const baseStyle = useMemo(() => {
  return {
    fontSize: 12 // ❌ Non-inline styles are not supported
  }
}, []);

<Interactive.Div
  style={{
    ...baseStyle, // ❌ Spreading is not supported
    color: RED, // ❌ Referring to constants is not supported
    scale: frame * 10 // ❌ Math is not supported
  }}
>
  Hello World!
</Interactive.Div>

Animate using interpolate()

Write animations as inline interpolate() calls on the property that changes.
The output range, easing, extrapolation and output property should use hardcoded values.

The input range may additionally use durationInFrames, fps, width and height destructured directly from useVideoConfig(). Bare identifiers such as durationInFrames, multiplication with a number such as 2 * fps or fps * 2, and subtraction of a number such as durationInFrames - 1 are supported.

const {fps, durationInFrames} = useVideoConfig();

// 👍 Inline values can be standardized and keyframed
<Interactive.Div
  name="Product card"
  style={{
    color: 'white',
    fontSize: 80,
    scale: interpolate(frame, [0, fps], [0, 1], {
      easing: Easing.spring({damping: 200}),
      output: 'perceptual-scale',
      extrapolateLeft: 'clamp',
      extrapolateRight: 'clamp'
    }),
    rotate: interpolate(frame, [0, 1 * fps], ['0deg', '20deg'], {
      easing: Easing.spring({damping: 200}),
      extrapolateLeft: 'clamp',
      extrapolateRight: 'clamp'
    }),
    translate: interpolate(
      frame,
      [durationInFrames - 30, durationInFrames],
      ['0px 0px', '0px 120px'],
      {
        easing: Easing.spring({damping: 200}),
        output: 'perceptual-scale',
        extrapolateLeft: 'clamp',
        extrapolateRight: 'clamp'
      }
    ),
  }}
/>
const translateY = interpolate(frame, [0, 30], [0, 120]); // ❌ Math should be directly in the markup

<Interactive.Div
  name="Product card"
  style={{
    translate: translateY, // ❌ Only inline interpolate() calls are supported,
    rotate: interpolate(frame, [start, start + 10], [0, Math.PI]), // ❌ Cannot use math with arbitrary variables, cannot use constants
    scale: interpolate(anyVariable, [0, 30], [0, 1]) // ❌ Can only interpret the `frame` variable.
  }}
/>

…
常见问题

这里的“交互性”是什么意思?

意思是你可以在 Remotion 编辑器里点击、拖动、缩放和旋转视频中的元素,操作方式类似于设计软件里处理对象。

为什么我需要用特定的方式来写代码?

Remotion 编辑器会查找代码中的特定写法,以此判断视频中哪些部分可以被控制。按照这种方式书写,编辑器才能理解代码并提供交互选项。

什么都可以做动画吗?

你可以用 `interpolate()` 这个函数为缩放、旋转、位置等属性制作动画,但这些数值需要直接写在代码里,不能依赖复杂的计算或外部变量。

详情

作者的原始描述

Structure Remotion markup for interactivity

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5611
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能