Loading...
Loading...
Use this skill when rendering text in PixiJS v8. Covers Text for canvas-quality styled labels, BitmapText for cheap per-frame updates via glyph atlas, HTMLText for HTML/CSS markup via SVG, SplitText and SplitBitmapText for per-character animation, TextStyle, tagStyles, constructor options, TextOptions, HTMLTextOptions, BitmapText, SplitTextOptions, SplitBitmapTextOptions. Triggers on: Text, BitmapText, HTMLText, SplitText, SplitBitmapText, TextStyle, HTMLTextStyle, BitmapFont.install, tagStyles, fontFamily, wordWrap.
npx skill4agent add pixijs/pixijs-skills pixijs-scene-textTextBitmapTextHTMLText<foreignObject>SplitTextSplitBitmapTextpixijs-scene-core-conceptsContainerconst text = new Text({
text: "Hello PixiJS",
style: {
fontFamily: "Arial",
fontSize: 36,
fill: 0xffffff,
stroke: { color: 0x4a1850, width: 5 },
dropShadow: { color: 0x000000, blur: 4, distance: 6 },
},
});
text.anchor.set(0.5);
text.x = app.screen.width / 2;
text.y = 40;
app.stage.addChild(text);(string, style)pixijs-scene-core-conceptspixijs-assetspixijs-performancepixijs-colorFillInputpixijs-scene-graphicsFillInput| Variant | Use when | Trade-offs | Reference |
|---|---|---|---|
| High-quality static or infrequent-update labels | Expensive to update (canvas re-draw + GPU upload) | references/text.md |
| Scores, timers, gameplay labels, anything that changes every frame | Limited styling; fixed glyph atlas; requires MSDF for crisp scaling | references/bitmap-text.md |
| Rich formatted text, mixed styles, real HTML tags | Async rendering (one frame delay); similar update cost to | references/html-text.md |
| Per-character animation with rich styling | Each char is a full | references/split-text.md |
| Per-character animation on long strings or dynamic content | Inherits BitmapText limitations (glyph atlas, no MSDF-free crispness) | references/split-bitmap-text.md |
Textreferences/text.mdBitmapTextreferences/bitmap-text.md<b><i><br>HTMLTextreferences/html-text.md<red>Warning:</red>TextHTMLTexttagStylesSplitTextSplitBitmapTextreferences/split-text.mdreferences/split-bitmap-text.mdTextHTMLTextBitmapTextAssets.load({ src: 'font.woff2', data: { family: 'MyFont' } })style.fontFamily: 'MyFont'TextHTMLText| Update trigger | Text | BitmapText | HTMLText | SplitText | SplitBitmapText |
|---|---|---|---|---|---|
Changing | High | Very low | High | Very high (N text re-renders) | Low (N quad repositions) |
Changing | High | Medium | High | Very high | Medium |
Moving ( | Free | Free | Free | Free | Free |
| Rotating / scaling | Free | Free | Free | Free | Free |
BitmapTextSplitBitmapTextnew Text({ text, style, ... })(string, style)tagStylesTextHTMLTextstyle.tagStylestagStyles<BitmapFont.installBitmapTextBitmapTextfontFamilyAssets.load('font.fnt')import 'pixi.js/text-bitmap'Text.textapp.ticker.add(() => {
scoreText.text = `Score: ${score}`;
});const scoreText = new BitmapText({ text: "Score: 0", style });
app.ticker.add(() => {
scoreText.text = `Score: ${score}`;
});TextBitmapTextconst text = new Text("Hello", { fontSize: 24 });const text = new Text({ text: "Hello", style: { fontSize: 24 } });(string, style)pixi.js/text-bitmapskipExtensionImports: trueAssets.load('font.fnt')import 'pixi.js/text-bitmap'import { ... } from 'pixi.js'allowChildren = falseContainer