rippleTransition()
Simulates a ripple in a pond to transiton from one image to another.
Declaration
class func rippleTransition() -> any CIFilter & CIRippleTransitionReturn Value
The transition image.
Discussion
This method applies the ripple transition filter to an image. The effect transitions from one image to another by creating a circular wave that expands from the center point, revealing the target image through the wave effect.
The ripple transition filter uses the following properties:
inputImageThe starting image with the type CIImage.
targetImageThe ending image with the type CIImage.
centerA set of coordinates marking the center of the image as a CGPoint.
widthA
floatrepresenting the width of the ripple effect as an NSNumber.extentA CGRect representing the size of the ripple effect.
scaleA
floatrepresenting the scale of the effect as an NSNumber.timeA
floatrepresenting the parametric time of the transition from start (at time 0) to end (at time 1) as an NSNumber.
The following code creates a filter that transitions from the input image to the target image with a water-like ripple effect.
func ripple (inputImage: CIImage, targetImage: CIImage) -> CIImage {
let rippleTransition = CIFilter.rippleTransition()
rippleTransition.inputImage = inputImage
rippleTransition.targetImage = targetImage
rippleTransition.center = CGPoint(x: 250, y: 150)
rippleTransition.width = 100
rippleTransition.extent = CGRect(x: 54, y: 80, width: 300, height: 300)
rippleTransition.scale = 22
rippleTransition.time = 0.3
return rippleTransition.outputImage!
}[Image]