Skip to main content
Version: Phaser v4.0.0-rc.6

ColorMatrix

The ColorMatrix Filter Controller.

This filter controller manages the color matrix effect for a Camera.

The color matrix effect is a visual technique that involves manipulating the colors of an image

or scene using a mathematical matrix. This process can adjust hue, saturation, brightness, and contrast,

allowing developers to create various stylistic appearances or mood settings within the game.

Common applications include simulating different lighting conditions, applying color filters,

or achieving a specific visual style.

A ColorMatrix effect is added to a Camera via the FilterList component:


const camera = this.cameras.main;



const cmFilter = camera.filters.internal.addColorMatrix();

camera.filters.external.addColorMatrix();



// To set the matrix values:

cmFilter.colorMatrix.sepia();

Constructor

new ColorMatrix(camera)

Parameters

nametypeoptionaldescription
cameraPhaser.Cameras.Scene2D.CameraNoThe camera that owns this filter.

Scope: static

Extends

Phaser.Filters.Controller

Source: src/filters/ColorMatrix.js#L11
Since: 4.0.0

Inherited Members

From Phaser.Filters.Controller:


Public Members

colorMatrix

colorMatrix: Phaser.Display.ColorMatrix

Description:

The color matrix for this effect.

This is where the color values are managed and set.

Source: src/filters/ColorMatrix.js#L49
Since: 4.0.0


Inherited Methods

From Phaser.Filters.Controller: