pixijs-rendering
Fungsinya
Skill ini menjelaskan cara membuat tampilan grafis 2D di PixiJS versi 8 untuk game web dan halaman interaktif. Skill ini untuk pengembang yang membangun visual 2D cepat di browser.
Kapan dipakai
- βSaat Anda memulai proyek PixiJS versi 8 atau memperbaiki kanvas yang kosong.
- βKetika Anda perlu memuat gambar, mengatur sprite, atau menganimasikannya dengan loop ticker.
- βKetika Anda ingin orang mengklik atau menyentuh sprite dalam scene PixiJS.
Link skill
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/web-engines/pixijs-rendering/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βTampilkan deretan kartu beranimasi di halaman PixiJS yang merespons saat seseorang mengkliknya.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill ini menjelaskan cara membuat aplikasi dengan langkah pengaturan async, memuat tekstur lewat sistem aset, membangun scene graph dari container dan sprite, serta menangani event pointer.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum
Apakah ini bekerja dengan versi PixiJS yang lebih lama?
Tidak. Skill ini hanya untuk versi 8, dan menurut skill, kode lama perlu migrasi dulu.
Haruskah saya memakai Phaser saja?
Phaser memiliki model scene dan loader sendiri, yang dibahas dalam skill Phaser terpisah.
Apakah ini membahas 3D?
Tidak. Scene 3D dibahas dalam skill three.js.
Detail
Deskripsi asli dari pembuat
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).
Popularitas
- Bintang GitHub
- 6.6k
- Peringkat
- #13860
- Lisensi
- Apache-2.0
- Diperbarui
- 28/10/2026
Komentar
- β¦
Skill lain dari repositori ini
router
6.6kMembantu agent Anda memilih skill pengembangan game yang tepat untuk setiap permintaan dengan mendeteksi engine Anda dan jenis tugas yang Anda perlukan.
ai-behavior-trees-utility-ai
6.6kMembantu agent Anda membangun behavior tree dan sistem utility AI untuk musuh dan karakter game yang memilih aksi berdasarkan prioritas dan skor.
audio-design
6.6kMengajari agent Anda cara mixing audio game: bus, volume dalam desibel, ducking di bawah dialog, musik adaptif, dan variasi efek suara.
camera-systems
6.6kMembantu agent Anda membangun kamera game yang mengikuti dengan halus, tetap berada di dalam level, dan dapat mengorbit atau melihat sekeliling dalam 3D.
Skill serupa
angular-developer
280kMembantu agent Anda membuat kode Angular dan memberi saran struktur proyek. Berguna saat memulai proyek baru, membuat komponen, atau meningkatkan performa.
frontend-a11y
280kMembantu agent Anda membuat antarmuka web dapat diakses semua orang. Memastikan website dan aplikasi berfungsi baik dengan screen reader dan navigasi keyboard.
frontend-patterns
280kMembuat agent Anda menerapkan pola modern dalam frontend. Mengoptimalkan performa, mengelola state, dan mengikuti praktik terbaik React dan Next.js.