copyMachineTransition()
Simulates the effect of a copy machine scanner light to transiton between two images.
Declaration
class func copyMachineTransition() -> any CIFilter & CICopyMachineTransitionMentioned 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:
inputImageThe starting image with the type CIImage.
targetImageThe ending 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.angleA
floatrepresenting the angle of the copier light, in radians as an NSNumber.widthA
floatrepresenting the width of the effect as a NSNumber.extentA CGRect representing the area of the copy machine effect.
colorA CIColor representing the color of the light.
opacityA
floatrepresenting 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]