Referência de elementos

Elemento layout

1. Estrutura

interface LayoutClip extends BaseClip {
  type: "layout";
  direction?: "horizontal" | "vertical";
  gap?: number;
  padding?: number | [number, number, number, number];
  alignItems?: "start" | "center" | "end" | "stretch";
  justifyContent?:
    | "start"
    | "center"
    | "end"
    | "space-between"
    | "space-around";
  clip?: boolean;
  children: Clip[];
}

2. Campos implementados atualmente

  • direction
  • gap
  • padding
  • alignItems
  • justifyContent
  • clip
  • children

3. Tipos de elemento atualmente permitidos em children

  • video
  • image
  • text
  • rect
  • circle
  • polygon
  • audio
  • layout
  • template

Atualmente não suportado diretamente como filho:

  • subtitle

4. Limitação mais importante

layout.children não é uma timeline aninhada independente.

  • Elementos filhos não são agendados individualmente pelo próprio start
  • Elementos filhos não se comportam como clips top-level totalmente independentes
  • Você não deve modelar children como um scene graph aninhado completo
  • animations / keyframes / transition dentro de children não devem ser interpretados com as premissas de clips top-level

5. Exemplo

{
  "type": "layout",
  "start": 0,
  "duration": 6,
  "direction": "vertical",
  "gap": 24,
  "padding": 32,
  "transform": {
    "x": "50%",
    "y": "50%",
    "width": "80%",
    "height": "60%"
  },
  "children": [
    {
      "type": "text",
      "start": 0,
      "duration": 6,
      "text": "Title",
      "style": {
        "fontSize": 56,
        "fill": "#ffffff"
      }
    },
    {
      "type": "rect",
      "start": 0,
      "duration": 6,
      "transform": {
        "width": "100%",
        "height": 120
      },
      "style": {
        "fill": "#1f2937",
        "borderRadius": 16
      }
    }
  ]
}