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

# twirlDistortion()

Distorts an image by rotating pixels around a center point.

```
class func twirlDistortion() -> any CIFilter & CITwirlDistortion
```

## Return Value

The distorted image.

## Discussion

This method applies the twirl distortion filter to an image. This effect distorts an image by rotating pixels around the defined center to create a twirling effect. You can specify the number of rotations to control the strength of the effect.

The twirl distortion filter uses the following properties:

- `inputImage`: An image with the type [`CIImage`](/documentation/CoreImage/CIImage).
- `radius`: A `float` representing the amount of pixels the filter uses to create the distortion as an <doc://com.apple.documentation/documentation/Foundation/NSNumber>.
- `center`: A set of coordinates marking the center of the image as a <doc://com.apple.documentation/documentation/CoreFoundation/CGPoint>.
- `angle`: A `float` representing the angle of the twirl, in radians, as an <doc://com.apple.documentation/documentation/Foundation/NSNumber>.

The following code creates a filter that results in the center of the image becoming twirled:

```swift
func twirlDistort(inputImage: CIImage) -> CIImage {
    let filter = CIFilter.twirlDistortion()
    filter.inputImage = inputImage
    filter.radius = 600
    filter.angle = 3.141592653589793
    filter.center = CGPoint(x: 1791, y: 1344)
    return filter.outputImage!
}
```

![Two images next to each other. The image on the left contains a black-and-white checkerboard pattern. The image on the right has the twirl distortion filter applied. The image appears to be twisted from the center with the twist decreasing towards the edges of the image.](images/com.apple.coreimage/media-4407322@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)