Layer

This represents a full screen 2d layer. This can be usefull to display a picture in the background of your scene for instance.

see

https://www.babylonjs-playground.com/#08A2BS#1

Hierarchy

  • Layer

Index

Constructors

constructor

Find examples in Playground
  • Instantiates a new layer. This represents a full screen 2d layer. This can be usefull to display a picture in the background of your scene for instance.

    see

    https://www.babylonjs-playground.com/#08A2BS#1

    Parameters

    • name: string

      Define the name of the layer in the scene

    • imgUrl: Nullable<string>

      Define the url of the texture to display in the layer

    • scene: Nullable<Scene>

      Define the scene the layer belongs to

    • Optional isBackground: boolean

      Defines whether the layer is displayed in front or behind the scene

    • Optional color: Color4

      Defines a color for the layer

    Returns Layer

Properties

alphaBlendingMode

Find examples in Playground
alphaBlendingMode: number

Define the alpha blending mode used in the layer in case the texture or color has an alpha.

alphaTest

Find examples in Playground
alphaTest: boolean

Define if the layer should alpha test or alpha blend with the rest of the scene. Alpha test will not mix with the background color in case of transparency. It will either use the texture color or the background depending on the alpha value of the current pixel.

color

Find examples in Playground
color: Color4

Define the color of the layer (instead of texture).

isBackground

Find examples in Playground
isBackground: boolean

Is the layer in background or foreground.

layerMask

Find examples in Playground
layerMask: number

Define a mask to restrict the layer to only some of the scene cameras.

name

Find examples in Playground
name: string

Define the name of the layer.

offset

Find examples in Playground
offset: Vector2

Define an offset for the layer in order to shift the texture.

onAfterRender

Find examples in Playground
onAfterRender: function

Back compatibility with callback before the onAfterRenderObservable existed. The set callback will be triggered just after rendering the layer.

Type declaration

    • (): void
    • Returns void

onAfterRenderObservable

Find examples in Playground
onAfterRenderObservable: Observable<Layer>

An event triggered after rendering the scene

onBeforeRender

Find examples in Playground
onBeforeRender: function

Back compatibility with callback before the onBeforeRenderObservable existed. The set callback will be triggered just before rendering the layer.

Type declaration

    • (): void
    • Returns void

onBeforeRenderObservable

Find examples in Playground
onBeforeRenderObservable: Observable<Layer>

An event triggered before rendering the scene

onDispose

Find examples in Playground
onDispose: function

Back compatibility with callback before the onDisposeObservable existed. The set callback will be triggered when the layer has been disposed.

Type declaration

    • (): void
    • Returns void

onDisposeObservable

Find examples in Playground
onDisposeObservable: Observable<Layer>

An event triggered when the layer is disposed.

scale

Find examples in Playground
scale: Vector2

Define the scale of the layer in order to zoom in out of the texture.

texture

Find examples in Playground
texture: Nullable<Texture>

Define the texture the layer should display.

Methods

dispose

Find examples in Playground
  • dispose(): void
  • Disposes and releases the associated ressources.

    Returns void

render

Find examples in Playground
  • render(): void
  • Renders the layer in the scene.

    Returns void

Generated using TypeDoc