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 LinearGradientPaintOptions

Example

// 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

end?

Vector

(Optional) The end point of the gradient. If not provided, defaults to the right edge of the shape bounds, vertically centered.

start?

Vector

(Optional) The start point of the gradient. If not provided, defaults to the left edge of the shape bounds, vertically centered.

stops

ColorStops

Array of color stops defining the gradient

type

"GRADIENT_LINEAR"

Last updated: August 5, 2026 at 11:47 AMEdit this page