<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGContext/drawRadialGradient(_:startCenter:startRadius:endCenter:endRadius:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Graphics",
      "CoreGraphics"
    ],
    "preciseIdentifier" : "c:@F@CGContextDrawRadialGradient"
  },
  "title" : "drawRadialGradient(_:startCenter:startRadius:endCenter:endRadius:options:)"
}
-->

# drawRadialGradient(_:startCenter:startRadius:endCenter:endRadius:options:)

Paints a gradient fill that varies along the area defined by the provided starting and ending circles.

```
func drawRadialGradient(_ gradient: CGGradient, startCenter: CGPoint, startRadius: CGFloat, endCenter: CGPoint, endRadius: CGFloat, options: CGGradientDrawingOptions)
```

## Parameters

`gradient`

A CGGradient object.

`startCenter`

The coordinate that defines the center of the starting circle.

`startRadius`

The radius of the starting circle.

`endCenter`

The coordinate that defines the center of the ending circle.

`endRadius`

The radius of the ending circle.

`options`

Option flags ([`drawsBeforeStartLocation`](/documentation/CoreGraphics/CGGradientDrawingOptions/drawsBeforeStartLocation) or [`drawsAfterEndLocation`](/documentation/CoreGraphics/CGGradientDrawingOptions/drawsAfterEndLocation)) that control whether the gradient is drawn before the starting circle or after the ending circle.

## Discussion

The color at location 0 in the CGGradient object is mapped to the circle defined by `startCenter` and `startRadius`. The color at location 1 in the CGGradient object is mapped to the circle defined by `endCenter` and `endRadius`. Colors are linearly interpolated between the starting and ending circles based on the location values of the gradient. The option flags control whether the gradient is drawn before the start point or after the end point.

---

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)