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:)``.
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.
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.
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.