---
title: "shape.newShape: Shape Tool — Motion kit command — Kition"
description: "Draws a shape as the shape tools do: `kind` of `size` at `position` goes into the selected shape layer's contents (or `layer`'s) as a new group, else into a new shape layer, painted with the Tools bar's Fill and Stroke (shape.toolOptions) unless given here, gradients included (`fillGradient`, `fillAngle`). Returns {layer, group}."
canonical: "https://developer.kition.ai/docs/kits/motion/commands/shape.newShape"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/motion/commands/shape.newShape](https://developer.kition.ai/docs/kits/motion/commands/shape.newShape)

# shape.newShape

**Shape Tool.** Draws a shape as the shape tools do: `kind` of `size` at `position` goes into the selected shape layer's contents (or `layer`'s) as a new group, else into a new shape layer, painted with the Tools bar's Fill and Stroke (shape.toolOptions) unless given here, gradients included (`fillGradient`, `fillAngle`). Returns {layer, group}.

- Kit: Motion 0.1.0 (.kmotion); reference: [Motion kit commands](https://developer.kition.ai/docs/kits/motion.md)
- Changes the document: yes
- Acts on: `layer` (one id), which a run step’s `on` fills

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `comp` | `integer \| string` | no | read by the command beside its listed parameters |
| `fill` | `string \| number[] \| boolean` | no | a colour, "#rrggbb" or [r, g, b] (0 to 1), or false for none |
| `fillAngle` | `any` | no | deg |
| `fillBlend` | `string` | no | a blend mode name (normal, multiply, …) |
| `fillGradient` | `any[]` | no |  |
| `fillOpacity` | `number` | no | percent, 0 to 100 |
| `fillType` | `"none" \| "solid" \| "linear" \| "radial"` | no |  |
| `kind` | `"rect" \| "rounded" \| "ellipse" \| "polygon" \| "star"` | no |  |
| `layer` | `integer \| string` | no |  |
| `name` | `string` | no | a new layer's |
| `position` | `number[]` | no | the centre |
| `size` | `number[] \| number` | no | pixels: [w, h], or one number for both |
| `space` | `"comp" \| "layer"` | no |  |
| `stroke` | `string \| number[] \| boolean` | no | a colour, "#rrggbb" or [r, g, b] (0 to 1), or false for none |
| `strokeAngle` | `any` | no |  |
| `strokeBlend` | `string` | no | a blend mode name (normal, multiply, …) |
| `strokeGradient` | `any` | no |  |
| `strokeOpacity` | `number` | no | percent, 0 to 100 |
| `strokeType` | `"none" \| "solid" \| "linear" \| "radial"` | no |  |
| `strokeWidth` | `number` | no | default the Tools bar's, shape.toolOptions |

## Call through motion_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `comp`, `fill`, `fillAngle`, `fillBlend`, `fillGradient`, `fillOpacity`, `fillType`, `kind`, `layer`, `name`, `position`, `size`, `space`, `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",
        "polygon",
        "star"
      ],
      "type": "string"
    },
    "layer": {
      "oneOf": [
        {
          "description": "layer id as motion_inspect lists it (when no layer has that id, its 1-based stack position)",
          "type": "integer"
        },
        {
          "description": "layer id as receipts print it (\"51\"), a layer name, or #n for the n-th from the top",
          "type": "string"
        }
      ],
      "x-khp-index": "#",
      "x-khp-index-numbers": true,
      "x-khp-name": "name",
      "x-khp-types": [
        "Layer"
      ]
    },
    "name": {
      "description": "a new layer's",
      "type": "string"
    },
    "position": {
      "description": "the centre",
      "items": {
        "type": "number"
      },
      "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"
        }
      ]
    },
    "space": {
      "enum": [
        "comp",
        "layer"
      ],
      "type": "string"
    },
    "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": {
      "description": "default the Tools bar's, shape.toolOptions",
      "type": "number"
    }
  },
  "returns": "{layer, group}",
  "type": "object"
}
```

Generated from the command list of @kition/motion-darwin-arm64@0.1.0 and the kit itself (motion_commands through @kition/cli@0.1.1, built from KitionAI/kition-motion@4719aa7).
