<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/EllipticalGradient/init(stops:center:startRadiusFraction:endRadiusFraction:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI18EllipticalGradientV5stops6center19startRadiusFraction03endhI0ACSayAA0D0V4StopVG_AA9UnitPointV14CoreFoundation7CGFloatVAQtcfc"
  },
  "title" : "init(stops:center:startRadiusFraction:endRadiusFraction:)"
}
-->

# init(stops:center:startRadiusFraction:endRadiusFraction:)

Creates an elliptical gradient from a collection of color stops.

```
nonisolated init(stops: [Gradient.Stop], center: UnitPoint = .center, startRadiusFraction: CGFloat = 0, endRadiusFraction: CGFloat = 0.5)
```

## Discussion

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

- 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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)