<!--
{
  "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/smoothLinearGradient()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)smoothLinearGradientFilter"
  },
  "title" : "smoothLinearGradient()"
}
-->

# smoothLinearGradient()

Generates a gradient that blends colors along a linear axis between two defined endpoints.

```
class func smoothLinearGradient() -> any CIFilter & CISmoothLinearGradient
```

## Return Value

The generated image.

## Discussion

This method generates a smooth linear-gradient image. The effect creates a gradient by gradually blending colors between `point0` and `point1` using the sigmoid curve function.

The smooth linear-gradient filter uses the following properties:

- `point0`: A <doc://com.apple.documentation/documentation/CoreFoundation/CGPoint> representing the starting position of the gradient.
- `point1`: A <doc://com.apple.documentation/documentation/CoreFoundation/CGPoint> representing the ending position of the gradient.
- `color0`: A [`CIColor`](/documentation/CoreImage/CIColor) representing the first color used in the gradient.
- `color1`: A [`CIColor`](/documentation/CoreImage/CIColor) representing the second color used in the gradient.

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

```swift
func smoothLinear() -> CIImage {
    let smoothLinearGradient = CIFilter.smoothLinearGradient()
    smoothLinearGradient.point0 = CGPoint(x: 0, y: 0)
    smoothLinearGradient.point1 = CGPoint(x: 200, y: 200)
    smoothLinearGradient.color0 = CIColor(red: 0/255, green: 112/255, blue: 201/255)
    smoothLinearGradient.color1 = CIColor(red: 216/255, green: 232/255, blue: 146/255)
    return smoothLinearGradient.outputImage!
}
```

![An image that gradually changes in color from yellow in the bottom left corner to light blue in the top right corner.](images/com.apple.coreimage/media-3558802@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)