The gradient to use for filling the shape, providing the colors and their relative stop locations.
angularGradient(_:center:startAngle:endAngle:)
Availability 有効性
- iOS 13.0+
- iPadOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
Technology
- Swift
UI
Declaration 宣言
static func angularGradient(_ gradient: Gradient
, center: UnitPoint
, startAngle: Angle
, endAngle: Angle
) -> AngularGradient
Self
is AngularGradient
.Parameters パラメータ
gradient
center
The relative center of the gradient, mapped from the unit space into the bounding rectangle of the filled shape.
startAngle
The angle that marks the beginning of the gradient.
endAngle
The angle that marks the end of the gradient.
Discussion 議論
An angular gradient is also known as a “conic” gradient. If end
, the gradient only draws the last complete turn.
角勾配はまた “円錐” 勾配として知られます。end
ならば、勾配は最後の完了回転を描画するだけです。
If end
, the gradient fills the missing area with the colors defined by gradient stop locations at 0
and 1
, transitioning between the two halfway across the missing area.
For example, an angular gradient used as a background:
let gradient = Gradient(colors: [.red, .yellow])
ContentView()
.background(.angularGradient(gradient))
For information about how to use shape styles, see Shape
.