<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilter-swift.class/radialGradient()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)radialGradientFilter"
  },
  "title" : "radialGradient()"
}
-->

# radialGradient()

Generates a gradient that varies radially between two circles having the same center.

```
class func radialGradient() -> any CIFilter & CIRadialGradient
```

## Return Value

The generated image.

## Discussion

This method generates a radial-gradient image. The effect generates a color shift between the `radius0` and `radius1` properties.

The radial-gradient filter uses the following properties:

- `center`: A <doc://com.apple.documentation/documentation/CoreFoundation/CGPoint> representing the center of the effect as x and y coordinates.
- `color0`: A [`CIColor`](/documentation/CoreImage/CIColor) representing the first color to use in the gradient.
- `color1`: A [`CIColor`](/documentation/CoreImage/CIColor) representing the second color to use in the gradient.
- `radius0`: A `float` representing the radius of the starting circle to use in the gradient as a <doc://com.apple.documentation/documentation/Foundation/NSNumber>.
- `radius1`: A `float` representing the radius of the ending circle to use in the gradient as a <doc://com.apple.documentation/documentation/Foundation/NSNumber>.

The following code creates a filter that generates a gradient image:

```swift
func radial() -> CIImage {
    let radialGradient = CIFilter.radialGradient()
    radialGradient.center = CGPoint(x: 150, y: 150)
    radialGradient.radius0 = 5
    radialGradient.radius1 = 100
    radialGradient.color0 = CIColor(red: 246/255, green: 145/255, blue: 181/255)
    radialGradient.color1 = CIColor(red: 110/255, green: 81/255, blue: 161/255)
    return radialGradient.outputImage!
}
```

![An image that gradually changes in color from pink in the center to purple in the periphery.](images/com.apple.coreimage/media-3558800@2x.png)

---

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)