pageCurlTransition()
Simulates the curl of a page, revealing the target image.
Declaration
class func pageCurlTransition() -> any CIFilter & CIPageCurlTransitionReturn Value
The transition image.
Discussion
This method applies the page curl transition filter to an image. The effect transitions from one image to another by simulating a curling page, revealing the target image as the page curls.
The page curl transition filter uses the following properties:
inputImageThe starting image with the type CIImage.
targetImageThe ending image with the type CIImage.
backsideImageAn image used as the backside of the curl with the type CIImage.
extentA CGRect representing the size of the effect.
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 of the curl as an NSNumber.radiusA
floatrepresenting the radius of the curl as an NSNumber.
The following code creates a filter that produces a page curling back to reveal the target image.
func pageCurl(inputImage: CIImage, targetImage: CIImage, backsideImage: CIImage) -> CIImage {
let pageCurlTransition = CIFilter.pageCurlTransition()
pageCurlTransition.inputImage = inputImage
pageCurlTransition.targetImage = targetImage
pageCurlTransition.backsideImage = backsideImage
pageCurlTransition.extent = CGRect(x: 54, y: 90, width: 300, height: 300)
pageCurlTransition.time = 5.6
pageCurlTransition.angle = 0.9
pageCurlTransition.radius = 150
return pageCurlTransition.outputImage!
}[Image]