Contents

sunbeamsGenerator()

Generates an image resembling the sun.

Declaration

class func sunbeamsGenerator() -> any CIFilter & CISunbeamsGenerator

Return Value

The generated image.

Discussion

This method generates a sunbeam as an image. The effect generates a center-textured sun with striations. You can combine with other filters to create more sophisticated images.

The sunbeams generator filter uses the following properties:

center

A vector representing the center of the image as a CIVector.

color

A CIColor representing the color of the sun.

sunRadius

A float representing the radius of the center sun as an NSNumber.

maxStriationRadius

A float representing the striation radius as an NSNumber.

striationStrength

A float representing the striation strength as an NSNumber.

striationContrast

A float representing the striation contrast as an NSNumber.

time

A float representing the time as an NSNumber.

The following code creates a filter that generates an image that resembles a yellow sun with sunbeams:

    func sunBeam () -> CIImage {
        let sunBeamGenerator = CIFilter.sunbeamsGenerator()
        sunBeamGenerator.center = CGPoint(x: 150, y: 150)
        sunBeamGenerator.color = CIColor(red: 0.96, green: 1, blue: 1, alpha: 1)
        sunBeamGenerator.sunRadius = 40
        sunBeamGenerator.maxStriationRadius = 2.58
        sunBeamGenerator.striationStrength = 0.50
        sunBeamGenerator.striationContrast = 1.38
        sunBeamGenerator.time = 0
        return sunBeamGenerator.outputImage!
    }

[Image]

See Also

Filters