modTransition()
Transitions between two images by applying irregularly shaped holes.
Declaration
class func modTransition() -> any CIFilter & CIModTransitionReturn 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:
inputImageThe starting image with the type CIImage.
targetImageThe ending image with the type CIImage.
centerA CGPoint representing the center of the image.
angleA
floatrepresenting the angle of the effect as an NSNumber.radiusA
floatrepresenting the size of the area of effect as an NSNumber.compressionA
floatrepresenting the amount of stretching applied to the mod hole pattern as an NSNumber.timeA
floatrepresenting the parametric time of the transition from start (at time 0) to end (at time 1) as an 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.
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!
}[Image]