Add radial gradient
add_radial_gradientDefine a radial gradient centered at (cx, cy) with radius r and optional focal point. After defining, apply the gradient as a fill using set_fill.
Instructions
Add a <radialGradient> to the document <defs> (created if absent).
When to use: defining a centred/radial colour fade to paint with. For a directional fade use
add_linear_gradient; after defining, apply via set_fill(doc_id, ids, "url(#gradient-id)").
Key params: stops is a list of {offset, color, opacity?} (≥ 1), as for the linear gradient.
Centred at (cx, cy) with radius r (numbers or percentages; default a centred 50% circle);
fx / fy optionally set the focal point.
Return shape: CreateResult — object_id is the gradient id (use as url(#id) paint),
bbox=None, plus the pipeline fields.
Example: add_radial_gradient(doc_id, [{"offset": 0, "color": "#fff"}, {"offset": 1, "color": "#000"}])
Render and look before you trust this edit: render with render_preview (or live_render_view)
and inspect the result before relying on it; restore_snapshot reverts it if it is wrong.
Risk class: medium (reversible write-new on the working copy; original untouched).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| r | No | 50% | |
| cx | No | 50% | |
| cy | No | 50% | |
| fx | No | ||
| fy | No | ||
| stops | Yes | ||
| doc_id | Yes | ||
| object_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bbox | No | ||
| doc_id | Yes | ||
| changed | Yes | ||
| summary | No | ||
| object_id | Yes | ||
| snapshot_id | Yes | ||
| operation_id | Yes | ||
| preview_after | No | ||
| preview_before | No |