Back to Skills

pixijs-scene-graphics

Use this skill when drawing vector shapes and paths in PixiJS v8. Covers the Graphics API: shape-then-fill methods (rect/circle/ellipse/poly/roundRect/star/regularPoly/roundPoly/roundShape/filletRect/chamferRect), path methods (moveTo/lineTo/bezierCurveTo/quadraticCurveTo/arc/arcTo/arcToSvg/closePath), fill/stroke/cut, holes, FillGradient (linear/radial), FillPattern, GraphicsContext sharing, svg import/export, containsPoint hit testing, cloning, clearing, bounds, fillStyle/strokeStyle, draw-tim

249stars14forksUpdated 6/25/2026

Security Assessment

Safe(100/100)
Security Score100/100

About pixijs-scene-graphics

A reference for drawing vector shapes and paths in PixiJS v8 through the Graphics API, the vector-drawing leaf of the v8 scene graph. The v8 API follows a shape-then-style pattern: draw a shape or path with methods like rect, circle, or moveTo, then apply fill and/or stroke. Every method returns 'this' for chaining, and the underlying drawing instructions live on a GraphicsContext that can be shared between instances to reuse tessellated geometry and avoid duplicate GPU work. Because Graphics is a leaf, it should not contain children - multiple Graphics objects are grouped inside a Container.

Use it when rendering vector graphics: basic shapes (rect, circle, ellipse, poly, roundRect, star) and advanced primitives (regularPoly, roundPoly, chamferRect, filletRect, roundShape), as well as path construction with moveTo, lineTo, bezierCurveTo, quadraticCurveTo, and arc-family methods. Fills accept a FillInput - a color, an options object, a FillGradient (linear or radial), a FillPattern, or a Texture - with textureSpace controlling whether a texture maps to each shape's bounding box ('local') or the Graphics object's coordinate system ('global'). Strokes accept a StrokeStyle combining fill keys with attributes such as width, cap, join, miterLimit, alignment, and pixelLine, and can themselves use gradients or patterns.

The skill covers holes via cut(), which subtracts the current active path from the previously drawn fill or stroke; the hole must sit completely inside the target shape, cut() looks back at up to the last two instructions, and multiple shapes can be accumulated into a single cut() call. Constructor options include a shared context and roundPixels, and all Container options (position, scale, tint, filters, zIndex, and more) remain valid. Additional topics named include svg import/export via graphicsContextToSvg, containsPoint hit testing, cloning, clearing, bounds, draw-time transforms (rotateTransform, scaleTransform, translateTransform, setTransform, save/restore), default fill and stroke styles, and GraphicsPath reuse. It assumes familiarity with pixijs-scene-core-concepts and cross-references related skills for masking, filters, and performance.

FAQ

What is the basic drawing workflow in PixiJS v8 Graphics?

A shape-then-style pattern: draw a shape or path with a method like rect or circle, then call fill() and/or stroke(). Every method returns 'this' so calls can be chained.

Can a Graphics object contain child objects?

No. Graphics is a leaf of the scene graph, so you should not nest children inside it. Wrap multiple Graphics objects in a Container to group them.

How do I cut a hole in a shape?

Draw the fill or stroke, then draw the hole shape and call cut(), which subtracts the active path. The hole must be completely inside the target shape, and cut() considers up to the last two instructions.

What does sharing a GraphicsContext accomplish?

Passing a shared GraphicsContext via the constructor reuses its tessellated geometry across multiple Graphics nodes, avoiding duplicate GPU work. If omitted, each Graphics creates and owns its own context.

What types of fills does fill() accept?

A FillInput: a color number or string, an options object with color/alpha/texture/matrix/textureSpace, a FillGradient (linear or radial), a FillPattern, or a Texture. Strokes can use the same gradients and patterns.

Install pixijs-scene-graphics

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill