Overview
These components render images, sprite sheet animations, and text onto the PixiJS stage. All sprite and text components accept standard PixiJS positioning props (x, y, scale, rotation, etc.) inherited from their underlying PIXI display objects.
<Sprite>
Renders a single static texture loaded from the asset manifest. The texture is looked up bykey from stateApp.loadedAssets.
Props
The key used in the asset manifest (
createApp({ assets })) to identify this texture. Must correspond to an asset with type: 'sprite'.When
true, logs an error to the console if the texture key is not found in loadedAssets. Useful during development.Not normally set directly on
<Sprite> — the texture is resolved automatically from key. Use BaseSprite if you need to supply a texture directly.Horizontal position in pixels from the parent origin. Default
0.Vertical position in pixels from the parent origin. Default
0.Sets the sprite’s origin/pivot.
0 = top-left, 0.5 = centre, 1 = bottom-right. Accepts a uniform number or { x, y }. Default 0.Uniform or per-axis scale. Default
1.Rotation in radians. Default
0.Opacity from
0 to 1. Default 1.Whether the sprite is rendered. Default
true.Sort order within the parent container. Default
0.Colour tint applied to the texture. Default
0xffffff (no tint).Apply this sprite as an alpha mask on the parent container.
CSS cursor string shown on hover.
Example
<AnimatedSprite>
Renders a frame-by-frame animation from an array of textures. WrapsPIXI.AnimatedSprite.
Props
Array of textures (or frame objects with
texture and time) that form the animation frames.When
true, calls gotoAndPlay(0). When false, calls gotoAndStop(0). Use this to start and stop the animation declaratively. Default false.Playback speed multiplier.
1 = normal speed, 0.5 = half speed. Default 1.Whether the animation loops. Default
true.Horizontal position. Default
0.Vertical position. Default
0.Origin/pivot point. Default
0 (top-left).Uniform or per-axis scale. Default
1.Opacity from
0 to 1. Default 1.Whether the sprite is rendered. Default
true.Sort order within the parent. Default
0.Colour tint applied to all frames. Default
0xffffff.CSS cursor string.
Example
<SpriteSheet>
A specialised<AnimatedSprite> that resolves its textures automatically from the asset manifest. Use with assets declared as type: 'spriteSheet'.
Props
Asset manifest key for a
spriteSheet asset. The loaded texture array is passed automatically to the underlying <AnimatedSprite>.Whether to play the animation. Default
false.Playback speed multiplier. Default
1.Whether the animation loops. Default
true.Horizontal position. Default
0.Vertical position. Default
0.Origin/pivot point. Default
0.Opacity from
0 to 1. Default 1.Whether the sprite is rendered. Default
true.Sort order within the parent. Default
0.CSS cursor string.
Example
<Text>
Renders a text string using a PixiJS canvas-rendered font. WrapsPIXI.Text.
Props
The string to display.
Text styling options: font family, size, weight, colour, stroke, word wrap, alignment, etc. See the PixiJS TextStyle docs for all options.
Callback fired whenever the rendered size of the text changes — on mount and whenever
text or style changes. Useful for dynamically repositioning elements relative to text bounds.Horizontal position. Default
0.Vertical position. Default
0.Origin/pivot point.
0.5 centres the text on x/y. Default 0.Uniform or per-axis scale. Default
1.Opacity from
0 to 1. Default 1.Whether the text is rendered. Default
true.Sort order within the parent. Default
0.CSS cursor string.
Example
<BitmapText>
Renders text using a pre-rasterised bitmap font. Faster than<Text> for frequently updated strings (scores, counters) because it does not re-rasterise on every change. Requires a font asset loaded via the manifest.
<BitmapText> has the same props as <Text>. The style.fontFamily must match the name of a loaded bitmap font.
Props
The string to display.
Text style.
fontFamily must match the loaded bitmap font name.Callback fired on mount and whenever
text or style changes with the current rendered dimensions.Horizontal position. Default
0.Vertical position. Default
0.Origin/pivot point. Default
0.Opacity. Default
1.Whether the text is rendered. Default
true.Sort order within the parent. Default
0.CSS cursor string.
Example
Use
<BitmapText> over <Text> for values that update every frame (live counters, timers). Bitmap fonts are rendered once and reused, so repeated text updates are cheaper.