starwards-pixijs
БесплатноБез исполняемых скриптовНе проверенPixiJS v8 patterns for Starwards - Containers, Sprites, Graphics, Textures, ticker integration, event handling, and testing with Playwright data-id selectors
от starwards★ 44 звезды на GitHubОб этом скилле
PixiJS v8 Development for Starwards
Overview
Starwards uses PixiJS v8 (^8.14.0) for 2D rendering in the browser module. This skill covers both the PixiJS v8 API reference and Starwards-specific patterns.
Core principle: Layered container composition with ticker-driven updates synced to Colyseus state changes.
Table of Contents
PixiJS v8 Reference
Application
The Application class provides an extensible entry point for PixiJS projects.
Async Initialization (v8 Required)
import { Application } from 'pixi.js';
const app = new Application();
await app.init({
width: 800,
height: 600,
backgroundColor: 0x1099bb,
});
document.body.appendChild(app.canvas);
Key Options
| Option | Type | Default | Description |
|---|---|---|---|
width |
number |
800 |
Initial width |
height |
number |
600 |
Initial height |
backgroundColor |
ColorSource |
'black' |
Background color |
antialias |
boolean |
- | Enable anti-aliasing |
resolution |
number |
1 |
Pixel resolution |
resizeTo |
Window | HTMLElement |
- | Auto-resize target |
preference |
'webgl' | 'webgpu' |
'webgl' |
Renderer type |
Containers & Scene Graph
Creating Containers
import { Container } from 'pixi.js';
const container = new Container({
x: 100,
y: 100,
});
app.stage.addChild(container);
Parent-Child Relationships
- Children inherit transforms, alpha, visibility from parents
- Render order: children render in insertion order (later = on top)
- Use
setChildIndex()orzIndexwithsortableChildrenfor reordering
Coordinate Systems
// Local to global
const globalPos = obj.toGlobal(new Point(0, 0));
// Global to local
const localPos = container.toLocal(new Point(100, 100));
Culling
container.cullable = true; // Enable culling
container.cullableChildren = true; // Cull children recursively
container.cullArea = new Rectangle(0, 0, 400, 400); // Custom cull bounds
Sprites
Basic Usage
import { Sprite, Assets } from 'pixi.js';
const texture = await Assets.load('bunny.png');
const sprite = new Sprite(texture);
sprite.anchor.set(0.5); // Center anchor
sprite.x = 100;
sprite.y = 100;
sprite.tint = 0xff0000; // Red tint
sprite.alpha = 0.8;
Sprite Properties
| Property | Description |
|---|---|
texture |
The texture to display |
anchor |
Origin point (0-1 range) |
tint |
Color tint |
blendMode |
Blend mode for compositing |
width, height |
Size (scales texture) |
Graphics (v8 API)
CRITICAL: v8 uses a new fluent API. Build shapes first, then fill/stroke.
v8 Fluent API
import { Graphics } from 'pixi.js';
// Draw shape, then fill/stroke
const graphics = new Graphics()
.rect(50, 50, 100, 100)
.fill(0xff0000)
.stroke({ width: 2, color: 'white' });
// Circle with fill and stroke
const circle = new Graphics()
.circle(100, 100, 50)
.fill({ color: 0x00ff00, alpha: 0.5 })
.stroke({ width: 3, color: 0x000000 });
Shape Methods
| v7 (OLD) | v8 (NEW) |
|---|---|
drawRect() |
rect() |
drawCircle() |
circle() |
drawEllipse() |
ellipse() |
drawRoundedRect() |
roundRect() |
drawPolygon() |
poly() |
drawStar() |
star() |
Lines
const lines = new Graphics()
.moveTo(0, 0)
.lineTo(100, 100)
.lineTo(200, 0)
.stroke({ width: 2, color: 0xff0000 });
Holes (v8)
const rectWithHole = new Graphics()
.rect(0, 0, 100, 100)
.fill(0x00ff00)
.circle(50, 50, 20)
.cut(); // Creates hole
GraphicsContext (Sharing)
import { GraphicsContext, Graphics } from 'pixi.js';
const context = new GraphicsContext()
.rect(0, 0, 100, 100)
.fill(0xff0000);
const g1 = new Graphics(context);
const g2 = new Graphics(context); // Shares same data
Text
Basic Text
import { Text, TextStyle } from 'pixi.js';
const text = new Text({
text: 'Hello World',
style: {
fontFamily: 'Arial',
fontSize: 24,
fill: 0xffffff
Установить starwards-pixijs в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл starwards-pixijs?
PixiJS v8 patterns for Starwards - Containers, Sprites, Graphics, Textures, ticker integration, event handling, and testing with Playwright data-id selectors
Как установить скилл starwards-pixijs?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл starwards-pixijs запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic