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

# lightTunnel()

Distorts an image by generating a light tunnel.

```
class func lightTunnel() -> any CIFilter & CILightTunnel
```

## Return Value

The distorted image.

## Discussion

This method applies the light tunnel filter to an image. This effect distorts the input image by warping the image to cylinder shape.

The light tunnel filter uses the following properties:

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

The following code creates a filter that generates a swirling pattern from the input image:

```swift
func lightTunnel(inputImage: CIImage) -> CIImage {
    let filter = CIFilter.lightTunnel()
    filter.inputImage = inputImage
    filter.radius = 100
    filter.rotation = .pi
    filter.center = CGPoint(
        x: inputImage.extent.width / 2,
        y: inputImage.extent.size.height / 2
    )
    return filter.outputImage!.cropped(to: inputImage.extent)
}
```

![Two images arranged horizontally. The left image contains a photograph of three hydrangea flowers with leaves in the background. The image on the right shows the result of applying the light tunnel filter, which produces a swirling pattern that shrinks towards the center of the image.](images/com.apple.coreimage/media-4407304@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)