Navigation
These archived docs are for Phaser 2.3.0 Phaser 3 docs can be found on newdocs.phaser.io.
Phaser CE docs can be found on the Phaser CE Documentation site.

Constructor

Phaser. Filter

new Filter(game, uniforms, fragmentSrc)

This is a base Filter class to use for any Phaser filter development.

Parameters
Name Type Description
game Phaser.Game

A reference to the currently running game.

uniforms object

Uniform mappings object

fragmentSrc Array

The fragment shader code.

Source code: core/Filter.js (Line 16)

Public Properties

dirty : boolean

Internal PIXI var.

Default Value
  • true
Source code: core/Filter.js (Line 47)

fragmentSrc :array

The fragment shader code.

Source code: core/Filter.js (Line 95)

game : Phaser.Game

A reference to the currently running game.

Source code: core/Filter.js (Line 21)

height : number

The height (resolution uniform)

Source code: core/Filter.js (Line 176)

padding : number

Internal PIXI var.

Default Value
  • 0
Source code: core/Filter.js (Line 53)

prevPoint : Phaser.Point

The previous position of the pointer (we don't update the uniform if the same)

Source code: core/Filter.js (Line 58)

type : number

The const type of this object, either Phaser.WEBGL_FILTER or Phaser.CANVAS_FILTER.

Source code: core/Filter.js (Line 27)

uniforms : Object

Default uniform mappings. Compatible with ShaderToy and GLSLSandbox.

Source code: core/Filter.js (Line 69)

width : number

The width (resolution uniform)

Source code: core/Filter.js (Line 160)

Public Methods

destroy()

Clear down this Filter and null out references

Source code: core/Filter.js (Line 146)

init()

Should be over-ridden.

Source code: core/Filter.js (Line 101)

setResolution(width, height)

Set the resolution uniforms on the filter.

Parameters
Name Type Description
width number

The width of the display.

height number

The height of the display.

Source code: core/Filter.js (Line 109)

update(pointer)

Updates the filter.

Parameters
Name Type Argument Description
pointer Phaser.Pointer <optional>

A Pointer object to use for the filter. The coordinates are mapped to the mouse uniform.

Source code: core/Filter.js (Line 122)