Class: BlurFilter

BlurFilter

A Gaussian blur filter. With this filter, you can blur an area of a PIXI.DisplayObject. This cannot be done with the PIXI.filters.BlurFilter (when you use the PIXI.filters.BlurFilter with an filter area, all pixels outside of the area are not displayed). Attention: The area of the filter is always in global scope, NOT relative to the PIXI.DisplayObject the filter is assigned to!

new BlurFilter (shape, blur)

Name Type Default Description
shape PIXI.Rectangle | PIXI.Circle | PIXI.DisplayObject

The area where the blur effect should be applied to. Relative to the canvas, NOT relative to the PIXI.DisplayObject where the blur effect is assigned to!

blur number 50 optional

The strength of the blur.

Example
// Create the app
const app = new PIXIApp({
    view: canvas,
    width: 480,
    height: 270,
    transparent: false
}).setup().run()

// Add a video sprite
const sprite = new PIXI.Sprite(PIXI.Texture.fromVideo("assets/blurfilter.mp4"))
sprite.width = app.size.width
sprite.height = app.size.height
app.scene.addChild(sprite)

// Create the filter and assign it to the scene
const blurFilter = new BlurFilter(new PIXI.Rectangle(20, 20, 80, 60))
app.scene.filters = [blurFilter]

Extends

  • PIXI.Filter

Members

blur number

The strength of the blur.

shape PIXI.Rectangle | PIXI.Circle | PIXI.DisplayObject

The blur shape.