pixijs-scene-sprite — Claude Code skill: sprites in PixiJS v8
This skill tells your agent how to draw images in PixiJS v8 with Sprite, AnimatedSprite, NineSliceSprite and TilingSprite. Useful when the project already runs PixiJS and you want working draw code fast.
npx skills add pixijs/pixijs-skills --skill pixijs-scene-sprite -a claude-codeWhat pixijs-scene-sprite does
Four sprite classes are covered. Sprite draws one texture at a position, AnimatedSprite cycles frames from an array or spritesheet, NineSliceSprite stretches the center of a panel while keeping corners intact, and TilingSprite repeats a texture across an area and scrolls it through tilePosition. All of them are leaf nodes with no children, so grouping goes through a Container.
The skill also walks through common mistakes. Texture.from(url) in v8 only reads the cache, it does not fetch, so you need await Assets.load(...) first. It separates anchor from pivot too: anchor sits in the [0, 1] range and moves only the draw origin, while pivot works in pixels and shifts both the transform and the visual position, which is why sprites jump. For centering it suggests anchor.set(0.5).
Prior familiarity with pixijs-scene-core-concepts is assumed. The skill points at sibling skills in the same repo for texture loading, ParticleContainer with thousands of sprites, and performance. If you are drawing shapes rather than images, this is the wrong skill — that is Graphics.
What it helps with
- draw a single texture at a given point on the stage
- build frame animation for a character from a spritesheet
- make a panel or button that resizes without warping its borders
- loop a scrolling background through
tilePosition - figure out why a sprite shifted after setting
pivot
Example prompts for the agent
- Show me how to create a Sprite with anchor 0.5 and tint in PixiJS v8
- Build an AnimatedSprite from sheet.animations['walk'] and start it
- Set up a NineSliceSprite for a panel with fixed borders
How to install pixijs-scene-sprite
1Skills CLI (Vercel)
npx skills add pixijs/pixijs-skills --skill pixijs-scene-sprite -a claude-code2Manually: put the files in place
~/.claude/skills/pixijs-scene-sprite/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/pixijs-scene-sprite/
1Skills CLI (Vercel)
npx skills add pixijs/pixijs-skills --skill pixijs-scene-sprite -a codex2Manually: put the files in place
.agents/skills/pixijs-scene-sprite/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add pixijs/pixijs-skills --skill pixijs-scene-sprite -a cursor2Manually: put the files in place
.cursor/skills/pixijs-scene-sprite/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install pixijs/pixijs-skills pixijs-scene-sprite2Manually: put the files in place
.github/skills/pixijs-scene-sprite/SKILL.md1Skills CLI (Vercel)
npx skills add pixijs/pixijs-skills --skill pixijs-scene-sprite -a gemini-cli2Platform CLI
gemini skills install https://github.com/pixijs/pixijs-skills --path skills/pixijs-scene-spriteManually: put the files in place
.devin/skills/pixijs-scene-sprite/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add pixijs/pixijs-skills --skill pixijs-scene-sprite -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about pixijs-scene-sprite
How do I install pixijs-scene-sprite in Claude?
Run npx skills add pixijs/pixijs-skills --skill pixijs-scene-sprite -a claude-code. The skill file then lands at ~/.claude/skills/pixijs-scene-sprite/SKILL.md.
What does pixijs-scene-sprite do?
It documents four sprite classes in PixiJS v8: Sprite, AnimatedSprite, NineSliceSprite and TilingSprite. Your agent gets ready examples plus a list of common mistakes.
Do I need it if I draw shapes instead of images?
No. Shapes and paths in PixiJS go through Graphics, while this skill is about textures and sprites.
Source text
SKILL.md · MIT
---
name: pixijs-scene-sprite
description: "Use this skill when drawing images in PixiJS v8. Covers Sprite with anchor/tint/texture, AnimatedSprite for frame animation, NineSliceSprite for resizable UI panels, TilingSprite for scrolling/repeating backgrounds. Triggers on: Sprite, AnimatedSprite, NineSliceSprite, TilingSprite, Sprite.from, anchor, tint, tilePosition, animationSpeed, gotoAndPlay, leftWidth, topHeight, constructor options, SpriteOptions, AnimatedSpriteOptions, NineSliceSpriteOptions, TilingSpriteOptions."
license: MIT
---
PixiJS has three sprite classes for different drawing tasks. `Sprite` is the default image-drawing leaf; `NineSliceSprite` is a resizable UI-panel variant that preserves corner art; `TilingSprite` repeats a texture across an area. The `AnimatedSprite` subclass of `Sprite` cycles through texture frames for frame-based animation.
Assumes familiarity with `pixijs-scene-core-concepts`. All sprite classes are leaf nodes; they cannot have children. Wrap multiple sprites in a `Container` to group them.
## Quick Start
```ts
const texture = await Assets.load("bunny.png");
const sprite = new Sprite({
texture,
anchor: 0.5,
tint: 0xff8888,
});
sprite.x = app.screen.width / 2;
sprite.y = app.screen.height / 2;
app.stage.addChild(sprite);
```
Position is set after construction because `app.screen.width / 2` depends on the live renderer size. Literal positions can go directly in the options object via `x`/`y` (inherited from `Container`).
**Related skills:** `pixijs-scene-core-concepts` (leaves, transforms), `pixijs-assets` (texture loading), `pixijs-scene-particle-container` (thousands of sprites), `pixijs-performance` (spritesheets, batching).
## Variants
| Variant | Use when | Trade-offs | Reference |
| ----------------- | --------------------------------------------------------- | ----------------------------------------------- | ---------------------------------------------------------------- |
| `Sprite` | Draw a single texture at a position | Fixed size = texture size | [references/sprite.md](references/sprite.md) |
| `AnimatedSprite` | Frame-based animation from a texture array or spritesheet | Pre-rendered frames only; no tweening | [references/animated-sprite.md](references/animated-sprite.md) |
| `NineSliceSprite` | Resizable UI panels, buttons, dialog frames | Border width is fixed; center stretches | [references/nineslice-sprite.md](references/nineslice-sprite.md) |
| `TilingSprite` | Scrolling backgrounds, parallax, repeating patterns | Single texture repeated; `tilePosition` scrolls | [references/tiling-sprite.md](references/tiling-sprite.md) |
`AnimatedSprite` is a subclass of `Sprite`; all `Sprite` properties (anchor, tint, position) apply.
Each variant's constructor options are documented in its sub-reference file (`references/{variant}.md`). All variants also accept the `Container` options (`position`, `scale`, `tint`, `label`, `filters`, `zIndex`, etc.) — see `skills/pixijs-scene-core-concepts/references/constructor-options.md`.
## When to use what
- **"I want to draw a single image at a position"** → `Sprite`. The default choice for 90% of 2D game and app content.
- **"I want to animate a character through a series of frames"** → `AnimatedSprite`. Load a spritesheet via Assets and pass `sheet.animations['walk']`. See `references/animated-sprite.md`.
- **"I want a UI button/panel that resizes without stretching the borders"** → `NineSliceSprite`. Set border widths, then set `width`/`height`. See `references/nineslice-sprite.md`.
- **"I want a scrolling repeating background"** → `TilingSprite`. Animate `tilePosition` to scroll. See `references/tiling-sprite.md`.
- **"I want thousands of identical sprites"** → Use `ParticleContainer` with `Particle` instances (see `pixijs-scene-particle-container`), not plain sprites.
- **"I want to draw shapes or paths"** → Use `Graphics` (see `pixijs-scene-graphics`), not a sprite.
## Quick concepts
### Anchor vs pivot
`Sprite.anchor` is normalized `[0, 1]` and shifts only the texture draw origin; no position offset. `Container.pivot` is pixel-space and shifts both the transform origin and the visual position. For centering a sprite, always use `anchor.set(0.5)`.
### Loading before creating
`Sprite.from(id)` only reads the Assets cache; it does not fetch. Always `await Assets.load(...)` first, or pass the returned `Texture` directly to `new Sprite(texture)`.
### Dynamic textures
Once a texture is loaded, modifying its `frame` or swapping its source does not automatically notify sprites. Set `texture.dynamic = true` once, or call `sprite['onViewUpdate']()` manually after changes.
## Common Mistakes
### [HIGH] Using `Texture.from(url)` to load
Wrong:
```ts
const texture = Texture.from("https://example.com/image.png");
```
Correct:
```ts
const texture = await Assets.load("https://example.com/image.png");
```
`Texture.from()` only reads the cache in v8. Use `Assets.load()` first; its return value is the texture.
### [HIGH] Confusing anchor and pivot
Wrong:
```ts
sprite.pivot.set(sprite.width / 2, sprite.height / 2);
```
Correct:
```ts
sprite.anchor.set(0.5);
```
`anchor` shifts only the draw origin. `pivot` shifts the transform origin AND the visual position, causing the sprite to move unexpectedly.
### [HIGH] Old `NineSlicePlane` name
`NineSlicePlane` was renamed to `NineSliceSprite` in v8 and switched to an options-object constructor: `new NineSliceSprite({ texture, leftWidth, topHeight, rightWidth, bottomHeight })`.
### [MEDIUM] Adding children to a sprite
`Sprite`, `NineSliceSprite`, and `TilingSprite` all set `allowChildren = false`. Wrap in a `Container` to group sprites with other content.
## API Reference
- [Sprite](https://pixijs.download/release/docs/scene.Sprite.html.md)
- [SpriteOptions](https://pixijs.download/release/docs/scene.SpriteOptions.html.md)
- [AnimatedSprite](https://pixijs.download/release/docs/scene.AnimatedSprite.html.md)
- [NineSliceSprite](https://pixijs.download/release/docs/scene.NineSliceSprite.html.md)
- [TilingSprite](https://pixijs.download/release/docs/scene.TilingSprite.html.md)
- [Texture](https://pixijs.download/release/docs/rendering.Texture.html.md)
© pixijs · MIT · pixijs/pixijs-skills