Contents

motionBlur()

Creates motion blur on an image.

Declaration

class func motionBlur() -> any CIFilter & CIMotionBlur

Return Value

The blurred image.

Discussion

This method applies the motion blur filter to an image. The filter uses the angle of a single row of pixels to determine the direction of the motion effect.

The motion blur filter uses the following properties:

radius

A float representing the area of effect as an NSNumber.

angle

A float representing the angle of the motion, in radians, that determines which direction the blur smears as an NSNumber.

inputImage

A CIImage representing the input image to apply the filter to.

The following code creates a filter that adds a motion blur to the input image:

    func motionBlur(inputImage: CIImage) -> CIImage? {

        let motionBlurFilter = CIFilter.motionBlur()
        motionBlurFilter.inputImage = inputImage
        motionBlurFilter.angle = 0
        motionBlurFilter.radius = 20
        return motionBlurFilter.outputImage
    }

[Image]

See Also

Filters