remotion-elements
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseElements
Elements
An Element is a reusable video component written in React.
Element libraries publish each Element on its own page, the Element page.
Installing an Element copies its source code into the project. The user owns that copy and can edit it and combine it with other Elements like any other component.
If no Remotion project exists yet, load Create a new Remotion video ( skill) first.
remotion-createElement 是使用 React 编写的可复用视频组件。
Element 库会在各自的 Element 页面上发布每个 Element。安装 Element 会将其源代码复制到项目中。用户拥有该副本,可以像编辑其他任何组件一样编辑它,并将其与其他 Element 组合使用。
如果尚不存在 Remotion 项目,请先加载“创建新的 Remotion 视频”( skill)。
remotion-createElement libraries
Element 库
Any website can be an Element library, and all Element libraries are peers.
Fetch https://www.remotion.dev/elements/libraries.md for the current list of Element libraries, with each library URL and Markdown index.
The CLI needs an Element page URL. To find one in an Element library that is not listed, fetch its Markdown index, usually at on its domain or by appending to a page.
/llms.txt.md任何网站都可以成为 Element 库,并且所有 Element 库彼此对等。
获取 https://www.remotion.dev/elements/libraries.md 获取当前 Element 库列表,其中包含每个库的 URL 和 Markdown 索引。
CLI 需要 Element 页面 URL。若要在未列出的 Element 库中查找 Element,请获取该库的 Markdown 索引;该索引通常位于其域名的 路径下,或可通过在页面 URL 后附加 获取。
/llms.txt.mdInstall an Element library
安装 Element 库
Installing an Element library lists it in Browse Elements in Remotion Studio, where the user can preview its Elements and drag them into a composition.
Before adding an Element from an Element library, install the library. Run exactly:
bash
npx remotion elements add-library <library-url>- Use the library URL from the list of Element libraries, or the URL the user gave.
- The command adds a call to
Config.addElementLibrary(). If the library is already in the config, it changes nothing.remotion.config.ts - It reads the display name from the library's page. Pass to override it.
--display-name <name> - : create
No Remotion config file foundwithremotion.config.tsand run the command again.import {Config} from '@remotion/cli/config'; - Requires Remotion 4.0.547 or later. On older versions, add the call to
Config.addElementLibrary({url: '<library-url>'})yourself.remotion.config.ts
安装 Element 库后,它会列在 Remotion Studio 的 Browse Elements 中,用户可以预览其中的 Element 并将其拖入 composition。
在添加 Element 库中的 Element 之前,请先安装该库。准确运行:
bash
npx remotion elements add-library <library-url>- 使用 Element 库列表中的 URL,或用户提供的 URL。
- 此命令会向 添加
remotion.config.ts调用。如果配置中已有该库,则不会进行任何更改。Config.addElementLibrary() - 它会从库页面读取显示名称。传入 可覆盖该名称。
--display-name <name> - : 使用
No Remotion config file found创建import {Config} from '@remotion/cli/config';,然后重新运行该命令。remotion.config.ts - 需要 Remotion 4.0.547 或更高版本。在较旧版本上,请自行在 中添加
remotion.config.ts调用。Config.addElementLibrary({url: '<library-url>'})
Add an Element
添加 Element
Copy this checklist and track progress:
- [ ] 1. Get the Element page URL and install its Element library
- [ ] 2. Dry run succeeds
- [ ] 3. Element installed
- [ ] 4. Element adapted and previewed复制此清单并跟踪进度:
- [ ] 1. Get the Element page URL and install its Element library
- [ ] 2. Dry run succeeds
- [ ] 3. Element installed
- [ ] 4. Element adapted and previewed1. Get the Element page URL and install its Element library
1. 获取 Element 页面 URL 并安装其 Element 库
- Given an Element page URL: use it.
- Given an Element library URL or a name: fetch the library's Markdown index, pick the Element the user asked for, and use its Element page URL.
- Not given anything: search the Markdown indexes of the Element libraries for an Element that fits the video.
Markdown indexes link to Markdown documents, which the installer cannot use.
Fetch the Element's Markdown document and use the Element page URL it names near the top, for example after or .
If it names none, remove from the document's URL.
Element page:URL:.mdIf the Element comes from a known Element library, install the library. Given only an Element page URL, skip this.
- 提供了 Element 页面 URL: 使用该 URL。
- 提供了 Element 库 URL 或名称: 获取该库的 Markdown 索引,选择用户所需的 Element,然后使用其 Element 页面 URL。
- 未提供任何信息: 在 Element 库的 Markdown 索引中搜索适合该视频的 Element。
Markdown 索引会链接到 Markdown 文档,而安装器无法使用这些文档。
获取 Element 的 Markdown 文档,并使用其中靠近开头处标明的 Element 页面 URL,例如 或 之后的 URL。
如果没有标明,则从该文档的 URL 中移除 。
Element page:URL:.md如果 Element 来自已知 Element 库,请安装该库。如果只提供了 Element 页面 URL,则跳过此步骤。
2. Dry run
2. 试运行
Run exactly:
bash
npx remotion elements use <element-page-url> --composition <composition-id> --dry-runRead the output and fix the cause before continuing:
- : search the page's HTML for
No Element found. If aapplication/vnd.remotion.element+jsonwith that type has an<link>, resolve thehrefagainst the Element page URL and dry run that JSON URL instead. If there is no payload, the component is not an Element. Follow the install instructions on its Markdown page, for example ahrefcommand, and skip to step 4.shadcn - Several Elements on the page: add .
--element <slug> - Composition IDs listed: pass the composition the user is working on. If that is unclear, ask.
- or
elements usenot recognized: Remotion is older than 4.0.543. Load Remotion Upgrade (--dry-runskill) or ask the user.remotion-upgrade
Repeat until the dry run prints the Element, the files it creates and changes, the packages and the assets.
准确运行:
bash
npx remotion elements use <element-page-url> --composition <composition-id> --dry-run读取输出并先修复原因,然后继续:
- : 在该页面的 HTML 中搜索
No Element found。如果类型为该值的application/vnd.remotion.element+json带有<link>,请根据 Element 页面 URL 解析该href,并改为对该 JSON URL 执行试运行。如果没有有效载荷,则该组件不是 Element。请遵循其 Markdown 页面上的安装说明,例如执行href命令,然后跳到步骤 4。shadcn - 页面中有多个 Element: 添加 。
--element <slug> - 列出了 Composition ID: 传入用户正在处理的 composition。如果不明确,则询问用户。
- 无法识别 或
elements use: Remotion 版本低于 4.0.543。请加载 Remotion Upgrade(--dry-runskill),或询问用户。remotion-upgrade
重复操作,直到试运行输出该 Element、将创建和修改的文件、软件包以及素材。
3. Install
3. 安装
Run the same command with instead of :
--yes--dry-runbash
npx remotion elements use <element-page-url> --composition <composition-id> --yesThe command installs missing packages, saves assets to , writes an file next to the composition's component and inserts the Element at frame 0.
public/.element.tsx- If the file already exists with different contents, the command fails. Add
.element.tsxonly if the user agrees.--overwrite - The Element's source code runs in the project. Install only from Element page URLs the user gave or from Element libraries the user trusts.
使用 替代 ,运行相同命令:
--yes--dry-runbash
npx remotion elements use <element-page-url> --composition <composition-id> --yes该命令会安装缺失的软件包,将素材保存到 ,在 composition 的组件旁写入一个 文件,并将该 Element 插入到第 0 帧。
public/.element.tsx- 如果 文件已存在且内容不同,命令将失败。只有在用户同意时,才添加
.element.tsx。--overwrite - Element 的源代码会在项目中运行。仅从用户提供的 Element 页面 URL 或用户信任的 Element 库安装。
4. Adapt and preview
4. 调整并预览
- Adapt the text, colors and props to the video.
- Adjust the wrapping for timing and placement.
<Sequence> - Load Remotion Markup Best Practices (skill) before editing the markup.
remotion-markup - Open the composition in Studio and check that the Element renders. Fix errors and check again.
- 根据视频调整文本、颜色和 props。
- 调整外层 ,以设置时间轴和位置。
<Sequence> - 编辑标记前,先加载 Remotion Markup 最佳实践(skill)。
remotion-markup - 在 Studio 中打开 composition,检查 Element 是否正确渲染。修复错误后再次检查。
Reference
参考
- : all flags
npx remotion elements use - Creating Elements and Building Element Libraries: for publishing Elements
- :所有标志
npx remotion elements use - 创建 Elements 和 构建 Element 库:用于发布 Elements