accordionFoldTransition()
Transitions by folding and crossfading an image to reveal the target image.
Declaration
class func accordionFoldTransition() -> any CIFilter & CIAccordionFoldTransitionReturn Value
The transition image.
Discussion
This method applies the accordion fold transition filter to an image. The effect transitions from one image to another by unfolding and crossfading.
The accordion fold 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.numberOfFoldsA
floatrepresenting the number of accordion folds as a NSNumber.foldShadowAmountA
floatrepresenting the strength of the shadow as a NSNumber.
The following code creates a filter that produces folds in the input image and fades to the target image:
func accordionFold(inputImage: CIImage, targetImage: CIImage) -> CIImage {
let accordionFoldTransiton = CIFilter.accordionFoldTransition()
accordionFoldTransiton.inputImage = inputImage
accordionFoldTransiton.targetImage = targetImage
accordionFoldTransiton.time = 0.5
accordionFoldTransiton.numberOfFolds = 6
accordionFoldTransiton.foldShadowAmount = 2
return accordionFoldTransiton.outputImage!
}[Image]