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


new Layer(group: Group) → {}
Parameters:
Name Type Default Description
group Group undefined

The group of DisplayObjects to be rendered by this layer.

Summary


Properties from Layer

ArrayLike<number>
clearColor

The background color to clear the layer.

Group
group = undefined

The group of DisplayObjects that are rendered within this layer

boolean
isLayer = true

Flags that this container is a layer!

LayerTextureCache
textureCache

The texture manager used when rendering into a layer render-texture.

boolean
useDoubleBuffer

This will enable double buffering for this layer.

boolean
useRenderTexture

Flags whether this layer should render into a render-texture.

Methods from Layer

void
_onBeginLayerSubtreeTraversal(stage: Stage)

This should be called when the layer is found while traversing the scene for updating object-layer association.

void
_onEndLayerSubtreeTraversal()

This should be called when the full subtree of the layer has been traversed while updating the stage's scene.

void
destroy(options: IDestroyOptions)
void
doSort()

you can override this method for this particular layer, if you want

PIXI.RenderTexture
getRenderTexture()
void
layerRenderCanvas(renderer: any)
void
render(renderer: PIXI.Renderer)
void
renderCanvas(renderer: PIXI.CanvasRenderer)
void
protected postrender(renderer: ILayeredRenderer)

Cleans up the renderer after this layer is rendered.

boolean
protected prerender(renderer: ILayeredRenderer)

Prepares the renderer for this layer.

Properties inherited from Container

T[]
children
number
height

The height of the Container, setting this will actually modify the scale to achieve the value set.

boolean
interactiveChildren = true
boolean
sortableChildren
boolean
sortDirty

Should children be sorted by zIndex at the next updateTransform call.

number
width

The width of the Container, setting this will actually modify the scale to achieve the value set.

Properties inherited from DisplayObject

boolean
_accessibleActive = false
boolean
_accessibleDiv = undefined
PIXI.Bounds
_bounds

The bounds object, this is used to calculate and store the bounds of the displayObject.

PIXI.Bounds
_localBounds

Local bounds object, swapped with _bounds when using getLocalBounds().

boolean
accessible = false
boolean
accessibleChildren = true
string
accessibleHint = undefined
string
accessiblePointerEvents = 'auto'
?string
accessibleTitle = undefined
string
accessibleType = 'button'
number
alpha

The opacity of the object.

number
angle
boolean
buttonMode
boolean
cacheAsBitmap
number
cacheAsBitmapMultisample = PIXI.MSAA_QUALITY.NONE
number
cacheAsBitmapResolution = null
boolean
cullable

Should this object be rendered if the bounds of this object are out of frame?

PIXI.Rectangle
cullArea
string
cursor = undefined
boolean
destroyed

Readonly flag for destroyed display objects.

PIXI.Rectangle
filterArea
PIXI.Filter[] | null
filters
PIXI.IHitArea
hitArea = undefined
boolean
interactive = false
boolean
isMask

Does any other displayObject use this object as a mask?

boolean
isSprite

Used to fast check if a sprite is.. a sprite!

PIXI.Matrix
localTransform
PIXI.Container | PIXI.MaskData | null
mask
string
name = undefined
PIXI.Container
parent

The display object container that contains this display object.

PIXI.ObservablePoint
pivot
PIXI.ObservablePoint
position
boolean
renderable
number
rotation
PIXI.ObservablePoint
scale

The scale factors of this object along the local coordinate axes.

PIXI.ObservablePoint
skew
PIXI.DisplayObject
smartMask = undefined
PIXI.Transform
transform
boolean
visible
number
worldAlpha
PIXI.Matrix
worldTransform
boolean
worldVisible
number
x
number
y
number
zIndex

The zIndex of the displayObject.

number
protected _boundsID

Flags the cached bounds as dirty.

PIXI.Rectangle
protected _boundsRect

Cache of this display-object's bounds-rectangle.

boolean
protected _destroyed

If the object has been destroyed via destroy(). If true, it should not be used.

PIXI.Filter[]
protected _enabledFilters
number
protected _lastSortedIndex
PIXI.Rectangle
protected _localBoundsRect

Cache of this display-object's local-bounds rectangle.

PIXI.Container | PIXI.MaskData
protected _mask
PIXI.Container
protected _tempDisplayObjectParent
number
protected _zIndex

Methods inherited from Container

Inherited Events from Container

Inherited Events from DisplayObject

added
childRemoved
click
clickcapture

Capture phase equivalent of click.

destroyed
mousedown
mousedowncapture

Capture phase equivalent of mousedown.

mouseenter

Fired when the mouse pointer is moved over a DisplayObject and its descendant's hit testing boundaries.

mouseentercapture

Capture phase equivalent of mouseenter

mouseleave

Fired when the mouse pointer exits a DisplayObject and its descendants.

mouseleavecapture

Capture phase equivalent of mouseleave.

mousemove
mousemovecature

Capture phase equivalent of mousemove.

mouseout
mouseoutcapture

Capture phase equivalent of mouseout.

mouseover
mouseovercapture

Capture phase equivalent of mouseover.

mouseup
mouseupcature

Capture phase equivalent of mouseup.

mouseupoutside
mouseupoutsidecapture

Capture phase equivalent of mouseupoutside.

pointercancel
pointercancelcapture

Capture phase equivalent of pointercancel.

pointerdown
pointerdowncapture

Capture phase equivalent of pointerdown.

pointerenter

Fired when the pointer is moved over a DisplayObject and its descendant's hit testing boundaries.

pointerentercapture

Capture phase equivalent of pointerenter

pointerleave

Fired when the pointer leaves the hit testing boundaries of a DisplayObject and its descendants.

pointerleavecapture

Capture phase equivalent of pointerleave.

pointermove
pointermovecapture

Capture phase equivalent of pointermove.

pointerout
pointeroutcapture

Capture phase equivalent of pointerout.

pointerover
pointerovercapture

Capture phase equivalent of pointerover.

pointertap
pointertapcapture

Capture phase equivalent of pointertap.

pointerup
pointerupcapture

Capture phase equivalent of pointerup.

pointerupoutside
pointerupoutsidecapture

Capture phase equivalent of pointerupoutside.

removed
rightclick
rightclickcapture

Capture phase equivalent of rightclick.

rightdown
rightdowncapture

Capture phase equivalent of rightdown.

rightup
rightupcapture

Capture phase equivalent of rightup.

rightupoutside
rightupoutsidecapture

Capture phase equivalent of rightupoutside.

tap
tapcapture

Capture phase equivalent of tap.

touchcancel
touchcancelcapture

Capture phase equivalent of touchcancel.

touchend
touchendcapture

Capture phase equivalent of touchend.

touchendoutside
touchendoutsidecapture

Capture phase equivalent of touchendoutside.

touchmove
touchmovecapture

Capture phase equivalent of touchmove.

touchstart
touchstartcapture

Capture phase equivalent of touchstart.

PIXI.FederatedWheelEvent
wheel

Fired when a the user scrolls with the mouse cursor over a DisplayObject.

PIXI.FederatedWheelEvent
wheelcapture

Capture phase equivalent of wheel.

Public Properties


clearColor Layer.ts:272
clearColor: ArrayLike<number>

The background color to clear the layer.

This should be used when Layer#useRenderTexture is enabled.

group Layer.ts:205
group: Group = undefined

The group of DisplayObjects that are rendered within this layer

isLayer Layer.ts:202
isLayer: boolean = true

Flags that this container is a layer!

textureCache Layer.ts:208
textureCache: LayerTextureCache

The texture manager used when rendering into a layer render-texture.

useDoubleBuffer Layer.ts:255
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 Layer.ts:240
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 Layer.ts:369
_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.

Parameters:
Name Type Description
stage Stage
Returns:
Type Description
void
See: Stage#updateStage
_onEndLayerSubtreeTraversal Layer.ts:396
_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.

Returns:
Type Description
void
See: Stage#updateStage
destroy Layer.ts:317
destroy(options: IDestroyOptions) → {void}
Parameters:
Name Type Attributes Description
options IDestroyOptions

<optional>

Returns:
Type Description
void
doSort Layer.ts:309
doSort() → {void}

you can override this method for this particular layer, if you want

Returns:
Type Description
void
getRenderTexture Layer.ts:295
getRenderTexture() → {PIXI.RenderTexture}

The rendering into a render-texture is enabled, this will return the render-texture used by this layer.

Returns:
Type Description
PIXI.RenderTexture
layerRenderCanvas Layer.ts:355
layerRenderCanvas(renderer: any) → {void}

renderCanvas named this way because of some TS mixin problem

Parameters:
Name Type Description
renderer any
Returns:
Type Description
void
render Layer.ts:329
render(renderer: PIXI.Renderer) → {void}
Parameters:
Name Type Description
renderer PIXI.Renderer
Returns:
Type Description
void
renderCanvas Container.ts:17
renderCanvas(renderer: PIXI.CanvasRenderer) → {void}

Renders the object using the Canvas renderer

Parameters:
Name Type Description
renderer PIXI.CanvasRenderer

The renderer

Returns:
Type Description
void

Protected Methods


postrender Layer.ts:495
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.

Parameters:
Name Type Description
renderer ILayeredRenderer
Returns:
Type Description
void
prerender Layer.ts:441
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.

Parameters:
Name Type Description
renderer ILayeredRenderer
Returns:
Type Description
boolean

true, if the layer needs to be rendered; false, when the layer is invisible or has zero alpha.


Powered by webdoc!