Motion kit command

layer.newShape

Shape Layer

Adds a new shape layer with one shape: `kind` rect, rounded, ellipse, polygon or star (none for an empty layer) of `size` [w, h] (default 300 × 300), centred at `position`. Paint: `fill` (default blue) or `fillGradient` (two or more colours, `fillAngle` in degrees, `fillType: radial` for a radial one), and `stroke` with `strokeWidth`; the Tools bar's paint is not used. Returns the layer.

Kit
Motion 0.1.0 (.kmotion)
Changes the document
yes

Parameters

Parameters of layer.newShape
NameTypeRequiredDescription
compinteger | stringnoread by the command beside its listed parameters
fillstring | number[] | booleannoa colour, "#rrggbb" or [r, g, b] (0 to 1), or false for none
fillAngleanynodeg
fillBlendstringnoa blend mode name (normal, multiply, …)
fillGradientany[]no
fillOpacitynumbernopercent, 0 to 100
fillType"none" | "solid" | "linear" | "radial"no
kind"rect" | "rounded" | "ellipse" | "star" | "polygon" | "none"no
namestringno
positionany[]no
sizenumber[] | numbernopixels: [w, h], or one number for both
strokestring | number[] | booleannoa colour, "#rrggbb" or [r, g, b] (0 to 1), or false for none
strokeAngleanyno
strokeBlendstringnoa blend mode name (normal, multiply, …)
strokeGradientanyno
strokeOpacitynumbernopercent, 0 to 100
strokeType"none" | "solid" | "linear" | "radial"no
strokeWidthnumberno

Call through motion_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: comp, fill, fillAngle, fillBlend, fillGradient, fillOpacity, fillType, kind, name, position, size, stroke, strokeAngle, strokeBlend, strokeGradient, strokeOpacity, strokeType, strokeWidth. motion_run answers the step’s result in completed[i].result.

Result

The kit gives no result schema for this command.

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "comp": {
      "description": "read by the command beside its listed parameters",
      "oneOf": [
        {
          "description": "comp's item id as motion_inspect lists it",
          "type": "integer"
        },
        {
          "description": "the item id as receipts print it (\"1\"), or the comp's name",
          "type": "string"
        }
      ],
      "x-khp-name": "name",
      "x-khp-types": [
        "Item"
      ]
    },
    "fill": {
      "description": "a colour, \"#rrggbb\" or [r, g, b] (0 to 1), or false for none",
      "oneOf": [
        {
          "description": "#rrggbb",
          "type": "string"
        },
        {
          "description": "[r, g, b], 0 to 1",
          "items": {
            "type": "number"
          },
          "type": "array"
        },
        {
          "description": "false for none",
          "type": "boolean"
        }
      ]
    },
    "fillAngle": {
      "description": "deg"
    },
    "fillBlend": {
      "description": "a blend mode name (normal, multiply, …)",
      "type": "string"
    },
    "fillGradient": {
      "type": "array"
    },
    "fillOpacity": {
      "description": "percent, 0 to 100",
      "type": "number"
    },
    "fillType": {
      "enum": [
        "none",
        "solid",
        "linear",
        "radial"
      ],
      "type": "string"
    },
    "kind": {
      "enum": [
        "rect",
        "rounded",
        "ellipse",
        "star",
        "polygon",
        "none"
      ],
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "position": {
      "items": {},
      "type": "array"
    },
    "size": {
      "description": "pixels: [w, h], or one number for both",
      "oneOf": [
        {
          "description": "[w, h]",
          "items": {
            "type": "number"
          },
          "type": "array"
        },
        {
          "description": "w and h",
          "type": "number"
        }
      ]
    },
    "stroke": {
      "description": "a colour, \"#rrggbb\" or [r, g, b] (0 to 1), or false for none",
      "oneOf": [
        {
          "description": "#rrggbb",
          "type": "string"
        },
        {
          "description": "[r, g, b], 0 to 1",
          "items": {
            "type": "number"
          },
          "type": "array"
        },
        {
          "description": "false for none",
          "type": "boolean"
        }
      ]
    },
    "strokeAngle": {},
    "strokeBlend": {
      "description": "a blend mode name (normal, multiply, …)",
      "type": "string"
    },
    "strokeGradient": {},
    "strokeOpacity": {
      "description": "percent, 0 to 100",
      "type": "number"
    },
    "strokeType": {
      "enum": [
        "none",
        "solid",
        "linear",
        "radial"
      ],
      "type": "string"
    },
    "strokeWidth": {
      "type": "number"
    }
  },
  "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.