Element Reference

Layout Element

1. Shape

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. Currently implemented fields

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

3. Element types currently allowed in children

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

Currently not supported directly as a child:

  • subtitle

4. Most important limitation

layout.children is not an independent nested timeline.

  • Child elements are not scheduled individually by their own start
  • Child elements do not behave like fully independent top-level clips
  • You should not model children as a complete nested scene graph
  • animations / keyframes / transition inside children should not be interpreted with top-level clip assumptions

5. Example

{
  "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
      }
    }
  ]
}