background
TypeScriptget background(): ColorSwift declarationvar background: ColorThe background color, this fills any points outside the defined vertex mesh.
struct · iOS 18.0+ · SDK 27.1
nonisolated struct MeshGradientA two-dimensional gradient defined by a 2D grid of positioned colors. Each vertex has a position, a color and four surrounding Bezier control points (leading, top, trailing, bottom) that define the tangents connecting the vertex with its four neighboring vertices. (Vertices on the corners or edges of the mesh have less than four neighbors, they ignore their extra control points.) Control points may either be specified explicitly or implicitly. When rendering, a tessellated sequence of Bezier patches are created, and vertex colors are interpolated across each patch, either linearly, or via another set of cubic curves derived from how the colors change between neighbors -- the latter typically gives smoother color transitions. MeshGradient(width: 3, height: 3, points: [ .init(0, 0), .init(0.5, 0), .init(1, 0), .init(0, 0.5), .init(0.5, 0.5), .init(1, 0.5), .init(0, 1), .init(0.5, 1), .init(1, 1) ], colors: [ .red, .purple, .indigo, .orange, .white, .blue, .yellow, .green, .mint ])
get background(): ColorSwift declarationvar background: ColorThe background color, this fills any points outside the defined vertex mesh.
set background(value: Color)Swift declarationvar background: ColorThe background color, this fills any points outside the defined vertex mesh.
get colorSpace(): Gradient_ColorSpaceSwift declarationvar colorSpace: Gradient.ColorSpaceThe color space in which to interpolate vertex colors.
set colorSpace(value: Gradient_ColorSpace)Swift declarationvar colorSpace: Gradient.ColorSpaceThe color space in which to interpolate vertex colors.
get smoothsColors(): booleanSwift declarationvar smoothsColors: BoolWhether cubic (smooth) interpolation should be used for the colors in the mesh (rather than only for the shape of the mesh).
set smoothsColors(value: boolean)Swift declarationvar smoothsColors: BoolWhether cubic (smooth) interpolation should be used for the colors in the mesh (rather than only for the shape of the mesh).
static initWidthHeightBezierPointsResolvedColorsBackgroundSmoothsColorsColorSpace(width: number, height: number, bezierPoints: Array<MeshGradient_BezierPoint>, resolvedColors: Array<Color_Resolved>, background?: Color, smoothsColors?: boolean, colorSpace?: Gradient_ColorSpace): MeshGradientSwift declaration@export(implementation) nonisolated init(width: Int, height: Int, bezierPoints: [MeshGradient.BezierPoint], resolvedColors: [Color.Resolved], background: Color = .clear, smoothsColors: Bool = true, colorSpace: Gradient.ColorSpace = .device)Creates a new gradient mesh specified as a 2D grid of colored points, specifying the Bezier control points explicitly, with already-resolved sRGB colors. - Parameters: - width: the width of the mesh, i.e. the number of vertices per row. - height: the height of the mesh, i.e. the number of vertices per column. - bezierPoints: the array of points and control points, containing `width x height` elements. - resolvedColors: the array of colors, containing `width x height` elements. - background: the background color, this fills any points outside the defined vertex mesh. - smoothsColors: whether cubic (smooth) interpolation should be used for the colors in the mesh (rather than only for the shape of the mesh). - colorSpace: the color space in which to interpolate vertex colors.
static initWidthHeightBezierPointsColorsBackgroundSmoothsColorsColorSpace(width: number, height: number, bezierPoints: Array<MeshGradient_BezierPoint>, colors: Array<Color>, background?: Color, smoothsColors?: boolean, colorSpace?: Gradient_ColorSpace): MeshGradientSwift declaration@export(implementation) nonisolated init(width: Int, height: Int, bezierPoints: [MeshGradient.BezierPoint], colors: [Color], background: Color = .clear, smoothsColors: Bool = true, colorSpace: Gradient.ColorSpace = .device)Creates a new gradient mesh specified as a 2D grid of colored points, specifying the Bezier control points explicitly. - Parameters: - width: the width of the mesh, i.e. the number of vertices per row. - height: the height of the mesh, i.e. the number of vertices per column. - bezierPoints: the array of points and control points, containing `width x height` elements. - colors: the array of colors, containing `width x height` elements. - background: the background color, this fills any points outside the defined vertex mesh. - smoothsColors: whether cubic (smooth) interpolation should be used for the colors in the mesh (rather than only for the shape of the mesh). - colorSpace: the color space in which to interpolate vertex colors.
static initWidthHeightPointsResolvedColorsBackgroundSmoothsColorsColorSpace(width: number, height: number, points: Array<SDKHandle>, resolvedColors: Array<Color_Resolved>, background?: Color, smoothsColors?: boolean, colorSpace?: Gradient_ColorSpace): MeshGradientSwift declaration@export(implementation) nonisolated init(width: Int, height: Int, points: [SIMD2<Float>], resolvedColors: [Color.Resolved], background: Color = .clear, smoothsColors: Bool = true, colorSpace: Gradient.ColorSpace = .device)Creates a new gradient mesh specified as a 2D grid of colored points, with already-resolved sRGB colors. - Parameters: - width: the width of the mesh, i.e. the number of vertices per row. - height: the height of the mesh, i.e. the number of vertices per column. - points: the array of points, containing `width x height` elements. - resolvedColors: the array of colors, containing `width x height` elements. - background: the background color, this fills any points outside the defined vertex mesh. - smoothsColors: whether cubic (smooth) interpolation should be used for the colors in the mesh (rather than only for the shape of the mesh). - colorSpace: the color space in which to interpolate vertex colors.
static initWidthHeightPointsColorsBackgroundSmoothsColorsColorSpace(width: number, height: number, points: Array<SDKHandle>, colors: Array<Color>, background?: Color, smoothsColors?: boolean, colorSpace?: Gradient_ColorSpace): MeshGradientSwift declaration@export(implementation) nonisolated init(width: Int, height: Int, points: [SIMD2<Float>], colors: [Color], background: Color = .clear, smoothsColors: Bool = true, colorSpace: Gradient.ColorSpace = .device)Creates a new gradient mesh specified as a 2D grid of colored points. - Parameters: - width: the width of the mesh, i.e. the number of vertices per row. - height: the height of the mesh, i.e. the number of vertices per column. - points: the array of points, containing `width x height` elements. - colors: the array of colors, containing `width x height` elements. - background: the background color, this fills any points outside the defined vertex mesh. - smoothsColors: whether cubic (smooth) interpolation should be used for the colors in the mesh (rather than only for the shape of the mesh). - colorSpace: the color space in which to interpolate vertex colors.
static initWidthHeightLocationsColorsBackgroundSmoothsColorsColorSpace(width: number, height: number, locations: MeshGradient_Locations, colors: MeshGradient_Colors, background?: Color, smoothsColors?: boolean, colorSpace?: Gradient_ColorSpace): MeshGradientSwift declarationnonisolated init(width: Int, height: Int, locations: MeshGradient.Locations, colors: MeshGradient.Colors, background: Color = .clear, smoothsColors: Bool = true, colorSpace: Gradient.ColorSpace = .device)Creates a new gradient mesh specified as a 2D grid of colored vertices. - Parameters: - width: the width of the mesh, i.e. the number of vertices per row. - height: the height of the mesh, i.e. the number of vertices per column. - locations: the array of locations, containing `width x height` elements. - colors: the array of colors, containing `width x height` elements. - background: the background color, this fills any points outside the defined vertex mesh. - smoothsColors: whether cubic (smooth) interpolation should be used for the colors in the mesh (rather than only for the shape of the mesh). - colorSpace: the color space in which to interpolate vertex colors.
get width(): numberSwift declarationvar width: IntThe width of the mesh, i.e. the number of vertices per row.
set width(value: number)Swift declarationvar width: IntThe width of the mesh, i.e. the number of vertices per row.
get colors(): MeshGradient_ColorsSwift declarationvar colors: MeshGradient.ColorsThe array of colors. Must contain `width x height` elements.
set colors(value: MeshGradient_Colors)Swift declarationvar colors: MeshGradient.ColorsThe array of colors. Must contain `width x height` elements.
get height(): numberSwift declarationvar height: IntThe height of the mesh, i.e. the number of vertices per column.
set height(value: number)Swift declarationvar height: IntThe height of the mesh, i.e. the number of vertices per column.
get locations(): MeshGradient_LocationsSwift declarationvar locations: MeshGradient.LocationsThe array of locations. Must contain `width x height` elements.
set locations(value: MeshGradient_Locations)Swift declarationvar locations: MeshGradient.LocationsThe array of locations. Must contain `width x height` elements.
No declarations were skipped in this snapshot.