Motion kit command

file.render

Render Preview

Renders what the Composition viewer shows of a composition at a time, as a PNG, without moving the current time or opening the comp: `target.time` (seconds from the start of the comp, comp time) for one frame, or `target.range` [from, to] with `target.frames` (2 to 12) for a contact sheet of frames laid out in a grid, each labelled with its time. `target.comp` names the comp by its item id; without it, the project's main comp (the only one no other comp uses as a layer). Without a target it answers a contact sheet of the whole comp. Changes nothing.

Kit
Motion 0.1.0 (.kmotion)
Changes the document
no

Parameters

Parameters of file.render
NameTypeRequiredDescription
maxSizeintegernoThe most pixels on the picture's longer side, 16 to 4096 (default 1024).
scalenumbernoPicture pixels per comp pixel, above 0 and at most 2 (default 1). A contact sheet's frames are each drawn at this scale. Reduced so the picture fits `maxSize`.
targetobjectnoWhat to show. `time` alone shows one frame; `range` with `frames` a contact sheet; neither, the whole comp as a contact sheet.

Call through motion_run

text
motion_run {
  "path": "<file>.kmotion",
  "steps": [{ "command": "file.render" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: maxSize, scale, target. motion_run answers the step’s result in completed[i].result.

Result

Result of file.render
NameTypeRequiredDescription
columnsintegeryes
compintegeryesThe composition drawn.
framesany[]yesEach frame drawn, in reading order: {time (comp seconds at the frame's start), frame (counted from 0), label}.
heightintegeryes
mimeTypestringyes
pngstringyesThe picture as base64 PNG.
rowsintegeryes
scalenumberyesThe scale each frame was drawn at, after `maxSize`.
widthintegeryes
Result JSON Schema
json
{
  "additionalProperties": false,
  "properties": {
    "columns": {
      "type": "integer"
    },
    "comp": {
      "description": "The composition drawn.",
      "type": "integer"
    },
    "frames": {
      "description": "Each frame drawn, in reading order: {time (comp seconds at the frame's start), frame (counted from 0), label}.",
      "items": {},
      "type": "array"
    },
    "height": {
      "type": "integer"
    },
    "mimeType": {
      "type": "string"
    },
    "png": {
      "description": "The picture as base64 PNG.",
      "type": "string"
    },
    "rows": {
      "type": "integer"
    },
    "scale": {
      "description": "The scale each frame was drawn at, after `maxSize`.",
      "type": "number"
    },
    "width": {
      "type": "integer"
    }
  },
  "required": [
    "columns",
    "comp",
    "frames",
    "height",
    "mimeType",
    "png",
    "rows",
    "scale",
    "width"
  ],
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "maxSize": {
      "description": "The most pixels on the picture's longer side, 16 to 4096 (default 1024).",
      "type": "integer"
    },
    "scale": {
      "description": "Picture pixels per comp pixel, above 0 and at most 2 (default 1). A contact sheet's frames are each drawn at this scale. Reduced so the picture fits `maxSize`.",
      "type": "number"
    },
    "target": {
      "additionalProperties": false,
      "description": "What to show. `time` alone shows one frame; `range` with `frames` a contact sheet; neither, the whole comp as a contact sheet.",
      "properties": {
        "comp": {
          "description": "The composition's item id (`comp.id` in motion_inspect). Needed when the project has several comps that no other comp uses.",
          "type": "integer"
        },
        "frames": {
          "description": "How many frames the contact sheet of `range` shows, 2 to 12 (default 6).",
          "type": "integer"
        },
        "path": {
          "description": "A diagnostic's target: `comp:<id>` (or `item:<id>`) names the comp, `comp:<id>/layer:<id>` shows the middle of that layer's time in the comp unless `time` or `range` is given.",
          "type": "string"
        },
        "range": {
          "description": "[from, to]: seconds from the start of the comp, from < to, within it. The frames are spread evenly from `from` to `to`, both included; `to` at the comp's end shows its last frame.",
          "items": {
            "type": "number"
          },
          "type": "array"
        },
        "time": {
          "description": "Seconds from the start of the comp (comp time, 0 at its first frame), from 0 to before its end. The frame showing at that time is drawn.",
          "type": "number"
        }
      },
      "type": "object"
    }
  },
  "returns": "{png (base64), mimeType, width, height, scale, comp, frames: [{time, frame, label}], columns, rows}",
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (motion_commands through @kition/[email protected], built from KitionAI/kition-motion@4719aa7). As data: commands.jsonl.