Contents

copyMachineTransition()

Simulates the effect of a copy machine scanner light to transiton between two images.

Declaration

class func copyMachineTransition() -> any CIFilter & CICopyMachineTransition

Mentioned in

Return Value

The transition image.

Discussion

This method applies the copy machine transition filter to an image. The effect transitions from one image to another by simulating the scanning light effect of a copy machine.

The copy machine transition filter uses the following properties:

inputImage

The starting image with the type CIImage.

targetImage

The ending 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.

angle

A float representing the angle of the copier light, in radians as an NSNumber.

width

A float representing the width of the effect as a NSNumber.

extent

A CGRect representing the area of the copy machine effect.

color

A CIColor representing the color of the light.

opacity

A float representing the transparency of the copier light as an NSNumber.

The following code creates a filter that produces a light bar that glides across the input image revealing the target image:

func copyMachine(inputImage: CIImage, targetImage: CIImage) -> CIImage {
    let copyMachineTransition = CIFilter.copyMachineTransition()
    copyMachineTransition.inputImage = inputImage
    copyMachineTransition.targetImage = targetImage
    copyMachineTransition.time = 0.5
    copyMachineTransition.angle = 0.9
    copyMachineTransition.extent = CGRect(x: 54.1, y: 90.2, width: 300, height: 300)
    copyMachineTransition.color = .white
    copyMachineTransition.width = 200
    copyMachineTransition.opacity = 1.30   
    return copyMachineTransition.outputImage!
}

[Image]

See Also

Filters