Optional options: Options<OptionsObject> | Partial<SpritesLayerOptions>Optional listeners: Partial<Record<LayerLifecycleEvent, LayerLifecycleListener<SpritesLayer> | LayerLifecycleListener<SpritesLayer>[]>>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.
Register a handler for a layer lifecycle event. Multiple handlers may be
registered for the same event; they fire in registration order.
Returns this for chaining.
Remove a previously registered event handler. No-op if the handler was not registered for that event.
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
Create a sprite and add it to the layer
(horizontal distance between frames)
(vertical distance between frames)
horizontal position on the layer: pixels (12) or a percentage string ('50%')
vertical position on the layer: pixels (12) or a percentage string ('50%')
Add an existing Sprite object to the layer ad x,y position
horizontal position: pixels (12) or a percentage string ('50%')
vertical position: pixels (12) or a percentage string ('50%')
Optional v: booleantrue if sprite was assed false otherwise
Add sequence of animations to sprite queue
Current layer opacity (0 to 1)