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

# modTransition()

Transitions between two images by applying irregularly shaped holes.

```
class func modTransition() -> any CIFilter & CIModTransition
```

## Return Value

The transition image.

## Discussion

This method applies the mod transition filter to an image. The effect transitions from the input image to the output image by revealing the target image through irregularly shaped holes.

The mod transition filter uses the following properties:

- `inputImage`: The starting image with the type [`CIImage`](/documentation/CoreImage/CIImage).
- `targetImage`: The ending image with the type [`CIImage`](/documentation/CoreImage/CIImage).
- `center`: A <doc://com.apple.documentation/documentation/CoreFoundation/CGPoint> representing the center of the image.
- `angle`: A `float` representing the angle of the effect as an <doc://com.apple.documentation/documentation/Foundation/NSNumber>.
- `radius`: A `float` representing the size of the area of effect as an <doc://com.apple.documentation/documentation/Foundation/NSNumber>.
- `compression`: A `float` representing the amount of stretching applied to the mod hole pattern as an <doc://com.apple.documentation/documentation/Foundation/NSNumber>.
- `time`: A `float` representing the parametric time of the transition from start (at time 0) to end (at time 1) as an <doc://com.apple.documentation/documentation/Foundation/NSNumber>.

The following code creates a filter that transitions from the input image to the target image by creating a series of irregular shaped holes.

```swift
func mod(inputImage: CIImage, targetImage: CIImage) -> CIImage {
    let modTransition = CIFilter.modTransition()
    modTransition.inputImage = inputImage
    modTransition.targetImage = targetImage
    modTransition.center = CGPoint(x: 390, y: 392)
    modTransition.time = 0.5
    modTransition.angle = 0.09
    modTransition.radius = 150
    modTransition.compression = 523   
    return modTransition.outputImage!
}
```

![Three photographs. In the photo on the left, there are multiple small purple flowers photographed close up with good lighting, and the background has a slight blur. In the photograph on the right is a tall building with two trees directly in front of the building. In the center photograph, a mod transition filter is applied, resulting in a still photo of the moving transition. The left photograph is overlaid on the photo on the right while transitioning by a series of irregular circles that spread to reveal the city photograph.](images/com.apple.coreimage/media-3616428@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)