triangleKaleidoscope()
Create a triangular kaleidoscope effect and then tiles the result.
Declaration
class func triangleKaleidoscope() -> any CIFilter & CITriangleKaleidoscopeReturn Value
The tiled image.
Discussion
This method applies the triangle kaleidoscope filter to an image. The effect produces a complex tiled pattern from a triangular area input image.
The triangle kaleidoscope tile filter uses the following properties:
inputImageAn image with the type CIImage.
decayA
floatrepresenting the intensity of the color fade from the center of the triangle as an NSNumber.pointA set of coordinates marking the center of the triangular area of the input image as a CIVector.
rotationA
floatrepresenting the angle of rotation of the triangle as an NSNumber.sizeA
floatrepresenting the size in pixels of the triangle as an NSNumber.
The following code creates a filter that produces a triangle tile of the input image, creating an optical illusion:
func triangleKaleidoscope(inputImage: CIImage) -> CIImage {
let triangleKaleidoscopeTile = CIFilter.triangleKaleidoscope()
triangleKaleidoscopeTile.inputImage = inputImage
triangleKaleidoscopeTile.point = CGPoint(x: 150, y: 150)
triangleKaleidoscopeTile.size = 700
triangleKaleidoscopeTile.rotation = -0.36
triangleKaleidoscopeTile.decay = 0.85
return triangleKaleidoscopeTile.outputImage!
}[Image]