Contents

modTransition()

Transitions between two images by applying irregularly shaped holes.

Declaration

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.

targetImage

The ending image with the type CIImage.

center

A CGPoint representing the center of the image.

angle

A float representing the angle of the effect as an NSNumber.

radius

A float representing the size of the area of effect as an NSNumber.

compression

A float representing the amount of stretching applied to the mod hole pattern as an NSNumber.

time

A float representing 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]

See Also

Filters