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
| name | type | optional | description |
|---|---|---|---|
| scene | Phaser.Scene | No | The Scene to which this CaptureFrame belongs. |
| key | string | No | The 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:
- filterCamera
- filters
- filtersAutoFocus
- filtersFocusContext
- filtersForceComposite
- maxFilterSize
- renderFilters
From Phaser.GameObjects.Components.RenderNodes:
From Phaser.GameObjects.Components.Visible:
From Phaser.GameObjects.GameObject:
- active
- body
- cameraFilter
- data
- displayList
- ignoreDestroy
- input
- name
- parentContainer
- renderFlags
- scene
- state
- tabIndex
- type
- vertexRoundMode
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:
- addListener
- emit
- eventNames
- listenerCount
- listeners
- off
- on
- once
- removeAllListeners
- removeListener
- shutdown
From Phaser.GameObjects.Components.BlendMode:
From Phaser.GameObjects.Components.Depth:
From Phaser.GameObjects.Components.Filters:
- enableFilters
- focusFilters
- focusFiltersOnCamera
- focusFiltersOverride
- renderWebGLFilters
- setFiltersAutoFocus
- setFiltersFocusContext
- setFiltersForceComposite
- setFilterSize
- setRenderFilters
- willRenderFilters
From Phaser.GameObjects.Components.RenderNodes:
From Phaser.GameObjects.Components.RenderSteps:
From Phaser.GameObjects.Components.Visible:
From Phaser.GameObjects.GameObject:
- addedToScene
- addToDisplayList
- addToUpdateList
- destroy
- disableInteractive
- getData
- getDisplayList
- getIndexList
- incData
- removedFromScene
- removeFromDisplayList
- removeFromUpdateList
- removeInteractive
- setActive
- setData
- setDataEnabled
- setInteractive
- setName
- setState
- setVertexRoundMode
- toggleData
- toJSON
- update
- willRender
- willRoundVertices
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:
| name | type | optional | description |
|---|---|---|---|
| alpha | number | No | The 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:
| name | type | optional | description |
|---|---|---|---|
| x | number | No | The horizontal scroll factor (not used). |
| y | number | No | The vertical scroll factor (not used). |
Returns: Phaser.GameObjects.CaptureFrame - undefined
Source: src/gameobjects/captureframe/CaptureFrame.js#L146
Since: 4.0.0