agentleFS
pixijspixijs/pixijs-skills/skills/pixijs/SKILL.md

pixijs

Skill372 starsChanged 7 months agoMITView on GitHub

PixiJS v8 (pixi.js) reference. Use it before writing, fixing or porting any PixiJS code, from a one-line fix to a whole app or game. Routes to topic files: Application (app.init, resizeTo, resolution), Container scene graph (addChild, zIndex, RenderLayer, mask, destroy), Sprite, Texture, AnimatedSprite, TilingSprite, NineSliceSprite, Graphics (fill, stroke, FillGradient, SVG, SmoothGraphics), Text, BitmapText, HTMLText, SplitText, Mesh, MeshRope, ParticleContainer, Assets (load, bundles, Spritesheet, fonts, video), Ticker and onRender, events (eventMode, pointertap, drag, hitArea), filters and shaders (BlurFilter, Filter.from, GlProgram), blendMode and erasing into a RenderTexture, generateTexture, cacheAsTexture, Color, Point, Matrix, DOMContainer, GifSprite, HTMLSource, accessibility, performance and teardown, WebGL/WebGPU/Canvas renderers, Web Workers, custom builds, project setup, migration from v7.

5 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions5 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 5

    1. pixijs/pixijs★ 49ksame name
    2. talesofai/cohub★ 585same name
    3. WordPress/desktop-mode★ 280same name
    4. delorenj/skills★ 17same name
    5. jammyfu/open-game-skills★ 13same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No row fits: scan references/index.md (sub-pages, long-tail keywords, error strings), then the project's local PixiJS docs.

    line 13
  2. Very specific:

    Read canvas pixels from a listener at UPDATE_PRIORITY.UTILITY, which runs after the render.

    line 28
  3. Very specific:

    After drawing into a source canvas, call texture.source.update().

    line 37
  4. Very specific:

    Call play() after each anim.textures = ...

    line 42
  5. Very specific:

    All particles share one texture source (frames of one atlas).

    line 62
  6. Very specific:

    Stop page scroll with a native app.canvas.addEventListener('wheel', (e) => e.preventDefault(), { passive: false }).

    line 85
  7. Very specific:

    Add a mask as a child of the masked Container.

    line 90
  8. Very specific:

    Call app.destroy() after init resolves (in React effects, chain it on the init promise).

    line 98

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Read before you write

  1. List the files. Write down every router row below that your task touches: each class you construct, options object you pass, effect you build and symptom you fix. A whole app usually lists four to eight (an eraser paint app: application, assets, scene-sprite, events, blend-modes; a game: application, assets, scene-sprite, events, ticker, scene-text).
  2. Read each listed file before you write the code for that part, even for a one-line change. Open the file itself; a Grep hit is a fragment that drops the rule and the exception beside it. Each topic file links to its sub-pages for rarer branches.
  3. Done when every file on your list has been opened. Then check your code against the pitfall group below for each feature you built.

No row fits: scan references/index.md (sub-pages, long-tail keywords, error strings), then the project's local PixiJS docs.

For a signature or option this skill doesn't cover, fetch the class's API page: https://pixijs.download/release/docs/<module>.<Class>.html.md (app.Application, scene.Graphics, rendering.Texture, assets.Assets). To find a class's module, look it up in https://pixijs.download/release/docs/llms.txt.

Pitfalls that fail silently

Each line is the fix; its link owns the rule and the code. These run without errors and draw the wrong thing, and a Vite build doesn't type-check, so run npx tsc --noEmit to catch wrong option names.

App setup and the frame loop

  • const app = new Application(); await app.init({ ... }). Constructor options are ignored; until init resolves app.renderer is undefined and app.canvas/app.screen throw. application
  • Top-level await fails vite build on Vite 6 and older; wrap init in an async IIFE. create
  • With resizeTo, lay out in app.renderer.on('resize', (w, h) => ...); your own window resize listener reads the old app.screen. An element target also needs new ResizeObserver(() => app.queueResize()). application
  • Ticker callbacks receive the Ticker: app.ticker.add((t) => (s.x += 2 * t.deltaTime)). deltaTime is ~1 per 60 fps frame, deltaMS is milliseconds. ticker
  • app.ticker.update() already renders, even with autoStart: false; skip the extra app.render(). ticker
  • Per-object frame logic: obj.onRender = () => { ... } (replaces v7 updateTransform overrides); it also runs while the object is invisible. Name subclass methods anything but _onRender. ticker
  • Read canvas pixels from a listener at UPDATE_PRIORITY.UTILITY, which runs after the render. ticker

Loading assets and textures

  • await Assets.init({ basePath, manifest }) before the first load, loadBundle or backgroundLoad; a later init is dropped. assets
  • Assets.load([a, b]) resolves an object keyed by URL or alias: read res[a]. assets
  • A URL with no file extension (?id=, blob:, API route) needs Assets.load({ src, parser: 'texture' }); without it the result is null with only a warning. Audio files have no loader and also resolve null; play sound with @pixi/sound or HTMLAudioElement. assets
  • Texture.from(url) and Sprite.from(url) read the cache only (v7 fetched): await Assets.load(url) first. scene-sprite
  • Wrap a TextureSource (CanvasSource, texture.source): Sprite.from(source) or new Sprite(Texture.from(source)); new Sprite(source) draws nothing. scene-sprite
  • Show another region with sprite.texture = new Texture({ source, frame: new Rectangle(...) }), or create the texture with dynamic: true and call texture.update(). scene-sprite
  • After drawing into a source canvas, call texture.source.update(). sprite
  • Per-asset data (scaleMode, resolution) applies on the first load of a src only; set texture.source.scaleMode on the result instead. assets

Sprites and animation

  • AnimatedSprite: animationSpeed is frames per 60 fps tick (12 fps is 0.2), and it needs autoPlay: true or play(). It runs on Ticker.shared, so app.ticker.stop() doesn't pause it. animated-sprite
  • Call play() after each anim.textures = ... swap; replay a finished one-shot with gotoAndPlay(0). animated-sprite
  • Rotate or scale about a point with origin; pivot also moves the object, and anchor (0-1) shifts only the texture. scene-sprite

Graphics

  • Shape first, then style: new Graphics().rect(0, 0, 100, 50).fill(0xff0000).stroke({ width: 2, color: 0x000000 }). beginFill, drawRect and lineStyle are v7. scene-graphics
  • FillGradient: options object, every colour stop set before the first draw, textureSpace: 'global' for pixel coordinates (the default 'local' is 0-1 across the shape). scene-graphics
  • Draw-time transforms apply in call order, the reverse of Canvas 2D: rotateTransform(a).translateTransform(x, y). scene-graphics
  • Stroke alignment is 1 inside, 0 outside (inverted from v7). scene-graphics
  • Animate a stable Graphics by its transform; clear() and redraw every frame re-tessellates. scene-graphics

Drawing into textures (paint, eraser, scratch-off, fog of war, baking)

  • The render root's own blendMode is ignored: put an 'erase' brush inside a plain Container and pass the wrapper to renderer.render({ container: wrapper, target, clear: false }). clear: false keeps earlier strokes. blend-modes
  • 'erase' clears everything under it in the same target, background included; give the erasable layer its own RenderTexture and erase into that. blend-modes
  • Brush coordinates are texture pixels: sprite.toLocal(e.global) plus the anchor offset. blend-modes
  • generateTexture({ target, frame: new Rectangle(...) }): frame is a real Rectangle (a plain object throws copyTo is not a function), and the capture ignores the target's own position, scale and rotation. renderers
  • A cacheAsTexture(true) container shows changes to its children only after updateCacheTexture(). performance

Particles

  • Fill a ParticleContainer with addParticle(...particles); the particles option draws nothing until update(). Type it new ParticleContainer<Particle>(...) to reach tint and alpha. scene-particle-container
  • Mark every property you change per frame in dynamicProperties: position, rotation, vertex (scale, anchor), color (tint, alpha), uvs (texture). A static one changes only after update(), and v7's tint/scale keys are ignored. scene-particle-container
  • All particles share one texture source (frames of one atlas). Give the container boundsArea (its bounds are empty, so culling and filters skip it) and hitArea plus eventMode for pointer events. scene-particle-container

Filters and blend modes

  • Assign a new array to change filters: c.filters = [...(c.filters ?? []), blur]. filters
  • Custom GLSL: Filter.from({ gl: { vertex: defaultFilterVert, fragment }, resources }). In the fragment sample uTexture, get 0-1 coordinates from vTextureCoord * uInputSize.xy / uOutputFrame.zw (both highp), and keep colour premultiplied (invert with vec4(c.a - c.rgb, c.a)). filters
  • On the WebGPU renderer (preference: 'webgpu') every filter needs a gpu program too, or all filters on that container are skipped. The Canvas renderer skips filters. filters
  • Effects that reach past the shape (glow, wave, outline) need padding; a full-screen stage filter needs app.stage.filterArea = app.screen; use resolution: 'inherit' on a high-DPI renderer. filters
  • DisplacementFilter takes a Sprite that is on the stage; animate the distortion by moving that sprite (map texture addressMode = 'repeat'). A TilingSprite's tilePosition is never read. filters
  • A filtered container composites with its last filter's blendMode: new BlurFilter({ strength: 8, blendMode: 'add' }). blend-modes
  • Modes beyond normal/add/multiply/screen/erase/min/max need import 'pixi.js/advanced-blend-modes' and, on WebGL, app.init({ useBackBuffer: true }). blend-modes

Text

  • new Text({ text, style: { fill: 0xffffff } }): the default fill is black, invisible on the default black background. scene-text
  • Strings that change every frame (score, timer, FPS) go in BitmapText; each Text change redraws a canvas and re-uploads it. scene-text
  • Load web fonts with await Assets.load({ src, data: { family } }) before creating text; HTMLText sees only fonts loaded this way. html-text
  • Raise style.padding when a stroke or drop shadow is clipped. text

Input

  • Give every listening object eventMode = 'static' (the default 'passive' never fires its own listeners) and cursor = 'pointer' (v7 buttonMode). events
  • Clicks on empty canvas: app.stage.eventMode = 'static' and app.stage.hitArea = app.screen. A plain Container is hit only on its children; give it a hitArea to cover the gaps. events
  • visible = false and renderable = false remove an object from hit testing; an invisible target uses alpha = 0 or a hitArea. scene-container
  • Buttons listen to pointertap (click is mouse only, tap touch only); a double click is e.detail === 2. events
  • Drag with globalpointermove (plain pointermove fires only over the object), end on pointerup and pointerupoutside, convert with parent.toLocal(e.global), and keep points with p.copyFrom(e.global) (event objects are reused). events
  • Stop page scroll with a native app.canvas.addEventListener('wheel', (e) => e.preventDefault(), { passive: false }). events

Scene order, coordinates and masks

  • zIndex orders siblings only and sorts at the next render; call parent.sortChildren() before reading children. scene-container
  • Depth-sort across parents with new RenderLayer({ sortableChildren: true }) and layer.attach(obj); attach again after reparenting, and hide or move the objects themselves (the layer's own visible, alpha and position do nothing). layers
  • Add a mask as a child of the masked Container; a Sprite mask reads the red channel unless setMask({ mask, channel: 'alpha' }). masking
  • Map pointers into rotated or scaled containers with container.toLocal(e.global); getBounds() returns Bounds, so hit-test with getBounds().rectangle.contains(x, y). scene-container
  • Matrix methods apply in call order and a.append(b) applies b first; Container-style is scale().rotate().translate(), applied with setFromMatrix. math
  • Copy points with copyFrom(p) or set(x, y); pixi.js/math-extras methods return a new point, so update in place with pos.add(v, pos). math
  • Color reads a plain number[] as 0-1 ([180, 60, 90] is white); pass 0-255 as a Uint8Array, and alpha as '#rrggbbaa' (0xRRGGBBAA throws). color

Teardown

  • Destroy a subtree with destroy({ children: true }) and free loaded files with Assets.unload(key). destroy(true) also destroys shared textures, atlases and GraphicsContexts, and every later render of another user throws. scene-container
  • Call app.destroy() after init resolves (in React effects, chain it on the init promise); pass releaseGlobalResources: true when re-creating an app in the same tab. application
  • Destroy textures you create (generateTexture, canvases) with texture.destroy(true); defer a destroy from inside onRender with app.ticker.addOnce(() => obj.destroy()). performance, scene-container

Renderers and builds

  • Application picks WebGL unless preference: 'webgpu'. The Canvas renderer skips filters and draws nothing for Mesh. renderers
  • pixi.js/math-extras, pixi.js/prepare, pixi.js/gif and pixi.js/advanced-blend-modes work only after a side-effect import; with skipExtensionImports: true, also import pixi.js/events, pixi.js/filters, pixi.js/accessibility and pixi.js/dom. environments

Reference router

Foundations

ReferenceRead when your code touches...
applicationApplication, app.init() options and defaults, app.stage/renderer/canvas/screen, resizeTo, queueResize, layout on resize, resolution/autoDensity/HiDPI (also after init), autoStart, sharedTicker, app.start()/stop(), CullerPlugin, Application plugins, app.destroy() and React StrictMode cleanup.
core-conceptsChoosing WebGL/WebGPU/Canvas, autoDetectRenderer, checking the backend, renderer.render() options (clear, transform, target), RenderTexture/RenderTarget, generateTexture, systems and pipes, renderer loaders, Three.js interop (resetState), context and device loss.
tickerPer-frame logic: app.ticker.add, deltaTime vs deltaMS, UPDATE_PRIORITY and frame order, maxFPS/minFPS, speed, onRender (v7 updateTransform), Ticker.shared, a manual loop with ticker.update(), pausing.
environmentsWeb Workers and OffscreenCanvas, Node/SSR/headless, strict CSP (pixi.js/unsafe-eval), DOMAdapter and custom fetch (auth headers), custom or tree-shaken builds (skipExtensionImports, side-effect imports), bundle size.
createScaffolding with npm create pixi.js and its templates, adding pixi.js to an existing project, tsconfig for TypeScript 5-7, Vite top-level-await build errors, @webgpu/types conflicts.
migration-v8Porting a whole v7 codebase: @pixi/* imports, BaseTexture, DisplayObject, settings and utils, renderer.plugins, renamed options and enums (SCALE_MODES, BLEND_MODES). For one API, its topic file is enough.

Scene

ReferenceRead when your code touches...
scene-core-conceptsThe scene graph as a whole: containers vs leaves, render order, which class to use; sub-pages for coordinate spaces and worldTransform, render groups (isRenderGroup, panning a world), constructor options, RenderLayer (depth sort across parents), and masks (mask, setMask, inverse, sprite-mask channel).
scene-containerContainer: addChild/removeChildren/reparentChild, pivot vs origin, hiding (visible/renderable/alpha), zIndex and sortChildren(), getBounds, toGlobal/toLocal, setSize, container events, onRender, destroy options.
scene-spriteSprite, Texture vs TextureSource, Sprite.from/Texture.from, sub-textures and frame, dynamic and canvas textures, shared-texture destroy; AnimatedSprite (speed, swapping or replaying animations, onComplete), NineSliceSprite (panels, borders), TilingSprite (tilePosition, scrolling backgrounds).
scene-graphicsGraphics beyond a colour-filled shape: paths, holes (cut), strokes, FillGradient, FillPattern, texture fills, draw-time transforms, GraphicsContext sharing, SVG import and export (svg(), graphicsContextToSvg), hit testing, smooth edges without MSAA (SmoothGraphics), dashed lines (DashLineShader), v7 beginFill/lineStyle ports.
scene-textText, TextStyle, BitmapText (BitmapFont.install, .fnt, MSDF), HTMLText (fonts, tag styles), SplitText/SplitBitmapText, per-frame text cost, shaped scripts.
scene-meshMesh, MeshGeometry (positions, uvs, indices, topology), MeshSimple, MeshPlane, MeshRope (trails), PerspectiveMesh, UVs and addressMode, mesh hit testing.
scene-particle-containerParticleContainer, Particle, dynamicProperties, update(), emitters and particle pools, fading or tinting particles, pointer events on particles.
scene-dom-containerHTML elements over the canvas: DOMContainer, inputs and iframes, click-through pointer-events, domContainerRoot, removing the element.
scene-gifAnimated GIFs: pixi.js/gif, GifSprite, GifSource, GIF frame rate, cleanup.
html-sourceLive HTML/DOM rendered into a texture (experimental HTML-in-Canvas): HTMLSource, ElementImageSource, pixi.js/html-source, requestPaint.

Utilities

ReferenceRead when your code touches...
assetsAssets.init/load/add/get/unload, load result shapes, extension-less or blob: URLs (parser), retries and errors, bundles, manifests, background loading, progress bars, spritesheets, fonts, video, SVG, compressed textures, @2x resolution.
eventsPointer, mouse, touch, wheel: eventMode, pointertap vs click/tap, double click, propagation and capture, hitArea, interactiveChildren, clicks on empty canvas, drag (globalpointermove), cursor, FederatedPointerEvent, eventFeatures.
mathPoint/ObservablePoint (set, copyFrom), Matrix (order, append/prepend, decompose, setFromMatrix), Rectangle and hit-area shapes, pixi.js/math-extras vector methods, DEG_TO_RAD.
colorColor and ColorSource: input ranges (hex with alpha, arrays, Uint8Array), conversions (toHex, toRgba, toNumber), tint and alpha, premultiply, v7 utils.string2hex.
accessibilityScreen readers and keyboard navigation: accessible, accessibleTitle, tabIndex, accessibilityOptions, no overlay element appearing.

Effects and rendering

ReferenceRead when your code touches...
blend-modesAny blendMode (add, multiply, screen, erase), an eraser, scratch-off or fog of war, painting into a RenderTexture, blend mode of the render root or of a filtered container, overlay and other advanced modes.
filtersBlurFilter, ColorMatrixFilter, DisplacementFilter, NoiseFilter, AlphaFilter, custom Filter.from (GLSL, WGSL), filter uniforms, padding, filterArea, resolution, blendRequired, pixi-filters, multi-pass filters (bloom).
custom-renderingCustom shaders on a Mesh: Shader.from, GlProgram/GpuProgram, UniformGroup and uniform types, textures as resources, built-in shader inputs (aPosition, uProjectionMatrix); custom batchers, pipes, render bundles, 3D/array/storage textures.
performanceFPS, draw calls, memory leaks, first-frame hitches: teardown (destroy, Assets.unload), GCSystem, PrepareSystem, render groups, cacheAsTexture, batching order, culling (cullable), pooling, filter and mask cost.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.