barsSwipeTransition()
Transitions between two images by removing rectangular portions of an image.
Declaration
class func barsSwipeTransition() -> any CIFilter & CIBarsSwipeTransitionMentioned in
Return Value
The transition image.
Discussion
This method applies the bar swipe transition filter to an image. The effect transitions from one image to another by a series of moving bars passing over the target image.
The bar swipe 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 motion as an NSNumber.widthA
floatrepresenting the width of the bars in pixels as an NSNumber.barOffsetA
floatrepresenting the offset of one bar in relation to others as a NSNumber.
The following code creates a filter that produces falling bars from the input image to transition to the target image:
func barSwipe(inputImage: CIImage, targetImage: CIImage) -> CIImage {
let barSwipeTranstion = CIFilter.barsSwipeTransition()
barSwipeTranstion.inputImage = inputImage
barSwipeTranstion.targetImage = targetImage
barSwipeTranstion.time = 0.5
barSwipeTranstion.angle = 0.09
barSwipeTranstion.width = 30
barSwipeTranstion.barOffset = 10
return barSwipeTranstion.outputImage!
}[Image]