<!--
{
  "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/ShapeStyle/ellipticalGradient(_:center:startRadiusFraction:endRadiusFraction:)-fmox",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI10ShapeStylePA2A18EllipticalGradientVRszrlE010ellipticalF0_6center19startRadiusFraction03endjK0AeA0F0V_AA9UnitPointV14CoreFoundation7CGFloatVAPtFZ"
  },
  "title" : "ellipticalGradient(_:center:startRadiusFraction:endRadiusFraction:)"
}
-->

# ellipticalGradient(_:center:startRadiusFraction:endRadiusFraction:)

A radial gradient that draws an ellipse.

```
@export(implementation) static func ellipticalGradient(_ gradient: Gradient, center: UnitPoint = .center, startRadiusFraction: CGFloat = 0, endRadiusFraction: CGFloat = 0.5) -> EllipticalGradient
```

## Discussion

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 used as a background:

```
let gradient = Gradient(colors: [.red, .yellow])

ContentView()
    .background(.ellipticalGradient(gradient))
```

For information about how to use shape styles, see `ShapeStyle`.

---

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)