Thin lines that shimmer, circles with jagged edges, dashed strokes you have to fake with dozens of tiny segments: these are classic headaches in 2D canvas games and data visualisations. PixiJS 8.23.0, released on 11 November 2026, tackles them with a new SmoothGraphics class, a shader for dashed lines, a Safari font option for HTMLText, and support for Chrome’s new HTML-in-Canvas API. This tutorial shows each feature with working code and lists the behaviour changes to check before you upgrade.
Install PixiJS 8.23
npm install [email protected]
Or load it from a CDN while experimenting:
<script type="module">
import * as PIXI from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/pixi.min.mjs';
</script>
Everything below comes from the official v8.23.0 release notes and the linked pull requests. The v8.23.0 API docs have the full reference.
A minimal app to start from
import { Application } from 'pixi.js';
const app = new Application();
await app.init({ background: '#1e1e2e', resizeTo: window });
document.body.appendChild(app.canvas);
SmoothGraphics: anti-aliased shapes without MSAA
Normally, smooth edges in WebGL or WebGPU depend on multisample anti-aliasing (MSAA), which costs memory and isn’t always available, especially inside render textures. SmoothGraphics, added in PR #12002, anti-aliases edges in the shader instead. The release notes say shapes and thin lines stay smooth without MSAA, at any scale and inside render textures.
The best part: it has the same drawing API as Graphics, so switching is mostly a find-and-replace.
import { SmoothGraphics } from 'pixi.js';
const badge = new SmoothGraphics()
.circle(120, 120, 60)
.fill(0xde3249)
.stroke({ width: 1, color: 0xffffff });
const chartLine = new SmoothGraphics()
.moveTo(40, 300)
.lineTo(140, 250)
.lineTo(240, 280)
.lineTo(340, 200)
.stroke({ width: 1.5, color: 0x89b4fa });
app.stage.addChild(badge, chartLine);
Good candidates for SmoothGraphics:
- line charts and sparklines with 1–2 px strokes,
- UI elements that zoom or scale (maps, diagrams, node editors),
- shapes drawn into a
RenderTexturefor caching.
Dashed lines with DashLineShader
Dashed strokes used to mean splitting a line into many segments yourself. Now you set a DashLineShader as the graphics context’s customShader:
import { DashLineShader, SmoothGraphics } from 'pixi.js';
const guide = new SmoothGraphics();
guide.context.customShader = new DashLineShader({ dash: 10, gap: 5 });
guide.moveTo(0, 0).lineTo(400, 0).stroke({ width: 2, color: 0xffffff });
guide.position.set(40, 400);
app.stage.addChild(guide);
According to the release notes, the shader draws the strokes dashed and hides the fills, and you can change dash and gap without rebuilding the geometry. That makes animated “marching ants” selections or adjustable grid lines cheap.
Watch out for shared contexts
One caveat is documented in the release: a GraphicsContext drawn by both a Graphics and a SmoothGraphics can render blank in one of them without an error. If you share contexts between the two, give one of them a clone:
import { Graphics, GraphicsContext, SmoothGraphics } from 'pixi.js';
const shape = new GraphicsContext().rect(0, 0, 100, 60).fill(0x94e2d5);
const classic = new Graphics(shape);
const smooth = new SmoothGraphics(shape.clone()); // avoid the blank-render issue
HTMLText in Safari: the safariFontDelay option
HTMLText renders HTML/CSS-styled text. In Safari, embedded fonts may not be ready when drawing starts, so PixiJS has always waited a fixed 100 ms. Version 8.23 makes that delay configurable with safariFontDelay (PR #12324). It still defaults to 100. If your fonts are already loaded, set it to 0:
import { Application } from 'pixi.js';
const app = new Application();
// Make sure fonts are loaded first, then skip the Safari wait
await document.fonts.ready;
await app.init({ safariFontDelay: 0 });
// Or change it later at runtime
app.renderer.htmlText.safariFontDelay = 0;
Only drop it to zero when you’re sure the fonts are loaded; otherwise Safari may draw with a fallback font.
Chrome’s HTML-in-Canvas API
PixiJS can draw real DOM elements as textures through HTMLSource. In 8.23 it uses Chrome 155+’s new HTML-in-Canvas API (texElementSubImage2D on WebGL and drawElementImageToTexture on WebGPU) and falls back to the older calls, so it keeps working once Chrome removes them (PR #12341).
Two practical improvements come with it:
- In Chrome 155+ the element can sit anywhere inside the canvas instead of only as a direct child (except WebGPU in Chrome 156, which still needs a direct child).
HTMLSourceCanvasnow typesupdateElementGeometryandclearElementGeometry. These tell the browser where the element was drawn, so it can hit-test it and report it to assistive technology.
import { Sprite } from 'pixi.js';
import { HTMLSource } from 'pixi.js/html-source';
const form = document.createElement('form');
form.innerHTML = '<label>Name <input name="name"></label>';
app.canvas.appendChild(form);
const sprite = Sprite.from(new HTMLSource({ resource: form }));
app.stage.addChild(sprite);
app.ticker.add(() => {
const { a, b, c, d, tx, ty } = sprite.getGlobalTransform();
app.canvas.updateElementGeometry?.(form, {
canvasTransform: new DOMMatrix([a, b, c, d, tx, ty]),
});
});
The optional chaining (?.) keeps this safe in browsers that don’t have the API yet. In TypeScript, cast with app.canvas as HTMLSourceCanvas (imported as a type from pixi.js/html-source).
Behaviour changes to check before upgrading
The release flags two changes:
- Global move events fire once. An interactive ancestor of the object under the pointer (such as an interactive
app.stage) now receivesglobalpointermove,globalmousemoveandglobaltouchmoveonce per move instead of twice (PR #12329). If your code counted these events or added up movement per call, you’ll now see half as many calls. Code that reads the current pointer position is unaffected.
// Safe: uses the current position, not the number of events
app.stage.eventMode = 'static';
app.stage.hitArea = app.screen;
app.stage.on('globalpointermove', (e) => {
cursor.position.copyFrom(e.global);
});
- One agent skill. PixiJS now ships a single
pixijsagent skill innode_modules/pixi.js/skills/instead of separatepixijs-*skills. If your AI coding setup loads a skill likepixijs-scene-sprite, point it atskills/pixijs.
The release also contains a long list of fixes, including WebGL/WebGPU buffer and blend-mode fixes, a Safari 27.x MSAA fix, SVG polygon parsing with decimal coordinates and removeChildren with a non-zero start index.
Upgrade checklist
- Bump to
[email protected]and run your visual tests. - Search for
globalpointermovehandlers that accumulate values. - Try
SmoothGraphicson thin lines and scaled UI first. - Clone any
GraphicsContextshared betweenGraphicsandSmoothGraphics. - Update agent skill paths if you use them.
Takeaway
PixiJS 8.23 makes crisp vector graphics much easier: SmoothGraphics gives shader-based anti-aliasing with the familiar Graphics API, DashLineShader handles dashed strokes properly, and HTML-in-Canvas support makes DOM-in-canvas more future-proof and accessible. Read the release notes, check the event change, and start swapping in SmoothGraphics where edges matter.
