Contents

barsSwipeTransition()

Transitions between two images by removing rectangular portions of an image.

Declaration

class func barsSwipeTransition() -> any CIFilter & CIBarsSwipeTransition

Mentioned 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:

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 motion as an NSNumber.

width

A float representing the width of the bars in pixels as an NSNumber.

barOffset

A float representing 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]

See Also

Filters