К основному содержанию
скилл CX Codex

pixijs-scene-sprite — скилл для Claude Code: спрайты в PixiJS v8

Скилл объясняет агенту, как рисовать изображения в PixiJS v8: Sprite, AnimatedSprite, NineSliceSprite и TilingSprite. Пригодится, когда в проекте уже есть PixiJS и нужно быстро получить рабочий код отрисовки.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add pixijs/pixijs-skills --skill pixijs-scene-sprite -a claude-code
Открыть на GitHub

Что делает pixijs-scene-sprite

Скилл закрывает четыре класса спрайтов. Sprite рисует одну текстуру в точке, AnimatedSprite перебирает кадры из массива или спрайтшита, NineSliceSprite тянет центр панели и оставляет углы целыми, TilingSprite повторяет текстуру по площади и прокручивается через tilePosition. Все они — листовые узлы, детей иметь не могут, поэтому группировать их нужно через Container.

Внутри есть разбор частых ошибок. Например, Texture.from(url) в v8 только читает кэш, а не загружает файл, поэтому сначала нужен await Assets.load(...). Ещё скилл разводит anchor и pivot: anchor в диапазоне [0, 1] двигает только точку отрисовки, а pivot в пикселях смещает и трансформ, и визуальную позицию, из-за чего спрайт уезжает. Для центрирования советует anchor.set(0.5).

Скилл предполагает, что вы уже знакомы с pixijs-scene-core-concepts. Он ссылается на соседние скиллы того же репозитория: загрузку текстур, ParticleContainer для тысяч спрайтов, производительность. Если рисуете фигуры, а не картинки, это не тот скилл — там нужен Graphics.

Какие задачи решает

  • нарисовать одну текстуру в нужной точке сцены
  • собрать кадровую анимацию персонажа из спрайтшита
  • сделать панель или кнопку, которая тянется без деформации углов
  • зациклить прокручивающийся фон через tilePosition
  • разобраться, почему спрайт сместился после pivot

Примеры запросов агенту

  • Покажи, как создать Sprite с anchor 0.5 и tint в PixiJS v8
  • Сделай AnimatedSprite из sheet.animations['walk'] и запусти анимацию
  • Собери NineSliceSprite для панели с фиксированными границами

Как установить pixijs-scene-sprite

1Через Skills CLI (Vercel)

npx skills add pixijs/pixijs-skills --skill pixijs-scene-sprite -a claude-code

2Вручную: положить файлы

~/.claude/skills/pixijs-scene-sprite/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/pixijs-scene-sprite/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора25

pixijs-core-concepts Объясняет, как PixiJS v8 рисует кадры: выбор бэкенда, цикл рендера, работа с RenderTexture и потеря контекста. CX Codex +1 6 000установок pixijs-performance Скилл для профилирования и ускорения PixiJS v8: FPS, draw calls, память GPU. Пригодится, когда приложение тормозит или течёт память. CX Codex +1 6 000установок pixijs-application Помогает настроить приложение PixiJS v8 через асинхронный app.init(). Пригодится при сборке холста, подключении WebGPU или WebGL и настройке ресайза. CX Codex +1 6 000установок pixijs-scene-container Скилл по работе с узлом Container в PixiJS v8: группировка объектов сцены, трансформация, сортировка по zIndex и управление дочерними элементами. CX Codex +1 5 900установок pixijs-events Скилл для работы с указателем, мышью, тачем и колесом в PixiJS v8: режимы eventMode, типы FederatedEvent, всплытие и перехват, hitArea, курсоры, drag через globalpointermove. CX Codex +1 5 900установок pixijs-assets Скилл учит агента загружать ассеты в PixiJS v8 через синглтон Assets. Помогает настроить бандлы, шрифты, спрайтшиты и парсеры для ссылок без расширений. CX Codex +1 5 900установок pixijs-scene-particle-container Инструктирует агента по работе с ParticleContainer в PixiJS v8. Помогает рендерить десятки тысяч легковесных спрайтов за один draw call. CX Codex +1 5 800установок pixijs-filters Помогает настраивать визуальные эффекты PixiJS v8 через систему фильтров. Пригодится для размытия, цветокоррекции и пользовательских шейдеров. CX Codex +1 5 800установок

Похожие

pixijs-2d freshtechbro Скилл обучает агента создавать 2D-графику на PixiJS с WebGL и WebGPU: анимировать спрайты, выводить частицы и рисовать векторные фигуры на холсте. CX Codex +1 2 500установок sprite-segment-3x3grid Unity-Technologies Делит текстуру спрайта на сетку три на три и строит текстовую карту совпадения оттенков вокруг центра. Помогает проверять геометрию ассетов в автотестах. CX Codex +1 3 300установок pixijs-rendering gamedev-skills Скилл для сборки слоя рендера на PixiJS v8: асинхронный Application, загрузка текстур, сцена на Container, тикер и события указателя. CX Codex +1 5 400установок phaser OpusGameLabs Скилл задаёт агенту структуру проекта для 2D-игр на Phaser 3: сцены, общий стейт, шина событий. Пригодится, когда начинаете новую игру или добавляете в неё механики. CX Codex +1 1 400установок pixel-art-sprites omer-metin Настраивает ассистента на отрисовку спрайтов и тайлсетов. Пригодится при разработке ретро-игр с жёсткими лимитами палитры и кадров. CX Codex +1 2 700установок pixel-art omer-metin Скилл даёт агенту знания по пиксель-арту: палитры, дизеринг, субпиксельная анимация, тайлы и ограничения ретро-железа. Пригодится, если делаете спрайты и тайлсеты. CX Codex +1 520установок

Рядом в теме «Геймдев и 3D: Unity, Unreal, Godot, Blender»

Всё по теме «Геймдев и 3D: Unity, Unreal, Godot, Blender» →

Вопросы о pixijs-scene-sprite

Как установить pixijs-scene-sprite в Claude?

Выполните npx skills add pixijs/pixijs-skills --skill pixijs-scene-sprite -a claude-code. После этого файл скилла появится по пути ~/.claude/skills/pixijs-scene-sprite/SKILL.md.

Что делает pixijs-scene-sprite?

Описывает работу с четырьмя классами спрайтов в PixiJS v8: Sprite, AnimatedSprite, NineSliceSprite, TilingSprite. Агент получает готовые примеры и список типичных ошибок.

Нужен ли скилл, если я рисую фигуры, а не картинки?

Нет. Для фигур и путей в PixiJS есть Graphics, а этот скилл про текстуры и спрайты.

Исходный текст

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

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой