pixijs-rendering
БесплатноБез исполняемых скриптовНе проверенBuilds and debugs 2D browser game rendering with PixiJS v8: async init, Assets loading, the Container and Sprite scene graph, pointer dragging and v7-to-v8…
от gamedev-skills★ 12 656 звёзд на GitHubОб этом скилле
PixiJS 8 rendering for games
Sets up and structures a PixiJS 8.23 game renderer: the async Application, asset
loading through Assets, the Container scene graph, the ticker loop, pointer events and
render groups. PixiJS draws; it has no scenes, physics or input mapping. A game that wants
those built in is usually better served by Phaser. With PixiJS you write the loop, the
screen manager and the collision code yourself.
When to use
- Starting a PixiJS v8 game or playable, fixing a blank canvas, structuring the display list, loading textures and sprite sheets, animating with the ticker, or handling pointer input.
package.jsondepends onpixi.js8.x and code imports from'pixi.js'.- Not for dashboards, charts or other non-game UIs, Phaser projects (
phaser-core) or 3D (threejs-scene-setup). PixiJS v7 code (new Application({...}),Loader,beginFill) must be migrated first; the Gotchas list the renames.
Workflow
- Read the installed version. v8 changed boot, loading, Graphics and events, so v7 answers from memory break here.
- Create, then
await app.init({...}). The v8 constructor takes no options. Appendapp.canvasto the page. - Load before you build.
await Assets.load(...)or a manifest bundle per screen; the returnedTextureis whatSpritetakes. - Build the display list from
Containers, one per layer (world, effects, HUD). Child transforms are relative to the parent; later children draw on top. - Run game logic in one ticker callback scaled by
ticker.deltaMS / 1000(seconds) orticker.deltaTime(≈1 per 60 Hz frame). Keep rules in plain modules the callback calls. - Turn on input per object with
eventMode = 'static', thenon('pointerdown', ...). - Clean up on screen changes:
destroy()what you remove andAssets.unload()what the next screen does not need. - Verify with Verify.
Patterns
1. Async boot
import { Application, Assets, Sprite } from 'pixi.js';
const app = new Application();
await app.init({
background: '#1099bb',
resizeTo: window,
antialias: true,
// preference: 'webgpu', // a hint; default order is webgl, webgpu, canvas
});
document.body.appendChild(app.canvas);
Object.assign(window, { app }); // for the smoke check and console debugging (TS-safe)
const texture = await Assets.load('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. Layers as containers
import { Container } from 'pixi.js';
const world = new Container(); // camera: move or scale this, not every sprite
const hud = new Container(); // added last, so it draws over the world
app.stage.addChild(world, hud);
world.position.set(-camera.x, -camera.y);
world.scale.set(2);
3. One game loop on the ticker
app.ticker.add((ticker) => {
const dt = ticker.deltaMS / 1000; // seconds since the last frame
stepGame(state, input, dt); // rules live in a plain module
bunny.rotation += 1.5 * dt;
});
4. Pointer input and dragging
bunny.eventMode = 'static'; // the v8 default 'passive' ignores the object itself
bunny.cursor = 'pointer';
bunny.on('pointerdown', () => { dragging = true; });
bunny.on('pointerup', () => { dragging = false; });
bunny.on('pointerupoutside', () => { dragging = false; });
// pointermove fires only over the object in v8; globalpointermove fires on every move.
bunny.on('globalpointermove', (event) => {
if (dragging) bunny.position.copyFrom(event.global);
});
5. Load a screen's assets by name
// addBundle works at any time; Assets.init({ manifest }) only works before the first load.
Assets.addBundle('level-1', [
{ alias: 'hero', src: 'assets/hero.png' },
{ alias: 'atlas', src: 'assets/characters.json' }, // TexturePacker JSON
]);
Assets.addBundle('level-2', [{ alias: 'boss', src: 'assets/boss.png' }]);
const level = await Assets.loadBundle('level-1');
const hero = new Sprite(level.hero);
Assets.backgroundLoadBundle('level-2'); // warm the next screen while this one plays
6. Render group for a large static layer
const background = new Container({ isRenderGroup: true });
app.stage.addChildAt(background, 0);
// Hundreds of static tiles go in here. Moving `background` stays cheap;
// adding and removing children every frame cancels the benefit.
Verify
npm run build(ornpx tsc --noEmit) passes.- Smoke-test in a headless browser. With the dev server running and
window.appexposed (Pattern 1), runnode smoke.mjs <url>afternpm i -D playwrightandnpx playwright install chromium. Without browser automation, ask the user to open the page and report the console output and what is drawn.
// smoke.mjs: fails on page errors; prints the backend and the display list size.
import { chromium } from 'pl
Установить pixijs-rendering в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл pixijs-rendering?
Builds and debugs 2D browser game rendering with PixiJS v8: async init, Assets loading, the Container and Sprite scene graph, pointer dragging and v7-to-v8 migration. Use when a game or playable ad uses pixi.js, or on a blank canvas, clicks not firing, or drag stopping at the sprite edge. Not for dashboards or charts, Phaser (`phaser-core`) or 3D (`threejs-scene-setup`).
Как установить скилл pixijs-rendering?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pixijs-rendering запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic