The ColorMatrix FX Controller.
This FX controller manages the color matrix effect for a Game Object.
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 Game Object via the FX component:
const sprite = this.add.sprite();
sprite.preFX.addColorMatrix();
sprite.postFX.addColorMatrix();
new ColorMatrix(gameObject)
name | type | description |
---|---|---|
gameObject | Phaser.GameObjects.GameObject |
A reference to the Game Object that has this fx. |
Toggle this boolean to enable or disable this effect, without removing and adding it from the Game Object.
The value that determines how much of the original color is used when mixing the colors. A value between 0 (all original) and 1 (all final)
A reference to the Game Object that owns this effect.
The FX_CONST type of this effect.
Sets this ColorMatrix to be black and white.
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Changes the brightness of this ColorMatrix by the given amount.
name | type | arguments | Default | description |
---|---|---|---|---|
value | number | <optional> | 0 |
The amount of brightness to apply to this ColorMatrix. Between 0 (black) and 1. |
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Applies a brown tone to this ColorMatrix.
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Change the contrast of this ColorMatrix by the amount given.
name | type | arguments | Default | description |
---|---|---|---|---|
value | number | <optional> | 0 |
The amount of contrast to apply to this ColorMatrix. |
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Apply a desaturated luminance to this ColorMatrix.
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Gets the ColorMatrix as a Float32Array.
Can be used directly as a 1fv shader uniform value.
The ColorMatrix as a Float32Array.
Sets this ColorMatrix to be grayscale.
name | type | arguments | Default | description |
---|---|---|---|---|
value | number | <optional> | 1 |
The grayscale scale (0 is black). |
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Rotates the hues of this ColorMatrix by the value given.
name | type | arguments | Default | description |
---|---|---|---|---|
rotation | number | <optional> | 0 |
The amount of hue rotation to apply to this ColorMatrix, in degrees. |
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Applies a kodachrome color effect to this ColorMatrix.
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Applies a trippy color tone to this ColorMatrix.
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Multiplies the two given matrices.
name | type | arguments | Default | description |
---|---|---|---|---|
a | Array.<number> |
The 5x4 array to multiply with ColorMatrix._matrix. |
||
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Converts this ColorMatrix to have negative values.
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Applies a night vision tone to this ColorMatrix.
name | type | arguments | Default | description |
---|---|---|---|---|
intensity | number | <optional> | 0.1 |
The intensity of this effect. |
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Applies a polaroid color effect to this ColorMatrix.
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Resets the ColorMatrix to default values and also resets
the alpha
property back to 1.
This ColorMatrix instance.
Changes the saturation of this ColorMatrix by the given amount.
name | type | arguments | Default | description |
---|---|---|---|---|
value | number | <optional> | 0 |
The amount of saturation to apply to this ColorMatrix. |
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Desaturates this ColorMatrix (removes color from it).
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Applies a sepia tone to this ColorMatrix.
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Sets this ColorMatrix from the given array of color values.
name | type | description |
---|---|---|
value | Array.<number> | Float32Array |
The ColorMatrix values to set. Must have 20 elements. |
This ColorMatrix instance.
Shifts the values of this ColorMatrix into BGR order.
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Applies a technicolor color effect to this ColorMatrix.
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.
Applies a vintage pinhole color effect to this ColorMatrix.
name | type | arguments | Default | description |
---|---|---|---|---|
multiply | boolean | <optional> | false |
Multiply the resulting ColorMatrix ( |
This ColorMatrix instance.