pixijs-rendering
できること
ウェブのゲームやインタラクティブなページのために、PixiJSバージョン8で2Dの表示を設定する方法を説明します。ブラウザ上で高速な2Dの視覚表現を作る開発者向けです。
使う場面
- ✓PixiJSバージョン8のプロジェクトを始めたり、空白のキャンバスを直したりしているとき。
- ✓アセットシステムで画像を読み込み、スプライトを整理し、ティッカーのループでアニメーションさせたいとき。
- ✓PixiJSのシーンで、人がスプライトをクリックやタップできるようにしたいとき。
スキルのリンク
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/web-engines/pixijs-rendering/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“PixiJSのページに、アニメーションするカードが並んでいて、誰かが一枚をクリックすると反応するものを表示してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルは、非同期の設定の手順を使ってアプリを作る方法、アセットシステムを通じてテクスチャを読み込む方法、コンテナとスプライトからなるシーングラフを組み立てる方法、そしてポインターイベントを扱う方法を説明します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
PixiJS 8.22 Rendering
Set up and structure a PixiJS 8.22 application: the async Application, asset
loading via Assets, the Container/Sprite scene graph, the ticker loop,
pointer events, and render groups. Pins the 8.22 API (async init, unified
Assets, eventMode).
When to use
- Use when starting a PixiJS v8 project, fixing a blank canvas, structuring the display list, loading textures, animating via the ticker, or handling pointer input.
- Use when
package.jsondepends onpixi.js(v8) and code doesimport { Application } from 'pixi.js'.
When not to use: Phaser's scene/loader model → phaser-core. 3D scenes →
threejs-scene-setup. PixiJS v7-and-earlier code (synchronous new Application({...}), Loader, beginFill/endFill) needs the v8 migration first;
this skill targets v8 only. (interactive = true still works in v8 as an alias for
eventMode = 'static', but prefer the explicit eventMode.)
Core workflow
- Create and
awaitthe Application. In v8,new Application()is empty; configuration happens inawait app.init({...}). Appendapp.canvas(notapp.view) to the DOM. Wrap top-levelawaitin an async function for bundlers. - Load assets with
Assets.await Assets.load(url)returns aTexture. For many assets, register a manifest/bundle and load by name. There is no v7Loader. - Build the scene graph. Everything descends from
app.stage(aContainer). Group related objects inContainers; child transforms are relative to the parent. Draw order = insertion order (later = on top). - Animate with the ticker.
app.ticker.add((ticker) => {...}). Scale motion byticker.deltaTime(frames, ~1 at 60fps) orticker.deltaMS(milliseconds) so speed is frame-rate independent. - Enable events per object by setting
eventMode = 'static'(or'dynamic'), thenobj.on('pointerdown', ...). Federated pointer events cover mouse/touch/pen. - Promote big static subtrees to render groups (
isRenderGroup: true) so the GPU caches their transforms. Profile before and after; confirm pixels on screen.
Patterns
1. Async Application boot (the v8 entry point)
import { Application, Assets, Sprite } from 'pixi.js';
(async () => {
// v8: construct empty, then await init(). Config does NOT go in the constructor.
const app = new Application();
await app.init({
background: '#1099bb',
resizeTo: window, // track the window size
antialias: true,
// preference: 'webgpu', // hint only; default order tries 'webgl' first.
// // Pixi falls back if the backend is unavailable —
// // branch on app.renderer.name, don't assume it took.
});
document.body.appendChild(app.canvas); // v8 uses app.canvas, not app.view
const texture = await Assets.load('https://pixijs.com/assets/bunny.png');
const bunny = new Sprite(texture);
bunny.anchor.set(0.5);
bunny.position.set(app.screen.width / 2, app.screen.height / 2);
app.stage.addChild(bunny);
})();
2. Containers for a relative-transform scene graph
import { Container, Sprite } from 'pixi.js';
const world = new Container();
app.stage.addChild(world);
// Children are positioned relative to `world`; move/scale/rotate the whole group
// by transforming the parent.
for (let i = 0; i < 10; i++) {
const coin = new Sprite(coinTexture);
coin.x = i * 40;
world.addChild(coin);
}
world.position.set(100, 100);
world.scale.set(2); // every coin scales with the container
3. The ticker loop (frame-rate independent)
let elapsed = 0;
app.ticker.add((ticker) => {
// deltaTime ≈ 1 at 60fps; deltaMS is milliseconds since last frame.
elapsed += ticker.deltaMS;
bunny.rotation += 0.05 * ticker.deltaTime; // smooth at any frame rate
bunny.y = app.screen.height / 2 + Math.sin(elapsed / 500) * 50;
});
4. Pointer events (federated)
bunny.eventMode = 'static'; // 'static' = interactive, doesn't move on its own
bunny.cursor = 'pointer'; // hover cursor; `buttonMode` was removed in v8
bunny.on('pointerdown', (event) => {
bunny.tint = 0xff0000;
// event.global is the pointer position in stage space.
});
bunny.on('pointerover', () => bunny.scale.set(1.1));
bunny.on('pointerout', () => bunny.scale.set(1.0));
Dragging needs globalpointermove, not pointermove. In v8 pointermove fires
**only while the
よくある質問
古いPixiJSのバージョンでも使えますか?
いいえ。対象はバージョン8だけで、スキルによると古いコードには先に移行が必要です。
代わりにPhaserを使うべきですか?
Phaserは独自のシーンとローダーのモデルを持っており、それは別のPhaserのスキルで扱われます。
3Dも扱いますか?
いいえ。3Dのシーンは、three.jsのスキルで扱われます。
詳細
作者による元の説明
Build a PixiJS v8 render layer: create the async Application, load textures with Assets, compose the scene graph with Container and Sprite, drive the ticker loop, wire pointer events, and group draws with render groups. Use when building or debugging PixiJS v8 — when the user mentions PixiJS, Pixi, Application, app.stage, Container, Sprite, Assets.load, app.ticker, or eventMode. Pins the v8 async init() API (examples checked against 8.22).
人気
- GitHubのスター
- 6.6k
- ランキング
- #13860
- ライセンス
- Apache-2.0
- 更新日
- 2026/10/28
コメント
- …
このリポジトリの他のスキル
router
6.6kエージェントが、エンジンとタスクの種類を見分けて、依頼に合ったゲーム開発のスキルを選べるよう支援します。
ai-behavior-trees-utility-ai
6.6kエージェントが、優先度と点数によって行動を選ぶ、ゲームの敵やキャラクター向けのビヘイビアツリーとユーティリティAIのシステムを作れるよう支援します。
audio-design
6.6kエージェントが、オーディオバス、デシベルでの音量、会話中の音の抑え込み(ダッキング)、適応型の音楽、効果音のバリエーションなど、ゲームのサウンドのミキシングを教えます。
camera-systems
6.6kエージェントが、なめらかに追従し、レベルの内側に収まり、3Dで周回したり見回したりできるゲームのカメラを作れるよう支援します。
似ているスキル
angular-developer
280kエージェントがAngularのコードを作成し、プロジェクト構成についてアドバイスできるようにします。新しいプロジェクトの開始、コード部品の作成、パフォーマンスやアクセシビリティの改善に役立ちます。
frontend-a11y
280kエージェントが Web インターフェースを誰にとっても使いやすくするよう支援します。スクリーンリーダーやキーボード操作に対応し、サイトやアプリが適切に動作するようにします。
frontend-patterns
280kエージェントがフロントエンド開発の最新パターンを適用できるようにします。React と Next.js において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。