元素参考

Text 元素

1. 结构

interface TextClip extends BaseClip {
  type: "text";
  text: string;
}

2. 支持的参数

text

  • 类型:string
  • 必填:是
  • 用途:文本内容

常用样式参数

文本元素最常用:

  • style.fontFamily
  • style.fontSize
  • style.fontWeight
  • style.fontStyle
  • style.lineHeight
  • style.letterSpacing
  • style.textAlign
  • style.textWrap
  • style.fill
  • style.stroke
  • style.strokeWidth
  • style.shadowColor
  • style.shadowBlur
  • style.shadowOffset

3. 适合用途

  • 标题
  • 副标题
  • CTA
  • 模板里的文案块
  • 数字倒计时
  • 引用文本

4. 当前真实行为

  • 文本样式字段支持较完整
  • 可叠加动画、关键帧、转场
  • 文本定位依赖 transform.x / y

5. 示例

{
  "type": "text",
  "start": 1,
  "duration": 3,
  "text": "Launch Today",
  "transform": {
    "x": "50%",
    "y": "20%"
  },
  "style": {
    "fontSize": 64,
    "fontWeight": 700,
    "fill": "#ffffff",
    "textAlign": "center",
    "shadowColor": "#000000",
    "shadowBlur": 20
  },
  "animations": [
    {
      "type": "slideIn",
      "direction": "up",
      "distance": 100,
      "duration": 0.6
    }
  ]
}