Skip to main content
Version: Phaser v4.0.0-rc.6

CaptureFrame

A CaptureFrame is a special type of GameObject that allows you to

capture the current state of the render.

For example, if you place a CaptureFrame between two other objects,

it will capture the first object to a texture, but not the second.

This is useful for full-scene post-processing prior to render completion,

such as a layer of water.

This is a WebGL only feature and is not available in Canvas mode.

You must activate the forceComposite property of the Camera,

or otherwise use this object within a framebuffer, to use this feature.

Examples of framebuffer situations include Filters, DynamicTexture,

and a camera with alpha between 0 and 1.

This object does not render anything. It simply captures a texture

from the current framebuffer at the moment it 'renders'.

If you add filters to this object, it will capture the clear, temporary

framebuffer used for the filter, not the main framebuffer.

If you add filters to a Container that contains this object,

it will capture only objects within that Container.

If you set visible to false, it will just stop capturing.

Constructor

new CaptureFrame(scene, key)

Parameters

nametypeoptionaldescription
scenePhaser.SceneNoThe Scene to which this CaptureFrame belongs.
keystringNoThe key of the texture to create from this CaptureFrame.

Scope: static

Extends

Phaser.GameObjects.GameObject
Phaser.GameObjects.Components.BlendMode
Phaser.GameObjects.Components.Depth
Phaser.GameObjects.Components.RenderNodes
Phaser.GameObjects.Components.Visible

Source: src/gameobjects/captureframe/CaptureFrame.js#L14
Since: 4.0.0

Inherited Members

From Phaser.GameObjects.Components.BlendMode:

From Phaser.GameObjects.Components.Depth:

From Phaser.GameObjects.Components.Filters:

From Phaser.GameObjects.Components.RenderNodes:

From Phaser.GameObjects.Components.Visible:

From Phaser.GameObjects.GameObject:


Public Members

captureTexture

captureTexture: Phaser.Textures.Texture

Description:

A texture containing the captured frame.

This is updated when the GameObject renders.

Tags:

  • webglOnly

Source: src/gameobjects/captureframe/CaptureFrame.js#L100
Since: 4.0.0


drawingContext

drawingContext: Phaser.Renderer.WebGL.DrawingContext

Description:

The drawing context of this CaptureFrame.

This contains the WebGL framebuffer and texture data.

Tags:

  • webglOnly

Source: src/gameobjects/captureframe/CaptureFrame.js#L86
Since: 4.0.0


Inherited Methods

From Phaser.Events.EventEmitter:

From Phaser.GameObjects.Components.BlendMode:

From Phaser.GameObjects.Components.Depth:

From Phaser.GameObjects.Components.Filters:

From Phaser.GameObjects.Components.RenderNodes:

From Phaser.GameObjects.Components.RenderSteps:

From Phaser.GameObjects.Components.Visible:

From Phaser.GameObjects.GameObject:


Public Methods

setAlpha

<instance> setAlpha(alpha)

Description:

Set the alpha value of this CaptureFrame.

This has no effect and is only present for compatibility with other Game Objects.

Tags:

  • webglOnly

Parameters:

nametypeoptionaldescription
alphanumberNoThe alpha value (not used).

Returns: Phaser.GameObjects.CaptureFrame - undefined

Source: src/gameobjects/captureframe/CaptureFrame.js#L131
Since: 4.0.0


setScrollFactor

<instance> setScrollFactor(x, y)

Description:

Set the scroll factor of this CaptureFrame.

This has no effect and is only present for compatibility with other Game Objects.

Tags:

  • webglOnly

Parameters:

nametypeoptionaldescription
xnumberNoThe horizontal scroll factor (not used).
ynumberNoThe vertical scroll factor (not used).

Returns: Phaser.GameObjects.CaptureFrame - undefined

Source: src/gameobjects/captureframe/CaptureFrame.js#L146
Since: 4.0.0