Contents

linearGradient(_:startPoint:endPoint:options:)

Returns a shading instance that fills a linear (axial) gradient.

Declaration

static func linearGradient(_ gradient: Gradient, startPoint: CGPoint, endPoint: CGPoint, options: GraphicsContext.GradientOptions = GradientOptions()) -> GraphicsContext.Shading

Parameters

  • gradient:

    A Gradient instance that defines the colors of the gradient.

  • startPoint:

    The start point of the gradient axis.

  • endPoint:

    The end point of the gradient axis.

  • options:

    Options that you use to configure the gradient.

Return Value

A shading instance filled with a linear gradient.

Discussion

The shading instance defines an axis from startPoint to endPoint in the current user space and maps colors from gradient to lines perpendicular to the axis.

See Also

Gradients