用途
@json-render/remotion 是 json-render 的 Remotion 渲染器,作用是把 JSON 时间线规格(Timeline Spec)转换成视频合成(video compositions)。当需要以结构化 JSON 描述视频内容、再交由 Remotion 渲染时使用。
主要能力
- 提供 Renderer 组件,将 spec 渲染为 Remotion 合成。
- 提供 schema(时间线 schema)。
- 提供 standardComponents(预构建组件注册表)与 standardComponentDefinitions(目录定义)。
- 提供 standardTransitionDefinitions(标准转场定义)与 standardEffectDefinitions(标准特效定义)。
- 提供 useTransition(转场动画 hook)与 ClipWrapper(为片段包裹转场)。
- 支持通过 defineCatalog 定义目录,并可用 zod 添加自定义组件。
使用方式
快速开始:使用 @remotion/player 的 Player,将 component 设为 Renderer,inputProps 传入 { spec },并设置 durationInFrames、fps、compositionWidth、compositionHeight 等参数。
使用标准组件:通过 defineCatalog(schema, { components: standardComponentDefinitions, transitions: standardTransitionDefinitions, effects: standardEffectDefinitions }) 定义 videoCatalog。
添加自定义组件:在 defineCatalog 的 components 中展开 standardComponentDefinitions,并加入自定义组件(例如 MyCustomClip,props 用 z.object({ text: z.string() }),type 为 "scene",defaultDuration 为 90,description 为自定义描述)。随后在 Renderer 的 inputProps 中传入 components: { MyCustomClip: MyCustomComponent }。
时间线规格结构包含:composition(id、fps、width、height、durationInFrames)、tracks(id、name、type、enabled)、clips(id、trackId、component、props、from、durationInFrames)、audio(tracks)。
标准组件
- TitleCard:scene,全屏标题与副标题。
- TypingText:scene,终端风格打字动画。
- ImageSlide:image,全屏图片展示。
- SplitScreen:scene,双面板对比。
- QuoteCard:scene,带署名的引用卡片。
- StatCard:scene,动画统计数字展示。
- TextOverlay:overlay,文字叠加层。
- LowerThird:overlay,姓名/标题叠加层。
关键导出
- Renderer:将 spec 渲染为 Remotion 合成。
- schema:时间线 schema。
- standardComponents:预构建组件注册表。
- standardComponentDefinitions:目录定义。
- useTransition:转场动画 hook。
- ClipWrapper:为片段包裹转场。
适用场景
适合以 JSON 时间线规格驱动视频合成、在 React/Remotion 项目中构建视频播放器或视频生成流程的开发场景,尤其是需要复用标准组件、转场与特效,或扩展自定义视频片段的项目。
限制
资料未提供收费、价格、平台支持范围、性能表现或具体效果等信息,暂未提供。