LinearGradientPaintOptions
Options for creating a linear gradient paint. If start/end are not provided, they default to the left and right edges of the shape bounds, vertically centered.
LinearGradientPaintOptions interface
Options for creating a linear gradient paint. If start/end are not provided, they default to the left and right edges of the shape bounds, vertically centered.
Signature:
interface LinearGradientPaintOptionsExample
// Create a linear gradient with defined start and end positions
group.createFill({
type: "GRADIENT_LINEAR",
start: { x: 0, y: 100 },
end: { x: 200, y: 100 },
stops: [
{ color: { r: 255, g: 0, b: 0 }, offset: 0, opacity: 1 },
{ color: { r: 0, g: 0, b: 255 }, offset: 1, opacity: 1 },
],
});
// Create a linear gradient spanning the shape width
group.createFill({
type: "GRADIENT_LINEAR",
stops: [
{ color: { r: 255, g: 0, b: 0 }, offset: 0, opacity: 1 },
{ color: { r: 0, g: 0, b: 255 }, offset: 1, opacity: 1 },
],
});Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
(Optional) The end point of the gradient. If not provided, defaults to the right edge of the shape bounds, vertically centered. | |||
(Optional) The start point of the gradient. If not provided, defaults to the left edge of the shape bounds, vertically centered. | |||
Array of color stops defining the gradient | |||
"GRADIENT_LINEAR" |