用途:这是在用 Remotion(基于 React 的程序化视频框架)编写组件、制作动画和渲染视频时查阅的 API 参考。
主要能力:核心 API 包括 useCurrentFrame、useVideoConfig 获取当前帧与视频参数;interpolate 做帧驱动的数值插值动画(可配 Easing 缓动);spring 做基于物理的 0→1 弹性动画;AbsoluteFill 为全屏绝对定位容器;Sequence 控制场景起始帧与时长,可用 premountFor 提前渲染;Composition 在 Root.tsx 注册渲染目标。Easing 参考涵盖 linear、ease、in/out/inOut(cubic) 与 bezier。
过渡:通过 @remotion/transitions 的 TransitionSeries 替代手动计算偏移,总时长会因过渡自动缩短;内置 fade、slide、wipe、clockWipe、flip,配 linearTiming 或 springTiming。
Player:@remotion/player 可在浏览器实时预览合成,无需渲染文件,支持 inputProps、controls、autoPlay 等配置,并通过 PlayerRef 调用 seekTo()、play()、pause()。
渲染:CLI 提供 npx remotion studio、npx remotion render src/index.ts CompositionId out/video.mp4、npx remotion still ... --frame=100 与 npx remotion benchmark;主要标志含 --codec(h264/h265/vp8/vp9/av1)、--concurrency、--scale。remotion.config.ts 可设置图像格式、覆盖输出与自定义 Webpack。
性能优化:用 benchmark 测量最佳并发;无透明需求时用 JPEG 替代 PNG;用 useMemo/useCallback 缓存重计算;--log=verbose 定位慢帧;--scale 降分辨率测试;注意 GPU 加速 CSS(box-shadow、filter: blur())在云端渲染可能成为瓶颈。
限制:该资料未提供安装步骤、版本要求、收费与授权细节;文中提及 acknowledgeRemotionLicense 暗示存在许可要求,具体要求暂未提供。