Optional options: Options<OptionsObject> | Partial<BaseLayerOptions>Optional loadedListener: ((layer) => void | Promise<void>)Optional updatedListener: ((layer) => void | Promise<void>)Current layer opacity (0 to 1)
Get layer width
Get layer height
Get output canvas
Add a renderer to this layer. It's constructed with the layer's own width/height, so callers pass only the class and its config - never dimensions.
the constructed, initialised renderer instance
const shaky = await layer.addRenderer('shaky', ShakyRenderer, { mode: 'decay' })
shaky.triggerShake()
Pause a renderer without destroying it. The instance is kept and can be re-enabled with activateRenderer. Order in the queue is preserved.
Renderer id to deactivate. No-op if not found or already inactive.
Re-enable a previously deactivated renderer, restoring it at its original
position in the queue. The renderer must have been registered via the
constructor renderers dict or addRenderer.
Renderer id to activate.
if the renderer is not registered on this layer.
Animate layer opacity from its current value to 1 (fully opaque).
fade duration in ms
easing function (defaults to easeOutSine)
resolves when the fade completes
Animate layer opacity from its current value to 0 (fully transparent).
fade duration in ms
easing function (defaults to easeOutSine)
resolves when the fade completes
Add a nested LayerGroup as a child of this group. The dedicated entry point for groups - see Dmd.addLayerGroup for why groups take no listeners.
Optional options: Options<OptionsObject> | Partial<BaseLayerOptions>group options (dimensions, position, background, renderers, ...)
Optional options: Options<OptionsObject> | Partial<BaseLayerOptions>Optional layerLoadedListener: ((layer) => void | Promise<void>)Optional layerUpdatedListener: ((layer) => void | Promise<void>)Adding a LayerGroup through addLayer is deprecated and will be removed in the next major version - use addLayerGroup instead.
Add a child layer to this group. Mirrors Dmd.addLayer — same factory, same position-resolution logic, but relative to this group's own width/height rather than the Dmd's.
Optional options: LayerOptionsByInstance<T>Optional layerLoadedListener: ((layer) => void | Promise<void>)Optional layerUpdatedListener: ((layer) => void | Promise<void>)Optional layerOnPlayListener: LayerPlayListenerByInstance<T>Optional layerOnPauseListener: LayerPlayListenerByInstance<T>Optional layerOnStopListener: LayerStopListenerByInstance<T>
A "virtual" layer that cannot draw content itself. It can be dimensioned, positioned, given renderers, a background color/opacity, and shown/hidden exactly like any other layer, but its content is entirely derived from compositing its children (which may include nested LayerGroups) in zIndex order.