Class: Layer

Layer(stage, source, geometry, view, textureStore, opts)

A Layer is a combination of Source, Geometry, View and TextureStore that can be added into a Stage and rendered with effects.

Constructor

new Layer(stage, source, geometry, view, textureStore, opts)

Parameters:
Name Type Description
stage Stage
source Source
geometry Geometry
view View
textureStore TextureStore
opts Object
Properties
Name Type Description
effects Effects

Methods

destroy()

Destructor.

effects() → {Effects}

Get the effects.

Returns:
Type
Effects

fixedLevel() → {number|null}

Get the fixed level index.

Returns:
Type
number | null

geometry() → {Geometry}

Get the underlying geometry.

Returns:
Type
Geometry

mergeEffects(effects)

Merge effects into the current ones. The merge is non-recursive; for instance, if current effects are { rect: { relativeWidth: 0.5 } }, calling this method with { rect: { relativeX: 0.5 }} will reset rect.relativeWidth.

Parameters:
Name Type Description
effects Effects

pinFirstLevel()

Pin the first level. Equivalent to pinLevel(0).

pinLevel(levelIndex)

Pin a whole level into the texture store.

Parameters:
Name Type Description
levelIndex Number

setEffects(effects)

Set the effects.

Parameters:
Name Type Description
effects Effects

setFixedLevel(levelIndex)

Set the fixed level index. When set, the corresponding level will be used regardless of the view parameters. Unset with a null argument.

Parameters:
Name Type Description
levelIndex number | null

setView(view)

Set the underlying view.

Parameters:
Name Type Description
view View

source() → {Source}

Get the underlying source.

Returns:
Type
Source

textureStore() → {TextureStore}

Get the underlying TextureStore.

Returns:
Type
TextureStore

unpinFirstLevel()

Unpin the first level. Equivalent to unpinLevel(0).

unpinLevel(levelIndex)

Unpin a whole level from the texture store.

Parameters:
Name Type Description
levelIndex Number

view() → {View}

Get the underlying view.

Returns:
Type
View