disintegrateWithMaskTransition()
Transitions between two images using a mask image.
Declaration
class func disintegrateWithMaskTransition() -> any CIFilter & CIDisintegrateWithMaskTransitionReturn 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:
inputImageThe starting image with the type CIImage.
targetImageThe ending image with the type CIImage.
maskImageAn image with the type CIImage.
timeA
floatrepresenting the parametric time of the transition from start (at time 0) to end (at time 1) as an NSNumber.shadowRadiusA
floatrepresenting the size of the shadow as a NSNumber.shadowDensityA
floatrepresenting the strength of the shadow as a NSNumber.shadowOffsetA 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]