Phaser API Documentation

setMask(mask, [fixedPosition])


Sets the mask to be applied to this Camera during rendering.

The mask must have been previously created and can be either a GeometryMask or a BitmapMask.

Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.

If a mask is already set on this Camera it will be immediately replaced.

Masks have no impact on physics or input detection. They are purely a rendering component that allows you to limit what is visible during the render pass.


name type arguments Default description
mask Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask

The mask this Camera will use when rendering.

fixedPosition boolean <optional> true

Should the mask translate along with the Camera, or be fixed in place and not impacted by the Cameras transform?


This Camera instance.

Since: 3.17.0