pixijs-scene-core-concepts

Explain PixiJS v8 scene graph structure, transforms, and render-order behavior.

Updated Mar 13, 2022
One-click install
npx skills add https://github.com/alexkafer/alexkafer-web --skill pixijs-scene-core-concepts-alexkafer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pixijs-scene-core-concepts
Source: https://github.com/alexkafer/alexkafer-web/tree/main/.agents/skills/pixijs-scene-core-concepts
Command: npx skills add https://github.com/alexkafer/alexkafer-web --skill pixijs-scene-core-concepts-alexkafer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It prevents confusion about how PixiJS v8’s scene graph, transforms, and render order work together, so you can build correct and performant display trees instead of guessing.

Core Features & Use Cases

  • Container vs. leaf model: explains the critical separation between grouping nodes (Containers) and draw-only nodes (Sprites, Graphics, Text, Mesh, etc.).
  • Transforms and coordinate spaces: clarifies local vs world transforms and when to use toGlobal/toLocal for correct positioning and hit logic.
  • Render behavior controls: covers render order (children order, sortableChildren, zIndex), RenderLayer vs hierarchy, render groups (isRenderGroup), culling, masking, and destruction lifecycle semantics.

Quick Start

Use the pixijs-scene-core-concepts skill to choose which node type to use and how to structure transforms and rendering for your PixiJS v8 scene.

Frequently Asked Questions about pixijs-scene-core-concepts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does the PixiJS scene graph handle render order for child DisplayObjects?

PixiJS scene graph render order is determined by sibling array indices, with lower indices drawn first. Alternatively, enabling sortableChildren on a Container allows zIndex-based sorting to control the visual stacking of its children.

What is the difference between a Container and a leaf node in PixiJS v8?

A Container in PixiJS v8 acts as a grouping node that can hold children, whereas a leaf node like a Sprite, Graphics, or Text is a draw-only object. Leaf nodes cannot accept children, so attempting to attach them causes hierarchy errors.

How do I convert coordinates between local and world spaces in a PixiJS DisplayObject hierarchy?

Convert coordinates in a PixiJS DisplayObject hierarchy by using the toGlobal and toLocal methods. These functions account for localTransform and worldTransform composition, ensuring accurate positioning and hit detection across nested nodes.

When should I use PixiJS render groups or RenderLayer instead of standard Container hierarchy?

Use PixiJS render groups or RenderLayer when you need specific render batching or layer separation independent of the DisplayObject hierarchy. Setting isRenderGroup on a Container isolates its rendering, while RenderLayer separates visual ordering from structural nesting.

Why are my PixiJS masks or culling not applying correctly to nested DisplayObjects?

Masks or culling in PixiJS may fail if applied to incorrect node types or if worldTransform composition is misunderstood. Ensure masks target valid Containers or leaf nodes and verify that culling checks respect the current coordinate space.

How do I safely construct and destroy PixiJS DisplayObject hierarchies without memory leaks?

Safely destroy PixiJS DisplayObject hierarchies by calling destroy on root Containers, which propagates destruction to children. Avoid attaching children to leaf nodes and remove references to prevent memory leaks during the destruction lifecycle.