AngularGradient
An angular gradient.
Declaration
type AngularGradient =
| { colors: Color[]; center: UnitPoint; angle?: Angle; }
| { colors: Color[]; center: UnitPoint; startAngle: Angle; endAngle: Angle; }
| { gradient: Gradient; center: UnitPoint; angle?: Angle; }
| { gradient: Gradient; center: UnitPoint; startAngle?: Angle; endAngle?: Angle; }
| { stops: GradientStop[]; center: UnitPoint; angle?: Angle; }
| { stops: GradientStop[]; center: UnitPoint; startAngle: Angle; endAngle: Angle; };@frozen nonisolated struct AngularGradientOverview
An angular gradient is also known as a "conic" gradient. This gradient
applies the color function as the angle changes, relative to a center
point and defined start and end angles. If endAngle - startAngle > 2π,
the gradient only draws the last complete turn. If
endAngle - startAngle < 2π, the gradient fills the missing area with
the colors defined by gradient locations one and zero, transitioning
between the two halfway across the missing area. The gradient maps the
unit space center point into the bounding rectangle of each shape filled
with the gradient.
When using an angular gradient as a shape style, you can also use
ShapeStyle.angularGradient(_:center:startAngle:endAngle:),
ShapeStyle.conicGradient(_:center:angle:), or similar methods.
From Apple’s SwiftUI documentation. Code samples there are Swift.
See also
More in Drawing and shapes.
- AngleA geometric angle whose value you access in either radians or degrees.
- AnyGradientA color gradient.
- BlendModeModes for compositing a view with overlapping content.
- ButtonBorderShapeA shape used to draw a button's border.
- ColorMatrixA matrix to use in an RGBA color transformation.
- ConcentricRectangleAnimatableDataThe type defining the data to animate.
- ContainerRelativeShapeA shape that is replaced by an inset version of the current container shape. If no container shape was defined, is replaced by a rectangle.
- ContentShapeKindsA kind for the content shape of a view.
- CoordinateSpaceProtocolA frame of reference within the layout system.
- DefaultGlassEffectShapeThe default shape applied by glass effects, a capsule.
- EllipticalGradientA radial gradient that draws an ellipse.
- GlobalCoordinateSpaceThe global coordinate space at the root of the view hierarchy.