Phaser API Documentation

  Version: 
Event: PRE_RENDER_CLEAR
Phaser.Renderer.Events.PRE_RENDER_CLEAR
PRE_RENDER_CLEAR

Description:

The Pre-Render Clear Event.

This event is dispatched by the Phaser Renderer. It happens at the start of the render step, before the WebGL gl.clear function has been called. This allows you to toggle the config.clearBeforeRender property as required, to have fine-grained control over when the canvas is cleared during rendering.

Listen to it from within a Scene using: this.renderer.events.on('prerenderclear', listener).

It's very important to understand that this event is called before the scissor and mask stacks are cleared. This means you should not use this event to modify the scissor or mask. Instead, use the prerender event for that.

If using the Canvas Renderer, this event is dispatched before the canvas is cleared, but after the context globalAlpha and transform have been reset.

Since: 3.85.0