Layer
class Layer extends PIXI.Container
A layer can be used to render PIXI.DisplayObjects in a different part of the scene graph together.
A layer can be used to structure a scene graph in a data-oriented manner and separate the z-ordering hierarchy in a different tree. Each layer is associated with a Group that provides the context for sorting objects in the same layer.
All layers must be placed underneath a Stage - generally, you should assign a Stage as your scene's root.
Constructor
Summary
Properties from Layer
ArrayLike<number> |
The background color to clear the layer. |
Group |
The group of DisplayObjects that are rendered within this layer |
boolean |
Flags that this container is a layer! |
LayerTextureCache |
The texture manager used when rendering into a layer render-texture. |
boolean |
This will enable double buffering for this layer. |
boolean |
Flags whether this layer should render into a render-texture. |
Methods from Layer
void |
This should be called when the layer is found while traversing the scene for updating object-layer association. |
void |
This should be called when the full subtree of the layer has been traversed while updating the stage's scene. |
void |
|
void |
you can override this method for this particular layer, if you want |
PIXI.RenderTexture |
|
void |
|
void |
|
void |
|
void |
Cleans up the renderer after this layer is rendered. |
boolean |
Prepares the renderer for this layer. |
Properties inherited from Container
T[] |
|
number |
The height of the Container, setting this will actually modify the scale to achieve the value set. |
boolean |
|
boolean |
|
boolean |
Should children be sorted by zIndex at the next updateTransform call. |
number |
The width of the Container, setting this will actually modify the scale to achieve the value set. |
Properties inherited from DisplayObject
Methods inherited from Container
Methods inherited from DisplayObject
Inherited Events from Container
Inherited Events from DisplayObject
|
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
Fired when the mouse pointer is moved over a DisplayObject and its descendant's hit testing boundaries. |
|
Capture phase equivalent of |
|
Fired when the mouse pointer exits a DisplayObject and its descendants. |
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
Fired when the pointer is moved over a DisplayObject and its descendant's hit testing boundaries. |
|
Capture phase equivalent of |
|
Fired when the pointer leaves the hit testing boundaries of a DisplayObject and its descendants. |
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
|
|
Capture phase equivalent of |
|
PIXI.FederatedWheelEvent |
Fired when a the user scrolls with the mouse cursor over a DisplayObject. |
PIXI.FederatedWheelEvent |
Capture phase equivalent of |
Public Properties
clearColor: ArrayLike<number>
The background color to clear the layer.
This should be used when Layer#useRenderTexture is enabled.
group: Group = undefined
The group of DisplayObjects that are rendered within this layer
textureCache: LayerTextureCache
The texture manager used when rendering into a layer render-texture.
useDoubleBuffer: boolean
This will enable double buffering for this layer.
This layer will keep two render-textures to render into - choosing one each frame on a flip-flop basis. This is useful when you
Caveat: You must enable Layer#useRenderTexture to prevent framebuffer errors in rendering.
useRenderTexture: boolean
Flags whether this layer should render into a render-texture.
This is useful if you want to use the layer as a texture elsewhere - for example, in sprites or to apply filters. The layer's render-texture is resized to the size of the renderer's screen.
Public Methods
_onBeginLayerSubtreeTraversal(stage: Stage) → {void}
This should be called when the layer is found while traversing the scene for updating object-layer association.
This is an internal method.
Name | Type | Description |
---|---|---|
stage | Stage |
Type | Description |
---|---|
void |
_onEndLayerSubtreeTraversal() → {void}
This should be called when the full subtree of the layer has been traversed while updating the stage's scene.
This is an internal method.
Type | Description |
---|---|
void |
destroy(options: IDestroyOptions) → {void}
Name | Type | Attributes | Description |
---|---|---|---|
options | IDestroyOptions |
<optional> |
Type | Description |
---|---|
void |
doSort() → {void}
you can override this method for this particular layer, if you want
Type | Description |
---|---|
void |
getRenderTexture() → {PIXI.RenderTexture}
The rendering into a render-texture is enabled, this will return the render-texture used by this layer.
Type | Description |
---|---|
PIXI.RenderTexture |
layerRenderCanvas(renderer: any) → {void}
renderCanvas named this way because of some TS mixin problem
Name | Type | Description |
---|---|---|
renderer | any |
Type | Description |
---|---|
void |
render(renderer: PIXI.Renderer) → {void}
Name | Type | Description |
---|---|---|
renderer | PIXI.Renderer |
Type | Description |
---|---|
void |
renderCanvas(renderer: PIXI.CanvasRenderer) → {void}
Renders the object using the Canvas renderer
Name | Type | Description |
---|---|---|
renderer | PIXI.CanvasRenderer |
The renderer |
Type | Description |
---|---|
void |
Protected Methods
protected postrender(renderer: ILayeredRenderer) → {void}
Cleans up the renderer after this layer is rendered.
It restores Renderer#_activeLayer to the parent layer and restores the canonical order of children.
Name | Type | Description |
---|---|---|
renderer | ILayeredRenderer |
Type | Description |
---|---|
void |
protected prerender(renderer: ILayeredRenderer) → {boolean}
Prepares the renderer for this layer.
It will assign PIXI.Renderer#_activeLayer to this
, and set the active layer before
this to _activeParentLayer. It will also temporarily sort the
children by z-order.
Name | Type | Description |
---|---|---|
renderer | ILayeredRenderer |
Type | Description |
---|---|
boolean |
|