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…
PixiJS 8 rendering for games
Sets up and structures a PixiJS 8.22 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.json depends on pixi.js 8.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.
Workflowdon't have the plugin yet? install it then click "run inline in claude" again.
restructured into six implexa components with explicit decision points for common pitfalls, edge cases for each procedure step (network failures, cache behavior, gpu leaks), and clear outcome signals for visual and performance validation; preserved all v8-specific patterns and original author intent.
build and structure a pixijs v8 application from scratch: async application boot, texture loading via assets, scene graph composition with containers and sprites, frame-rate independent animation via the ticker, pointer event handling (mouse/touch/pen), and render group optimization for static layers. use this when starting a pixijs v8 project, fixing a blank canvas, structuring the display list, loading textures, animating sprites, or wiring up pointer input. do not use for phaser (use phaser-core instead), 3d scenes (use threejs-scene-setup), or pixijs v7-and-earlier code (migrate to v8 first).
construct and initialize the application
new Application() with no arguments (v8 constructor is empty)app.init({ background, resizeTo, antialias, preference }) to configure and bind the rendererapp.renderer.name to branch on actual backendappend canvas to the dom
document.body.appendChild(app.canvas) or append to a specific containerload a single asset
await Assets.load(url) to fetch and cache the textureregister and load many assets by bundle manifest
await Assets.init({ manifest }) once at bootawait Assets.loadBundle(bundleName) to load all assets in that bundleconstruct a sprite and position it
new Sprite(texture), set sprite.anchor.set(0.5) to center, set sprite.position.set(x, y)add sprite/objects to the scene graph
parent.addChild(child) to attach child; draw order = insertion order (later = rendered on top)group objects in a container for relative transforms
new Container(), call container.addChild(sprite1, sprite2, ...) or addChild per spritecontainer.position, container.scale, container.rotation to transform all children relative to this parentanimate via the ticker loop
app.ticker.add((ticker) => { obj.rotation += 0.05 * ticker.deltaTime; })ticker.deltaTime (dimensionless, ~1 at 60fps) or ticker.deltaMS (milliseconds) to scale motionenable pointer events on an object
object.eventMode = 'static' (or 'dynamic' for moving objects); default 'passive' disables this object's own eventsobject.cursor = 'pointer' to change hover cursor (buttonMode was removed in v8)object.on(eventName, (event) => { ... }) to bind handler; event.global gives pointer position in stage spacehandle object dragging
object.eventMode = 'static' and bind pointerdown/pointerup/pointerupoutside to toggle a dragging flagglobalpointermove (not pointermove) to update object.position based on event.global while dragging is trueoptimize static layers with render groups
new Container({ isRenderGroup: true }) and add it to the stagehandle renderer backend fallback
app.renderer.name after init completes ('webgl', 'webgpu', or 'canvas')clean up and destroy
sprite.destroy() to free sprite's internal resources, then Assets.unload(url) for texturesapp.destroy({ releaseGlobalResources: true }) if tearing down and re-creating app in same tabif using pixijs v7 or earlier: this skill targets v8 only. migrate code first (Loader → Assets, synchronous Application() → async init(), beginFill/endFill() → shape.rect().fill()). the v8 api is not backward compatible.
if canvas is blank after init: check that you awaited app.init() and appended app.canvas (not deprecated app.view). app.stage exists immediately, but app.renderer (and thus app.canvas, app.screen) are undefined until init() resolves.
if texture loads but sprite is blank: confirm you awaited Assets.load(url). Texture.from(url) in v8 only reads the cache; it will not fetch. always use await Assets.load().
if clicks/taps do nothing on an object: verify eventMode is set to 'static' or 'dynamic'. default is 'passive' (children still interactive, but this object is not). set it explicitly.
if drag stops at object edge: use globalpointermove instead of pointermove. in v8, pointermove fires only while pointer is over the object; dragging past the edge stops updating.
if right-click opens browser context menu over the game: from 8.22, listen for contextmenu event on the object and call event.preventDefault(). on older 8.x versions, add native contextmenu listener to app.canvas instead. PixiJS does not block it by default.
if motion speed varies with frame rate: multiply movement by ticker.deltaTime or ticker.deltaMS. never assume 60fps or hardcode frame deltas.
if pixel art texture is blurry: set texture.source.scaleMode = 'nearest' after loading, or pass it in the Assets.load options.
if memory grows over time: removeChild does not free gpu memory. call sprite.destroy() and Assets.unload(url) for assets no longer needed.
if app flickers or corrupts after teardown/recreation: call app.destroy({ releaseGlobalResources: true }). otherwise pooled batches and textures from the old app leak into the new one.
if renderer backend preference is unavailable: pixi silently falls back. check app.renderer.name and branch on actual backend. do not assume preference was honored.
if top-level await fails in bundler: wrap boot in (async () => { ... })() iife. vite ≤6.0.6 requires this workaround.
if addChild logs deprecation warning on Sprite/Graphics/Text: in v8 only Containers should hold children. refactor: put the sprite and its children side-by-side in a Container parent.