RenderingVideo 文档
快速开始
从零写出第一个可用 v2 文档与首个可播放示例
快速开始
这是从零写出一个可用 v2 文档的最快路径。
1. 最小结构
先从这个骨架开始:
{
"meta": {
"version": "2.0.0",
"width": 1920,
"height": 1080,
"fps": 30,
"background": "#0b1020"
},
"tracks": [
{
"id": "main",
"clips": []
}
]
}
必填项:
meta.versionmeta.widthmeta.heightmeta.fpstracks
2. 添加第一个可见元素
{
"type": "text",
"start": 0,
"duration": 3,
"text": "Hello, world",
"transform": {
"x": "50%",
"y": "50%"
},
"style": {
"fontSize": 72,
"fontWeight": 700,
"fill": "#ffffff",
"textAlign": "center"
}
}
把这段 clip 放进 tracks[0].clips。
3. 第一个完整示例
{
"meta": {
"version": "2.0.0",
"title": "My First Video",
"width": 1920,
"height": 1080,
"fps": 30,
"background": "#0b1020"
},
"tracks": [
{
"id": "main",
"clips": [
{
"type": "text",
"start": 0,
"duration": 3,
"text": "Hello, world",
"transform": {
"x": "50%",
"y": "50%"
},
"style": {
"fontSize": 72,
"fontWeight": 700,
"fill": "#ffffff",
"textAlign": "center"
},
"animations": [
{
"type": "fadeIn",
"duration": 0.5
}
]
}
]
}
]
}
4. 接下来怎么学
- 想理解整体结构:看 基础概念
- 想先做一个文字动画:看 创建文字动画
- 想查字段规范:看 JSON 结构与字段规范