Add gradient fill / stroke
add_gradient_fillAdds a linear or radial gradient fill or stroke to a shape group in After Effects; note that color stops cannot be set via scripting, so edit them in the AE UI.
Instructions
Add a Gradient Fill (or Gradient Stroke with asStroke=true) to a shape group: linear/radial type, start/end points, highlight, opacity. LIMITATION: After Effects scripting cannot set gradient color stops (the Colors property is not scriptable and rejects expressions), so the gradient keeps AE's default white-to-black ramp; 'colors' is accepted but reported as not applied (colorsApplied=false). Edit colors in the AE UI, or use add_fill for a solid color.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"layer": "<layer>"
},
"name": "add_gradient_fill"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| comp | No | Composition name, 'Folder/Name' path, or item id. Omit to use the active composition. | |
| name | No | Name for the item. | |
| type | No | Gradient type (default linear). | |
| layer | Yes | Layer: 1-based index, layer name, or {id}/{index}/{name}. 'selected' = first selected layer. | |
| width | No | Gradient stroke width px (asStroke only). | |
| colors | No | Desired color stops (NOT applied: AE scripting limitation, see description). | |
| lineCap | No | Stroke line cap. | |
| opacity | No | Opacity 0-100. | |
| asStroke | No | Create a Gradient Stroke instead of a Gradient Fill. | |
| endPoint | No | End point in group coordinates (default [100,0]). | |
| fillRule | No | Fill rule for overlapping paths / holes (default nonzero). | |
| lineJoin | No | Stroke line join. | |
| groupPath | No | Shape group path inside the layer's Contents: '/'-separated Vector Group names (or 1-based indexes), e.g. 'Logo' or 'Logo/Circle'. Omit or '' for the Contents root. A leading 'Contents/' is accepted. Use list_shape_contents to see names. | |
| startPoint | No | Start point in group coordinates (default [0,0]). | |
| highlightAngle | No | Radial highlight angle degrees. | |
| highlightLength | No | Radial highlight length %. |