Gradient

public struct Gradient

Represents a linear gradient in Sketch. Contained inside a Shape

  • Array of colors that are contained in the gradient

    Declaration

    Swift

    public let colors: [Color]
  • Position of the colors contained in the gradient. Must have the same amount of elements as colors. Range from 0 to 1.

    Declaration

    Swift

    public let locations: [CGFloat]
  • Start point. Range from (0,0) to (1,1)

    Declaration

    Swift

    public let start: CGPoint
  • end

    End point. Range from (0,0) to (1,1)

    Declaration

    Swift

    public let end: CGPoint
  • Creates a linear Gradient to be used as a background to a Shape

    Declaration

    Swift

    public init(colors: [Color], locations: [CGFloat], start: CGPoint, end: CGPoint)

    Parameters

    colors

    Colors contained in the gradient

    locations

    Control points of the gradient. Must have the same number of elements as the colors param. Must be between 0 and 1

    start

    Start point of the gradient. Used to calculate the direction of the gradient. Range from (0,0) to (1,1)

    end

    End point of the gradient. Used to calculate the direction of the gradient. Range from (0,0) to (1,1)

  • Undocumented

    Declaration

    Swift

    public init?(json: [String : Any])