kaleidoscope()
Creates a 12-way kaleidoscopic image from an image.
Declaration
class func kaleidoscope() -> any CIFilter & CIKaleidoscopeReturn Value
The tiled image.
Discussion
This method applies the kaleidoscope tile filter to an image. The effect produces a complex 12-way symmetrical reflected pattern from the input image.
The kaleidoscope tile filter uses the following properties:
inputImageAn image with the type CIImage.
centerA set of coordinates marking the center of the image as a CGPoint.
angleA
floatrepresenting the direction of distortion, in radians as an NSNumber.countA
floatrepresenting the number of reflections in the pattern as an NSNumber.
The following code creates a filter that results in the creation of a kaleidoscope effect from the input image:
func kaleidoscope(inputImage: CIImage) -> CIImage {
let kaleidoscopeEffect = CIFilter.kaleidoscope()
kaleidoscopeEffect.inputImage = inputImage
kaleidoscopeEffect.count = 6
kaleidoscopeEffect.center = CGPoint(x: 150, y: 150)
kaleidoscopeEffect.angle = 0
return kaleidoscopeEffect.outputImage!
}[Image]