motionBlur()
Creates motion blur on an image.
Declaration
class func motionBlur() -> any CIFilter & CIMotionBlurReturn 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:
radiusA
floatrepresenting the area of effect as an NSNumber.angleA
floatrepresenting the angle of the motion, in radians, that determines which direction the blur smears as an NSNumber.inputImageA 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]