pixijs-scene-dom-container
Use this skill when overlaying HTML elements on the PixiJS v8 canvas. Covers DOMContainer with element, anchor, and scene-graph-driven CSS transforms, the pixi.js/dom side-effect import, DOMPipe registration, visibility sync, pointer-events handling. Triggers on: DOMContainer, pixi.js/dom, DOMPipe, HTML overlay, input on canvas, iframe overlay, DOMContainerOptions, element, anchor, constructor options.
Security Assessment
About pixijs-scene-dom-container
This skill covers DOMContainer in PixiJS v8, the mechanism for overlaying HTML elements on the PixiJS canvas and driving their CSS transforms from the scene graph. It is used for native inputs, iframes, videos, or rich HTML that needs to follow a display object's position. DOMContainer is marked EXPERIMENTAL in v8, meaning its API may change between minor releases. It extends ViewContainer and is therefore a leaf in the scene graph: PixiJS children cannot be nested inside it, though HTML content can be nested inside the element itself, and multiple DOMContainer instances can be wrapped in a plain Container. It is unavailable in Web Workers, which have no DOM.
The default pixi.js browser bundle registers the required DOMPipe automatically via browserAll.ts, so DOMContainer works out of the box in a typical browser app. An explicit side-effect import 'pixi.js/dom' (or the combined import that also re-exports the class) is needed only for custom builds using skipExtensionImports: true or non-browser bundles. The constructor accepts all Container options plus two leaf-specific ones: element (any HTMLElement; a bare div is created if omitted) and anchor (a PointData or number controlling the element's origin, where 0 is top-left, 0.5 centers, and 1 is bottom-right). Transforms on the container, including scale, rotation, and inherited alpha, propagate to the element as CSS transform and opacity each frame.
Key behaviors include direct CSS styling of the element (PixiJS does not interfere), pointer-events handling where the shared root div is pointer-events: none and each attached element defaults to auto, and visibility/cleanup semantics where setting visible = false or removing from the scene graph detaches the element, and destroy() removes it while preserving the HTML element for reuse. The DOMPipe uses a shared root div at z-index 1000, exposed as app.domContainerRoot, that hosts every attached element above canvas content and stays aligned via a ResizeObserver on the canvas bounding rect. A documented limitation is that tint, filters, masks, and blendMode are accepted but have no visual effect, since DOM elements live outside the WebGL/WebGPU pipeline; CSS filters and mix-blend-mode must be used instead.
FAQ
Do I need the pixi.js/dom import to use DOMContainer?
Not usually. The default pixi.js browser bundle auto-registers DOMPipe, so it works out of the box. You only need an explicit import 'pixi.js/dom' for custom builds using skipExtensionImports: true or non-browser bundles.
Can I add PixiJS children inside a DOMContainer?
No. DOMContainer extends ViewContainer with allowChildren = false, making it a leaf. To group it with PixiJS objects, wrap the DOMContainer and the other objects together in a plain Container; for nested HTML, nest inside the element itself.
Why do filters, masks, and blend modes have no effect on my DOM element?
DOM elements are HTML overlays positioned via CSS transforms and live outside the WebGL/WebGPU pipeline, so PixiJS tint, filters, masks, and blendMode are accepted but do nothing visually. Use CSS filter and mix-blend-mode on the element directly.
What does the anchor option do?
anchor sets the element's origin relative to its own dimensions: 0 is top-left, 0.5 centers, and 1 is bottom-right. A single number sets both axes, while an object { x, y } sets each independently.
What happens to the element when I call destroy()?
destroy() removes the element from its parent node and nulls internal references, but the HTML element itself is preserved, so you can re-attach it elsewhere (for example via dom.element then document.body.appendChild). Setting visible = false also detaches it, and restoring visibility re-attaches it.
Install pixijs-scene-dom-container
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
pixijs/pixijs-skills