Contents

triangleKaleidoscope()

Create a triangular kaleidoscope effect and then tiles the result.

Declaration

class func triangleKaleidoscope() -> any CIFilter & CITriangleKaleidoscope

Return 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:

inputImage

An image with the type CIImage.

decay

A float representing the intensity of the color fade from the center of the triangle as an NSNumber.

point

A set of coordinates marking the center of the triangular area of the input image as a CIVector.

rotation

A float representing the angle of rotation of the triangle as an NSNumber.

size

A float representing 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]

See Also

Filters