Token导航 LogoToken导航TokenDH.com
待分类操作浏览器github未标认证来源可访问许可证需确认审计通过

pixijs-scene-dom-containerpixjs 场景 dom 容器

Agent Skill

pixijs-scene-dom-container 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

7,152

周安装

301

GitHub Stars

164

下载量

2,504
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:pixijs-scene-dom-container(pixjs 场景 dom 容器)
来源仓库:https://github.com/pixijs/pixijs-skills
仓库路径:skills/pixijs-scene-dom-container
安装命令:
npx skills add https://github.com/pixijs/pixijs-skills --skill pixijs-scene-dom-container
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/pixijs/pixijs-skills --skill pixijs-scene-dom-container

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合围绕仓库状态、代码变更或协作事项进行整理和分析。
  • 通过 npx skills add 命令安装,需结合原始 README 核验具体用法。
  • 安装前建议确认权限范围和维护状态,避免触发不必要的联网或文件操作。
  • pixijs-scene-dom-container 属于待分类类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

DOMContainer positions an HTML element over the PixiJS canvas and drives its CSS transform from the scene graph. Use it for native inputs, iframes, videos, or rich HTML that needs to follow a display object's position. The default pixi.js browser bundle registers the DOMPipe automatically; custom builds add a side-effect import 'pixi.js/dom'.

DOMContainer is marked EXPERIMENTAL in PixiJS v8. The API may change between minor releases.

Assumes familiarity with pixijs-scene-core-concepts. DOMContainer extends ViewContainer, so it's a leaf: do not nest PixiJS children inside it. Nest DOM content inside the HTML element itself, or wrap multiple DOMContainer instances in a Container. Not available in Web Workers; a worker has no DOM to overlay.

Quick Start

import "pixi.js/dom";

const input = document.createElement("input");
input.type = "text";
input.placeholder = "Enter name...";

const dom = new DOMContainer({
  element: input,
  anchor: 0.5,
});
dom.position.set(app.screen.width / 2, app.screen.height / 2);

app.stage.addChild(dom);

Related skills: pixijs-scene-core-concepts (scene graph basics), pixijs-scene-container (wrap multiple DOM overlays), pixijs-events (pointer handling on canvas vs DOM), pixijs-accessibility (screen-reader overlays).

Constructor options

All Container options (position, scale, tint, label, filters, zIndex, etc.) are also valid here — see skills/pixijs-scene-core-concepts/references/constructor-options.md.

Leaf-specific options added by DOMContainerOptions:

OptionTypeDefaultDescription
elementHTMLElementdocument.createElement('div')The HTML element the container drives. Any element is valid: input, textarea, iframe, video, div, etc. If omitted, a bare <div> is created.
anchor`PointData \number`0Origin of the element relative to its own dimensions. 0 is top-left, 0.5 centers, 1 is bottom-right. A single number sets both axes; {x, y} sets each independently.

tint, filters, mask, and blendMode are accepted (inherited from Container) but have no visual effect — DOM elements live outside the WebGL/WebGPU pipeline. Style the element via CSS for those effects.

Core Patterns

Setup and the side-effect import

import "pixi.js/dom";
import { DOMContainer } from "pixi.js";

Or use the combined import that registers the pipe and re-exports the class:

import { DOMContainer } from "pixi.js/dom";

The default pixi.js browser bundle already imports pixi.js/dom for you via browserAll.ts, so DOMContainer works out of the box in a typical browser app. You only need the explicit import 'pixi.js/dom' line when you set skipExtensionImports: true (custom builds) or when running under a non-browser bundle.

Transforms, anchor, and alpha

const dom = new DOMContainer({
  element: document.createElement("div"),
  anchor: 0.5,
});
dom.position.set(400, 300);
dom.scale.set(1.5);
dom.rotation = Math.PI / 8;
dom.alpha = 0.5;

Transforms on the DOMContainer propagate to the element as CSS transform. anchor shifts the element's origin relative to its own dimensions: 0 is top-left, 0.5 centers, 1 is bottom-right. A single number sets both axes; an object {x, y} sets each independently. alpha (including inherited parent alpha) is written to the element's style.opacity every frame.

If no element is provided, a <div> is created by default.

Styling the element directly

const panel = document.createElement("div");
panel.innerHTML = "<h2>Score</h2><p>1500</p>";
panel.style.color = "white";
panel.style.fontFamily = "Arial";
panel.style.pointerEvents = "none";

const dom = new DOMContainer({ element: panel });
dom.position.set(50, 50);
app.stage.addChild(dom);

PixiJS does not interfere with CSS styling on the element. The shared root <div> is set to pointer-events: none, and each attached element defaults to pointer-events: auto. Override to none on purely decorative overlays so the canvas still receives clicks underneath them.

Visibility and cleanup

dom.visible = false;
dom.visible = true;

dom.destroy();

Setting visible = false or removing the DOMContainer from the scene graph detaches the element from the DOM. Restoring visibility re-attaches it. destroy() removes the element from its parent node and nulls internal references; the HTML element itself is preserved, so you can re-attach it elsewhere:

const element = dom.element;
dom.destroy();
document.body.appendChild(element);

The DOM container root

The DOMPipe uses a shared root <div> with z-index: 1000 that hosts every attached element. It's exposed as app.domContainerRoot (an HTMLDivElement). All DOMContainer elements render above canvas content; you can't interleave DOM elements between PixiJS draw calls.

On the first render that has an attached DOMContainer, the pipe automatically appends the root to the canvas's parent node. Append it yourself next to app.canvas if you need explicit, stable placement in the DOM tree (for example, when the canvas shares a wrapper with other layered content):

document.body.appendChild(app.canvas);
document.body.appendChild(app.domContainerRoot);

The root uses absolute positioning and its transform is recomputed from the canvas getBoundingClientRect() via a ResizeObserver, so CSS-scaled canvases stay aligned without extra work.

Common Mistakes

[MEDIUM] Missing the pixi.js/dom import in custom builds

The default browser bundle auto-registers DOMPipe, so most apps do not need an explicit import. It is only required when you opt out of auto-imports:

await app.init({ skipExtensionImports: true });
// Now you must add this yourself:
import "pixi.js/dom";

Without registration under a custom build, DOMContainer is still importable but the renderer has no pipe to process it; elements never synchronize with the scene graph and never appear.

[MEDIUM] Expecting filters, masks, or blend modes to affect DOM elements

Wrong:

const dom = new DOMContainer();
dom.filters = [new BlurFilter()];

Correct:

dom.element.style.filter = "blur(4px)";

DOM elements are HTML overlays positioned via CSS transforms; they exist outside the WebGL/WebGPU pipeline. PixiJS filters, masks, and blend modes have no effect on them. Use CSS filters and CSS mix-blend-mode on the element directly.

[MEDIUM] Do not nest children inside a DOMContainer

Wrong:

const dom = new DOMContainer();
dom.addChild(new Sprite(texture));

Correct:

const group = new Container();
group.addChild(dom, new Sprite(texture));

DOMContainer extends ViewContainer, which sets allowChildren = false. It is a leaf in the PixiJS scene graph. For PixiJS children, wrap the DOMContainer alongside them in a plain Container. For nested HTML, nest inside the element itself (element.appendChild(...)).

[LOW] Forgetting to set anchor for centered positioning

The default anchor is (0, 0), placing the element's top-left corner at the container's position. For centering a UI element on its scene-graph position, set anchor: 0.5:

const dom = new DOMContainer({ element: myElement, anchor: 0.5 });
dom.position.set(400, 300);

API Reference

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.77%
按下载量换算896

Claude

29.1%
按下载量换算729

Cursor

17.48%
按下载量换算438

Gemini CLI

8.49%
按下载量换算213

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills