Skip to content

Components

@shell/pixi separates serializable render intent from transient PixiJS object references. An entity can own multiple PixiJS nodes while sharing one ECS transform, size, and pivot.

Sprite is a serializable, editor-visible marker that requests a PixiJS Sprite. It requires the runtime PixiTransformGroup component automatically.

entity.addComponent(Sprite);

Text is serializable, editor-visible text content and style. It requires the runtime PixiTransformGroup component automatically.

FieldTypeDefault
textstring''
fontFamilystring''
fontSizenumber16
alignstring'left'
fillnumber0xffffff

Texture specifies the sprite asset source. It requires Sprite, so legacy scene data containing Texture without a serialized Sprite marker still recreates the complete runtime component chain.

FieldTypeDefault
sourcestring''

Texture loading is asynchronous. Completion is ignored if the original sprite was removed or its registry handle was reused.

Tint.color applies a color tint to a sprite and defaults to 0xffffff.

NineSlice keeps the borders of a sprite’s picture from stretching: the corners keep their size, the edges stretch along themselves, and the middle stretches both ways. It requires Sprite. Give the sprite a Size to say how large it is.

FieldTypeDefault
leftnumber0
topnumber0
rightnumber0
bottomnumber0

The borders are in pixels of the picture. Adding or removing NineSlice on a sprite that exists replaces its PixiJS node.

Camera.zoom controls the world view zoom and defaults to 1.

PixiRenderLayer.layer selects where an entity renders. PixiLayer.World is camera-transformed; PixiLayer.Ui uses screen coordinates and renders above the world.

import { PixiLayer, PixiRenderLayer } from '@shell/pixi';
const screen = resources.get('pixiApp').toScreen(entity.$position.x, entity.$position.y);
resources.get('transforms').teleport(entity, screen);
entity.addComponent(PixiRenderLayer, { layer: PixiLayer.Ui });

PixiTransformGroup is runtime-only and is neither serialized nor shown in the editor:

FieldPurpose
handleNumeric registry handle for all PixiJS nodes owned by an entity.
revisionChanges whenever a render role is attached to the group.

PixiTransformGroup is a logical registry group, not a physical PixiJS Container. Renderables remain direct children of either the flat world or screen-space UI container. The registry owns concrete sprite and text references by role; they are not stored in ECS components.

Most applications should use Sprite, Text, Image, and TextLabel directly.

An entity may contain both Sprite and Text. Both PixiJS objects receive the same transform, Size, and Pivot values:

entity.addComponent(Sprite);
entity.addComponent(Text, { text: 'Selected' });

Removing Sprite destroys only the sprite. Removing Text destroys only the text. Removing the entity or PixiTransformGroup destroys all remaining nodes synchronously.

Pixi systems consume Position, Rotation, Transform, Pivot, Anchor, and Size from the canonical @shell/transform package. @shell/pixi does not re-export these components.

import { Sprite, Texture } from '@shell/pixi';
import { Position, Size } from '@shell/transform';