Type Method 型メソッド

ellipticalGradient(stops:center:startRadiusFraction:endRadiusFraction:)

A radial gradient that draws an ellipse defined by a collection of color stops.

Declaration 宣言

static func ellipticalGradient(stops: [Gradient.Stop], center: UnitPoint = .center, startRadiusFraction: CGFloat = 0, endRadiusFraction: CGFloat = 0.5) -> EllipticalGradient
Available when Self is EllipticalGradient.

Discussion 議論

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 used as a background:


.background(.ellipticalGradient(stops: [
    .init(color: .red, location: 0.0),
    .init(color: .yellow, location: 0.9),
    .init(color: .yellow, location: 1.0),
]))

For information about how to use shape styles, see ShapeStyle.