Skip to main content
Version: Phaser v4.2.1

Phaser.GameObjects.Components.StencilModifier

Scope: static

Source: src/gameobjects/components/StencilModifier.js#L7
Since: 4.2.0

Static functions​

isStencilModifier​

isStencilModifier: boolean​

Description:

Whether this Game Object is a stencil modifier. Do not edit this property. It is used internally.

Any object with isStencilModifier set to true is a positive result for hasStencilChildren, and can affect stencil compositing.

Source: src/gameobjects/components/StencilModifier.js#L98
Since: 4.2.0


stencilAlphaStrategy​

stencilAlphaStrategy: Phaser.Types.Renderer.WebGL.AlphaStrategy​

Description:

The alpha strategy to use when rendering the stencil. This is usually set to dither, or the default game config setting.

Source: src/gameobjects/components/StencilModifier.js#L46
Since: 4.2.0


stencilClearValue​

stencilClearValue: number​

Description:

The value to clear the stencil buffer to, if the stencilLayerMode is clear or clearRegion. Should be between 0 and 255, as the buffer is 8 bits.

Source: src/gameobjects/components/StencilModifier.js#L73
Since: 4.2.0


stencilCompositeCheck​

stencilCompositeCheck: boolean, 'auto'​

Description:

Whether to composite the contents of the stencil to a framebuffer. This is necessary when the stencil contains stencils. It requires extra draw calls to composite. You should set this to false or true if you know the answer, or auto to have Phaser automatically determine the best option.

This will set filtersForceComposite to true during rendering.

Source: src/gameobjects/components/StencilModifier.js#L57
Since: 4.2.0


stencilInvert​

stencilInvert: boolean​

Description:

Whether to invert the stencil, using an extra draw call.

Source: src/gameobjects/components/StencilModifier.js#L36
Since: 4.2.0


stencilLayerMode​

stencilLayerMode: Phaser.Types.GameObjects.Stencil.StencilLayerMode​

Description:

The mode to use when rendering the stencil.

  • 'addLayer' - Add a stencil layer.

  • 'subtractLayer' - Subtract a stencil layer.

  • 'clear' - Clear the stencil buffer.

  • 'clearRegion' - Clear a region of the stencil buffer.

Source: src/gameobjects/components/StencilModifier.js#L21
Since: 4.2.0


stencilValueWrap​

stencilValueWrap: boolean​

Description:

Whether to wrap the value in the stencil buffer when it overflows or underflows when using the addLayer or subtractLayer mode. This is useful when defining stencils with subtraction, and you don't want to underflow from 0 to 255.

Source: src/gameobjects/components/StencilModifier.js#L85
Since: 4.2.0


Static functions​

setStencilAlphaStrategy​

<instance> setStencilAlphaStrategy(stencilAlphaStrategy)​

Description:

Sets the alpha strategy to use when rendering the stencil.

Parameters:

nametypeoptionaldescription
stencilAlphaStrategyPhaser.Types.Renderer.WebGL.AlphaStrategyNoThe alpha strategy to use when rendering the stencil.

Returns: Phaser.GameObjects.Components.StencilModifier - This Game Object instance.

Source: src/gameobjects/components/StencilModifier.js#L120
Since: 4.2.0


setStencilClearValue​

<instance> setStencilClearValue(stencilClearValue)​

Description:

Sets the value to clear the stencil to, if the stencilLayerMode is clear or clearRegion. Should be between 0 and 255, as the buffer is 8 bits.

Parameters:

nametypeoptionaldescription
stencilClearValuenumberNoThe value to clear the stencil buffer to.

Returns: Phaser.GameObjects.Components.StencilModifier - This Game Object instance.

Source: src/gameobjects/components/StencilModifier.js#L134
Since: 4.2.0


setStencilCompositeCheck​

<instance> setStencilCompositeCheck(stencilCompositeCheck)​

Description:

Sets whether to composite the contents of the stencil to a framebuffer. While auto is default, it must run extra checks, so you should set it to true or false if you know the answer.

  • true - Composite the contents of the stencil to a framebuffer.

  • false - Do not composite the contents of the stencil to a framebuffer.

  • 'auto' - Automatically determine whether to composite the contents of the stencil to a framebuffer.

Parameters:

nametypeoptionaldescription
stencilCompositeCheckboolean | 'auto'NoThe check mode to use.

Returns: Phaser.GameObjects.Components.StencilModifier - This Game Object instance.

Source: src/gameobjects/components/StencilModifier.js#L150
Since: 4.2.0


setStencilInvert​

<instance> setStencilInvert(stencilInvert)​

Description:

Sets whether to invert the stencil, using an extra draw call.

Parameters:

nametypeoptionaldescription
stencilInvertbooleanNoWhether to invert the stencil.

Returns: Phaser.GameObjects.Components.StencilModifier - This Game Object instance.

Source: src/gameobjects/components/StencilModifier.js#L170
Since: 4.2.0


setStencilLayerMode​

<instance> setStencilLayerMode(stencilLayerMode)​

Description:

Sets the mode to use when rendering the stencil.

  • 'addLayer' - Add a stencil layer.

  • 'subtractLayer' - Subtract a stencil layer.

  • 'clear' - Clear the whole stencil buffer.

  • 'clearRegion' - Clear a specific region of the stencil buffer.

    You can also use this to fill a region with a specific value.

Parameters:

nametypeoptionaldescription
stencilLayerModePhaser.Types.GameObjects.Stencil.StencilLayerModeNoThe mode which the Stencil should run in.

Returns: Phaser.GameObjects.Components.StencilModifier - This Game Object instance.

Source: src/gameobjects/components/StencilModifier.js#L184
Since: 4.2.0


setStencilValueWrap​

<instance> setStencilValueWrap(stencilValueWrap)​

Description:

Sets whether to wrap the value in the stencil buffer when it overflows or underflows. This is useful when defining stencils with subtraction, and you don't want to underflow from 0 to 255.

Parameters:

nametypeoptionaldescription
stencilValueWrapbooleanNoWhether to wrap the value in the stencil buffer when it overflows or underflows.

Returns: Phaser.GameObjects.Components.StencilModifier - This Game Object instance.

Source: src/gameobjects/components/StencilModifier.js#L204
Since: 4.2.0