FilterKey
This RenderNode renders the Key filter effect. See Phaser.Filters.Key.
The Key filter removes or isolates pixels that match a specified color, similar to a chroma-key (green screen) effect. It compares each pixel's RGB values against the key color using vector distance, then makes matching pixels transparent (or, when in isolate mode, removes everything that does not match). A threshold controls how strictly pixels must match the key color, and an optional feather value softens the transition at the boundary.
Constructor
new FilterKey(manager)
Parameters
| name | type | optional | description |
|---|---|---|---|
| manager | Phaser.Renderer.WebGL.RenderNodes.RenderNodeManager | No | The manager that owns this RenderNode. |
Scope: static
Extends
Source: src/renderer/webgl/renderNodes/filters/FilterKey.js#L12
Since: 4.0.0
Inherited Methods
From Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader:
From Phaser.Renderer.WebGL.RenderNodes.RenderNode:
Public Methods
setupUniforms
<instance> setupUniforms(controller, _drawingContext)
Description:
Sets up the shader uniforms for the Key filter based on the current state of its controller.
Sends the key color as a vec4 uniform (uColor), and packs the isolate flag, threshold, and feather values into a single vec4 uniform (uIsolateThresholdFeather) to minimise uniform slots.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| controller | Phaser.Filters.Key | No | The Key filter controller providing the uniform values. |
| _drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The drawing context in use (unused by this filter). |
Overrides: Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader#setupUniforms
Source: src/renderer/webgl/renderNodes/filters/FilterKey.js#L39
Since: 4.0.0
Inherited Members
From Phaser.Renderer.WebGL.RenderNodes.BaseFilterShader:
From Phaser.Renderer.WebGL.RenderNodes.RenderNode: