Contents

disintegrateWithMaskTransition()

Transitions between two images using a mask image.

Declaration

class func disintegrateWithMaskTransition() -> any CIFilter & CIDisintegrateWithMaskTransition

Return Value

The transition image.

Discussion

This method applies the disintegrate with mask transition filter to an image. The effect transitions from one image to another using the shapes defined by the mask image.

The disintegrate with mask transition filter uses the following properties:

inputImage

The starting image with the type CIImage.

targetImage

The ending image with the type CIImage.

maskImage

An image with the type CIImage.

time

A float representing the parametric time of the transition from start (at time 0) to end (at time 1) as an NSNumber.

shadowRadius

A float representing the size of the shadow as a NSNumber.

shadowDensity

A float representing the strength of the shadow as a NSNumber.

shadowOffset

A CGPoint representing the size of the shadow from the mask image.

The following code creates a filter that produces a transition between the input and target images starting in the area’s outline in the mask image:

func disintergrate(inputImage: CIImage, targetImage: CIImage, maskImage: CIImage) -> CIImage {
    let disintergrateTransition  = CIFilter.disintegrateWithMaskTransition()
    disintergrateTransition.inputImage = inputImage
    disintergrateTransition.targetImage = targetImage
    disintergrateTransition.maskImage = maskImage
    disintergrateTransition.time = 0.5
    disintergrateTransition.shadowRadius = 8
    disintergrateTransition.shadowDensity = 0.65
    disintergrateTransition.shadowOffset = CGPoint(x: 0, y: -1)
    return disintergrateTransition.outputImage!
}

[Image]

See Also

Filters