EllipticalGradient
A radial gradient that draws an ellipse.
Declaration
type EllipticalGradient =
| { colors: Color[]; center?: UnitPoint; startRadiusFraction?: number; endRadiusFraction?: number; }
| { gradient: Gradient; center?: UnitPoint; startRadiusFraction?: number; endRadiusFraction?: number; }
| { stops: GradientStop[]; center?: UnitPoint; startRadiusFraction?: number; endRadiusFraction?: number; };@frozen nonisolated struct EllipticalGradientOverview
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:).
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.
- AngularGradientAn angular gradient.
- 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.
- GlobalCoordinateSpaceThe global coordinate space at the root of the view hierarchy.