项目数据

属性类型必需示例值范围描述
typestringfalsevideovideo | animation项目类型(例如,“视频”或“动画”)。
widthnumbertrue1920720 - 3840项目画布的宽度。用作缩放的基础分辨率。
heightnumbertrue1080720 - 3840项目画布的高度。用作缩放的基础分辨率。
fillstring | objecttrue#000000-项目画布的背景。可以是十六进制颜色字符串(例如,“#000000”)或具有类型“线性”或“径向”的渐变对象,包含 colorStops 数组和起始/结束坐标。
durationnumbertrue10> 0项目的总持续时间(以秒为单位)。
viewarraytrue--表示项目中视觉内容的元素数组,包括 2D 元素(图像、视频、文本、形状等)和 3D 元素。此数组不能为空。
audioarrayfalse--项目中使用的音轨数组。
effectarrayfalse--应用于画布的视觉效果数组。
transitionarrayfalse--在不同视图之间应用的过渡数组。
remoteFontsarrayfalse--可以在文本和字幕元素中使用的远程字体定义数组。

远程字体

remoteFonts 字段允许您在项目中包含自定义网络字体。每个字体定义必须包含指向字体文件的直接链接(仅限 HTTPS)和字体元数据。

属性类型必需示例值范围描述
familystringtrueMy Custom Font-将在文本元素中引用此字体的字体家族名称。
urlstringtruehttps://example.com/fonts/mycustomfont.woff2-指向字体文件的直接 HTTPS URL。必须是公开可访问的链接。
weightstringfalse400100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900字体粗细。常见值为 100-900。
stylestringfalsenormalnormal, italic字体样式。
formatHintstringfalsewoff2woff2, woff, opentype, truetype字体文件的格式。这有助于浏览器优化字体加载。
unicodeRangestringfalseU+0000-00FF-可选的 Unicode 范围,以限制此字体适用的字符。

重要:

  • 字体 URL 必须使用 HTTPS 协议以确保安全
  • 字体文件必须是公开可访问的
  • 支持的格式:WOFF2(推荐)、WOFF、OpenType、TrueType
  • 您可以定义同一字体家族的多个变体,具有不同的粗细和样式

填充渐变对象

fill 字段可以接受具有以下结构的渐变对象:

属性类型必需示例值范围描述
typestringtrue-linear, radial渐变的类型。
colorStopsarraytrue--定义颜色及其在渐变中位置的颜色停靠对象数组。
startobjecttrue--渐变的起始坐标,作为具有 x 和 y 属性的对象。
endobjecttrue--渐变的结束坐标,作为具有 x 和 y 属性的对象。

颜色停靠对象

属性类型必需示例值范围描述
colorstringtrue--此停靠处的颜色值,以十六进制格式表示。
offsetnumbertrue-0 - 1此颜色停靠在渐变中的位置(0.0 到 1.0)。
projectData.json
{
  "type": "",
  "width": 1920,
  "height": 1080,
  "fill": "#000000",
  "view": [
    {
      "id": "8ecf7475-2c6c-47f9-827b-a09c7913f4c0",
      "type": "Image",
      "start": 0,
      "duration": 5,
      "trackIndex": 0,
      "x": -570.0335392757963,
      "y": -170.90659033307685,
      "blendMode": "normal",
      "anchorX": 1302,
      "anchorY": 2312,
      "rotation": 0,
      "scaleX": 0.23356401384083045,
      "scaleY": 0.23356401384083045,
      "alpha": 1,
      "skewX": 0,
      "skewY": 0,
      "keyframes": [],
      "externalUrl": "https://images.pexels.com/photos/30465303/pexels-photo-30465303.jpeg",
      "ext": "jpeg"
    }
  ],
  "audio": [],
  "effect": [],
  "transition": [],
  "remoteFonts": [
    {
      "family": "My Custom Font",
      "url": "https://example.com/fonts/mycustomfont.woff2",
      "weight": "400",
      "style": "normal",
      "formatHint": "woff2"
    },
    {
      "family": "My Custom Font",
      "url": "https://example.com/fonts/mycustomfont-bold.woff2",
      "weight": "700",
      "style": "normal",
      "formatHint": "woff2"
    }
  ],
  "version": 0,
  "duration": 5
}