One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

EllipticalGradient

struct · iOS 15.0+ · SDK 27.1

@frozen nonisolated struct EllipticalGradient

A radial gradient that draws an ellipse. The gradient maps its coordinate space to the unit space square in which its center and radii are defined, then stretches that square to fill its bounding rect, possibly also stretching the circular gradient to have elliptical contours. For example, an elliptical gradient centered on the view, filling its bounds: EllipticalGradient(gradient: .init(colors: [.red, .yellow])) When using an elliptical gradient as a shape style, you can also use ``ShapeStyle/ellipticalGradient(_:center:startRadiusFraction:endRadiusFraction:)``.

Members (3)

init · iOS 15.0+

init

TypeScript
static initStopsCenterStartRadiusFractionEndRadiusFraction(stops: Array<Gradient_Stop>, center?: UnitPoint, startRadiusFraction?: number, endRadiusFraction?: number): EllipticalGradient
Swift declaration
nonisolated init(stops: [Gradient.Stop], center: UnitPoint = .center, startRadiusFraction: CGFloat = 0, endRadiusFraction: CGFloat = 0.5)

Creates an elliptical gradient from a collection of color stops. For example, an elliptical gradient centered on the top-leading corner of the view, with some extra green area: EllipticalGradient( stops: [ .init(color: .blue, location: 0.0), .init(color: .green, location: 0.9), .init(color: .green, location: 1.0), ], center: .topLeading, startRadiusFraction: 0, endRadiusFraction: 1) - Parameters: - stops: The colors and their parametric locations. - center: The center of the circle, in [0, 1] coordinates. - startRadiusFraction: The start radius value, as a fraction between zero and one. Zero maps to the center point, one maps to the diameter of the unit circle. - endRadiusFraction: The end radius value, as a fraction between zero and one. Zero maps to the center point, one maps to the diameter of the unit circle.

init · iOS 15.0+

init

TypeScript
static initColorsCenterStartRadiusFractionEndRadiusFraction(colors: Array<Color>, center?: UnitPoint, startRadiusFraction?: number, endRadiusFraction?: number): EllipticalGradient
Swift declaration
nonisolated init(colors: [Color], center: UnitPoint = .center, startRadiusFraction: CGFloat = 0, endRadiusFraction: CGFloat = 0.5)

Creates an elliptical gradient from a collection of colors. For example, an elliptical gradient centered on the top-leading corner of the view: EllipticalGradient( colors: [.blue, .green], center: .topLeading, startRadiusFraction: 0, endRadiusFraction: 1) - Parameters: - colors: The colors, evenly distributed throughout the gradient. - center: The center of the circle, in [0, 1] coordinates. - startRadiusFraction: The start radius value, as a fraction between zero and one. Zero maps to the center point, one maps to the diameter of the unit circle. - endRadiusFraction: The end radius value, as a fraction between zero and one. Zero maps to the center point, one maps to the diameter of the unit circle.

init · iOS 15.0+

init

TypeScript
static initGradientCenterStartRadiusFractionEndRadiusFraction(gradient: Gradient, center?: UnitPoint, startRadiusFraction?: number, endRadiusFraction?: number): EllipticalGradient
Swift declaration
nonisolated init(gradient: Gradient, center: UnitPoint = .center, startRadiusFraction: CGFloat = 0, endRadiusFraction: CGFloat = 0.5)

Creates an elliptical gradient. For example, an elliptical gradient centered on the top-leading corner of the view: EllipticalGradient( gradient: .init(colors: [.blue, .green]), center: .topLeading, startRadiusFraction: 0, endRadiusFraction: 1) - Parameters: - gradient: The colors and their parametric locations. - center: The center of the circle, in [0, 1] coordinates. - startRadiusFraction: The start radius value, as a fraction between zero and one. Zero maps to the center point, one maps to the diameter of the unit circle. - endRadiusFraction: The end radius value, as a fraction between zero and one. Zero maps to the center point, one maps to the diameter of the unit circle.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUICore types →