@docyrus/animaguru 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/NOTICE.md +256 -0
  2. package/README.md +241 -0
  3. package/dist/animaguru.js +27338 -0
  4. package/package.json +37 -0
  5. package/skills/animaguru/SKILL.md +115 -0
  6. package/skills/animaguru-advertising/SKILL.md +25 -0
  7. package/skills/animaguru-advertising/references/brand-bumper.md +11 -0
  8. package/skills/animaguru-advertising/references/comparison.md +11 -0
  9. package/skills/animaguru-advertising/references/creator-testimonial.md +11 -0
  10. package/skills/animaguru-advertising/references/editorial-advertorial.md +11 -0
  11. package/skills/animaguru-advertising/references/game-reward.md +11 -0
  12. package/skills/animaguru-advertising/references/offer-promotion.md +11 -0
  13. package/skills/animaguru-advertising/references/product-launch.md +11 -0
  14. package/skills/animaguru-advertising/references/product-proof.md +11 -0
  15. package/skills/animaguru-analog-film-tape/SKILL.md +29 -0
  16. package/skills/animaguru-analog-film-tape/references/recipe.md +23 -0
  17. package/skills/animaguru-animated-data-visualization/SKILL.md +39 -0
  18. package/skills/animaguru-animated-data-visualization/references/data-contract.md +16 -0
  19. package/skills/animaguru-animated-data-visualization/references/variants.md +17 -0
  20. package/skills/animaguru-art-deco-motion/SKILL.md +29 -0
  21. package/skills/animaguru-art-deco-motion/references/recipe.md +22 -0
  22. package/skills/animaguru-ascii-crt/SKILL.md +29 -0
  23. package/skills/animaguru-ascii-crt/references/recipe.md +22 -0
  24. package/skills/animaguru-blueprint-drafting/SKILL.md +29 -0
  25. package/skills/animaguru-blueprint-drafting/references/recipe.md +22 -0
  26. package/skills/animaguru-cartoon-character-animation/SKILL.md +35 -0
  27. package/skills/animaguru-cartoon-character-animation/references/variants.md +17 -0
  28. package/skills/animaguru-cutout-animation/SKILL.md +33 -0
  29. package/skills/animaguru-cutout-animation/references/production-recipe.md +37 -0
  30. package/skills/animaguru-cutout-animation/references/variants.md +17 -0
  31. package/skills/animaguru-cutout-animation/references/visual-style.md +34 -0
  32. package/skills/animaguru-dark-tech-stage/SKILL.md +29 -0
  33. package/skills/animaguru-dark-tech-stage/references/recipe.md +23 -0
  34. package/skills/animaguru-diagram-formula-motion/SKILL.md +36 -0
  35. package/skills/animaguru-diagram-formula-motion/references/variants.md +17 -0
  36. package/skills/animaguru-engraved-relief-print/SKILL.md +29 -0
  37. package/skills/animaguru-engraved-relief-print/references/recipe.md +24 -0
  38. package/skills/animaguru-flat-vector-motion/SKILL.md +35 -0
  39. package/skills/animaguru-flat-vector-motion/references/variants.md +17 -0
  40. package/skills/animaguru-general-video/SKILL.md +20 -0
  41. package/skills/animaguru-general-video/references/ambient-loop.md +11 -0
  42. package/skills/animaguru-general-video/references/music-lyrics.md +11 -0
  43. package/skills/animaguru-general-video/references/short-film.md +11 -0
  44. package/skills/animaguru-general-video/references/titles-event.md +11 -0
  45. package/skills/animaguru-general-video/references/visual-essay.md +11 -0
  46. package/skills/animaguru-generative-light-signal/SKILL.md +29 -0
  47. package/skills/animaguru-generative-light-signal/references/recipe.md +23 -0
  48. package/skills/animaguru-glass-mosaic/SKILL.md +29 -0
  49. package/skills/animaguru-glass-mosaic/references/recipe.md +23 -0
  50. package/skills/animaguru-halftone-editorial/SKILL.md +29 -0
  51. package/skills/animaguru-halftone-editorial/references/recipe.md +23 -0
  52. package/skills/animaguru-holographic-scan/SKILL.md +29 -0
  53. package/skills/animaguru-holographic-scan/references/recipe.md +22 -0
  54. package/skills/animaguru-interface-motion/SKILL.md +36 -0
  55. package/skills/animaguru-interface-motion/references/screen-mapping.md +16 -0
  56. package/skills/animaguru-interface-motion/references/variants.md +17 -0
  57. package/skills/animaguru-isometric-worlds/SKILL.md +35 -0
  58. package/skills/animaguru-isometric-worlds/references/variants.md +17 -0
  59. package/skills/animaguru-kinetic-typography/SKILL.md +35 -0
  60. package/skills/animaguru-kinetic-typography/references/variants.md +17 -0
  61. package/skills/animaguru-miniature-diorama/SKILL.md +29 -0
  62. package/skills/animaguru-miniature-diorama/references/recipe.md +23 -0
  63. package/skills/animaguru-painterly-depth-animation/SKILL.md +35 -0
  64. package/skills/animaguru-painterly-depth-animation/references/variants.md +17 -0
  65. package/skills/animaguru-paper-popup/SKILL.md +29 -0
  66. package/skills/animaguru-paper-popup/references/recipe.md +22 -0
  67. package/skills/animaguru-photo-footage-editorial/SKILL.md +29 -0
  68. package/skills/animaguru-photo-footage-editorial/references/recipe.md +23 -0
  69. package/skills/animaguru-pixel-art-animation/SKILL.md +36 -0
  70. package/skills/animaguru-pixel-art-animation/references/variants.md +17 -0
  71. package/skills/animaguru-portal-zoom/SKILL.md +29 -0
  72. package/skills/animaguru-portal-zoom/references/recipe.md +21 -0
  73. package/skills/animaguru-risograph-print/SKILL.md +29 -0
  74. package/skills/animaguru-risograph-print/references/recipe.md +23 -0
  75. package/skills/animaguru-sand-drawing/SKILL.md +29 -0
  76. package/skills/animaguru-sand-drawing/references/recipe.md +21 -0
  77. package/skills/animaguru-shadow-theatre/SKILL.md +29 -0
  78. package/skills/animaguru-shadow-theatre/references/recipe.md +23 -0
  79. package/skills/animaguru-silkscreen-poster/SKILL.md +29 -0
  80. package/skills/animaguru-silkscreen-poster/references/recipe.md +22 -0
  81. package/skills/animaguru-stop-motion-objects/SKILL.md +29 -0
  82. package/skills/animaguru-stop-motion-objects/references/recipe.md +23 -0
  83. package/skills/animaguru-studio-product-reveal/SKILL.md +29 -0
  84. package/skills/animaguru-studio-product-reveal/references/recipe.md +23 -0
  85. package/skills/animaguru-video/SKILL.md +79 -0
  86. package/skills/animaguru-whiteboard-line-drawing/SKILL.md +34 -0
  87. package/skills/animaguru-whiteboard-line-drawing/references/variants.md +17 -0
  88. package/templates/video/AGENTS.md +34 -0
  89. package/templates/video/CLAUDE.md +19 -0
  90. package/templates/video/README.md +101 -0
  91. package/templates/video/VIDEO-STYLE-NOTICES.txt +54 -0
  92. package/templates/video/film.config.json +10 -0
  93. package/templates/video/gitignore +11 -0
  94. package/templates/video/index.html +14 -0
  95. package/templates/video/package.json +28 -0
  96. package/templates/video/public/brand/logo-mark.svg +5 -0
  97. package/templates/video/scripts/build.mjs +12 -0
  98. package/templates/video/scripts/export-html.mjs +12 -0
  99. package/templates/video/scripts/export-mp4.mjs +209 -0
  100. package/templates/video/scripts/html-export-plugin.mjs +35 -0
  101. package/templates/video/scripts/html-export.mjs +54 -0
  102. package/templates/video/scripts/install-example.mjs +32 -0
  103. package/templates/video/scripts/review-analysis.mjs +29 -0
  104. package/templates/video/scripts/review-audio.mjs +24 -0
  105. package/templates/video/scripts/review.mjs +37 -0
  106. package/templates/video/scripts/starter-film.sha256 +1 -0
  107. package/templates/video/shared/locales/en/export.json +10 -0
  108. package/templates/video/shared/locales/en/film.json +42 -0
  109. package/templates/video/shared/locales/en/player.json +31 -0
  110. package/templates/video/shared/locales/en/style-studies.json +168 -0
  111. package/templates/video/shared/locales/en/timeline.json +33 -0
  112. package/templates/video/src/assets.ts +4 -0
  113. package/templates/video/src/download.ts +27 -0
  114. package/templates/video/src/exporter.ts +70 -0
  115. package/templates/video/src/film-resources.ts +29 -0
  116. package/templates/video/src/film.ts +132 -0
  117. package/templates/video/src/main.ts +219 -0
  118. package/templates/video/src/resource-timeline.ts +193 -0
  119. package/templates/video/src/review.ts +50 -0
  120. package/templates/video/src/studies/film.ts +26 -0
  121. package/templates/video/src/studies/media.ts +46 -0
  122. package/templates/video/src/studies/model.ts +60 -0
  123. package/templates/video/src/studies/pixi-renderer.ts +121 -0
  124. package/templates/video/src/studies/scenes.ts +410 -0
  125. package/templates/video/src/studies/timing.ts +53 -0
  126. package/templates/video/src/studies/variants.ts +39 -0
  127. package/templates/video/src/style.css +111 -0
  128. package/templates/video/src/timeline-model.ts +55 -0
  129. package/templates/video/style-source-provenance.json +11 -0
  130. package/templates/video/tsconfig.json +15 -0
  131. package/templates/video/vite.config.mjs +9 -0
  132. package/vendor/pixijs-skills/LICENSE +21 -0
  133. package/vendor/pixijs-skills/provenance.json +79 -0
  134. package/vendor/pixijs-skills/skills/pixijs/SKILL.md +66 -0
  135. package/vendor/pixijs-skills/skills/pixijs/references/index.md +136 -0
  136. package/vendor/pixijs-skills/skills/pixijs-accessibility/SKILL.md +224 -0
  137. package/vendor/pixijs-skills/skills/pixijs-application/SKILL.md +293 -0
  138. package/vendor/pixijs-skills/skills/pixijs-application/references/application-options.md +314 -0
  139. package/vendor/pixijs-skills/skills/pixijs-assets/SKILL.md +303 -0
  140. package/vendor/pixijs-skills/skills/pixijs-assets/references/background.md +137 -0
  141. package/vendor/pixijs-skills/skills/pixijs-assets/references/bundles.md +122 -0
  142. package/vendor/pixijs-skills/skills/pixijs-assets/references/caching.md +143 -0
  143. package/vendor/pixijs-skills/skills/pixijs-assets/references/compressed-textures.md +120 -0
  144. package/vendor/pixijs-skills/skills/pixijs-assets/references/fonts.md +205 -0
  145. package/vendor/pixijs-skills/skills/pixijs-assets/references/gif.md +171 -0
  146. package/vendor/pixijs-skills/skills/pixijs-assets/references/manifests.md +175 -0
  147. package/vendor/pixijs-skills/skills/pixijs-assets/references/progress.md +142 -0
  148. package/vendor/pixijs-skills/skills/pixijs-assets/references/resolution.md +142 -0
  149. package/vendor/pixijs-skills/skills/pixijs-assets/references/spritesheet.md +119 -0
  150. package/vendor/pixijs-skills/skills/pixijs-assets/references/svg.md +132 -0
  151. package/vendor/pixijs-skills/skills/pixijs-assets/references/video.md +158 -0
  152. package/vendor/pixijs-skills/skills/pixijs-blend-modes/SKILL.md +215 -0
  153. package/vendor/pixijs-skills/skills/pixijs-color/SKILL.md +299 -0
  154. package/vendor/pixijs-skills/skills/pixijs-core-concepts/SKILL.md +132 -0
  155. package/vendor/pixijs-skills/skills/pixijs-core-concepts/references/render-loop.md +216 -0
  156. package/vendor/pixijs-skills/skills/pixijs-core-concepts/references/renderers.md +287 -0
  157. package/vendor/pixijs-skills/skills/pixijs-create/SKILL.md +276 -0
  158. package/vendor/pixijs-skills/skills/pixijs-custom-rendering/SKILL.md +405 -0
  159. package/vendor/pixijs-skills/skills/pixijs-custom-rendering/references/advanced-gpu.md +244 -0
  160. package/vendor/pixijs-skills/skills/pixijs-custom-rendering/references/uniform-types.md +94 -0
  161. package/vendor/pixijs-skills/skills/pixijs-environments/SKILL.md +243 -0
  162. package/vendor/pixijs-skills/skills/pixijs-events/SKILL.md +387 -0
  163. package/vendor/pixijs-skills/skills/pixijs-filters/SKILL.md +300 -0
  164. package/vendor/pixijs-skills/skills/pixijs-html-source/SKILL.md +228 -0
  165. package/vendor/pixijs-skills/skills/pixijs-math/SKILL.md +489 -0
  166. package/vendor/pixijs-skills/skills/pixijs-migration-v8/SKILL.md +415 -0
  167. package/vendor/pixijs-skills/skills/pixijs-performance/SKILL.md +489 -0
  168. package/vendor/pixijs-skills/skills/pixijs-scene-container/SKILL.md +345 -0
  169. package/vendor/pixijs-skills/skills/pixijs-scene-core-concepts/SKILL.md +243 -0
  170. package/vendor/pixijs-skills/skills/pixijs-scene-core-concepts/references/constructor-options.md +155 -0
  171. package/vendor/pixijs-skills/skills/pixijs-scene-core-concepts/references/container-hierarchy.md +232 -0
  172. package/vendor/pixijs-skills/skills/pixijs-scene-core-concepts/references/layers.md +145 -0
  173. package/vendor/pixijs-skills/skills/pixijs-scene-core-concepts/references/masking.md +129 -0
  174. package/vendor/pixijs-skills/skills/pixijs-scene-core-concepts/references/render-groups.md +140 -0
  175. package/vendor/pixijs-skills/skills/pixijs-scene-core-concepts/references/scene-management.md +169 -0
  176. package/vendor/pixijs-skills/skills/pixijs-scene-core-concepts/references/transforms.md +198 -0
  177. package/vendor/pixijs-skills/skills/pixijs-scene-dom-container/SKILL.md +193 -0
  178. package/vendor/pixijs-skills/skills/pixijs-scene-gif/SKILL.md +233 -0
  179. package/vendor/pixijs-skills/skills/pixijs-scene-graphics/SKILL.md +576 -0
  180. package/vendor/pixijs-skills/skills/pixijs-scene-mesh/SKILL.md +141 -0
  181. package/vendor/pixijs-skills/skills/pixijs-scene-mesh/references/mesh-perspective.md +189 -0
  182. package/vendor/pixijs-skills/skills/pixijs-scene-mesh/references/mesh-plane.md +159 -0
  183. package/vendor/pixijs-skills/skills/pixijs-scene-mesh/references/mesh-rope.md +176 -0
  184. package/vendor/pixijs-skills/skills/pixijs-scene-mesh/references/mesh-simple.md +144 -0
  185. package/vendor/pixijs-skills/skills/pixijs-scene-mesh/references/mesh.md +213 -0
  186. package/vendor/pixijs-skills/skills/pixijs-scene-particle-container/SKILL.md +323 -0
  187. package/vendor/pixijs-skills/skills/pixijs-scene-sprite/SKILL.md +120 -0
  188. package/vendor/pixijs-skills/skills/pixijs-scene-sprite/references/animated-sprite.md +262 -0
  189. package/vendor/pixijs-skills/skills/pixijs-scene-sprite/references/nineslice-sprite.md +202 -0
  190. package/vendor/pixijs-skills/skills/pixijs-scene-sprite/references/sprite.md +181 -0
  191. package/vendor/pixijs-skills/skills/pixijs-scene-sprite/references/tiling-sprite.md +216 -0
  192. package/vendor/pixijs-skills/skills/pixijs-scene-text/SKILL.md +136 -0
  193. package/vendor/pixijs-skills/skills/pixijs-scene-text/references/bitmap-text.md +232 -0
  194. package/vendor/pixijs-skills/skills/pixijs-scene-text/references/html-text.md +192 -0
  195. package/vendor/pixijs-skills/skills/pixijs-scene-text/references/split-bitmap-text.md +187 -0
  196. package/vendor/pixijs-skills/skills/pixijs-scene-text/references/split-text.md +168 -0
  197. package/vendor/pixijs-skills/skills/pixijs-scene-text/references/text.md +311 -0
  198. package/vendor/pixijs-skills/skills/pixijs-ticker/SKILL.md +292 -0
@@ -0,0 +1,232 @@
1
+ # BitmapText
2
+
3
+ Text rendered from a pre-generated texture atlas of glyphs. Updating the text string only repositions quads; no canvas re-render, no GPU upload per change. Use `BitmapText` for scores, timers, gameplay labels, and any text whose content changes frequently. Trade-off: limited styling, fixed glyph set, pixel-perfect only at the font's native size (unless you use MSDF).
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ const score = new BitmapText({
9
+ text: "Score: 0",
10
+ style: {
11
+ fontFamily: "Arial",
12
+ fontSize: 32,
13
+ fill: 0xffffff,
14
+ },
15
+ });
16
+
17
+ app.stage.addChild(score);
18
+
19
+ app.ticker.add(() => {
20
+ score.text = `Score: ${Math.floor(performance.now() / 100)}`;
21
+ });
22
+ ```
23
+
24
+ When you pass a system font family without calling `BitmapFont.install`, the text-bitmap system generates a dynamic bitmap font on first use.
25
+
26
+ ## Construction
27
+
28
+ ```ts
29
+ const minimal = new BitmapText({ text: "Score: 0" });
30
+
31
+ const styled = new BitmapText({
32
+ text: "Hello",
33
+ style: { fontFamily: "GameFont", fontSize: 48, fill: 0xff0000 },
34
+ anchor: 0.5,
35
+ roundPixels: true,
36
+ });
37
+ ```
38
+
39
+ ### BitmapTextOptions
40
+
41
+ `BitmapText`'s constructor accepts the base `TextOptions` directly (no additional bitmap-specific fields). Fields match `references/text.md` with two caveats: `style` is still `TextStyle \| TextStyleOptions` (the same class `Text` uses, but many style fields are ignored by the bitmap pipeline), and `resolution` is managed by the underlying `BitmapFont` at install time rather than per-instance.
42
+
43
+ | Option | Type | Default | Description |
44
+ | ------------- | ------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
45
+ | `text` | `TextString` | `''` | Text content. Same as `Text`. |
46
+ | `style` | `TextStyle \| TextStyleOptions` | `new TextStyle()` with `fill = 0xffffff` | Shared TextStyle type; fields like `fontFamily`, `fontSize`, `fill`, `stroke`, `align`, `wordWrap`, `wordWrapWidth`, and `lineHeight` are respected. Gradients as fill and filters are not. See the TextStyle reference in `references/text.md`. |
47
+ | `anchor` | `PointData \| number` | `0` | Same as `Text`. |
48
+ | `resolution` | `number \| null` | `null` | Accepted but ignored at runtime — set resolution on the `BitmapFont` via `BitmapFont.install({ resolution })` instead. Passing a non-null value logs a warning. |
49
+ | `roundPixels` | `boolean` | `false` | Same as `Text`. |
50
+
51
+ All `Container` options (`position`, `scale`, `tint`, `label`, `filters`, `zIndex`, etc.) are also valid here — see `skills/pixijs-scene-core-concepts/references/constructor-options.md`.
52
+
53
+ > `BitmapText` does NOT accept `textureStyle` or `autoGenerateMipmaps`; those are specific to canvas `Text` and `HTMLText`. The atlas texture style is controlled when installing the font via `BitmapFont.install({ textureStyle })`.
54
+
55
+ ## Core Patterns
56
+
57
+ ### Dynamic fonts (system font -> runtime atlas)
58
+
59
+ ```ts
60
+ const dynamic = new BitmapText({
61
+ text: "Hello",
62
+ style: { fontFamily: "Arial", fontSize: 32, fill: 0xff1010 },
63
+ });
64
+ ```
65
+
66
+ The first `BitmapText` with a given `fontFamily` + `fontSize` generates an atlas lazily. Subsequent `BitmapText` instances reuse it. The system also scales an existing close-match size rather than re-generating.
67
+
68
+ ### Pre-installed fonts
69
+
70
+ ```ts
71
+ import { BitmapFont } from "pixi.js";
72
+
73
+ BitmapFont.install({
74
+ name: "GameFont",
75
+ style: {
76
+ fontFamily: "Arial",
77
+ fontSize: 48,
78
+ fill: 0xffffff,
79
+ stroke: { color: "#000000", width: 2 },
80
+ },
81
+ });
82
+
83
+ const title = new BitmapText({
84
+ text: "Level 1",
85
+ style: { fontFamily: "GameFont", fontSize: 48, fill: 0x00ff00 },
86
+ });
87
+ ```
88
+
89
+ `BitmapFont.install` pre-generates an atlas so the first `BitmapText` render has no setup cost. Useful for known fixed styles in a game.
90
+
91
+ #### Install options
92
+
93
+ | Option | Purpose |
94
+ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
95
+ | `chars` | Character set to pre-render. Accepts a string, nested ranges, or a preset: `BitmapFontManager.ALPHA`, `BitmapFontManager.NUMERIC`, `BitmapFontManager.ALPHANUMERIC`, `BitmapFontManager.ASCII`. Essential for non-ASCII, CJK, or restricted charsets. |
96
+ | `resolution` | Texture atlas resolution. Default `1`. Use `window.devicePixelRatio` for HiDPI displays. |
97
+ | `padding` | Glyph padding inside the atlas. Default `4`. Raise to avoid bleeding at large scales. |
98
+ | `skipKerning` | Skip kerning metadata to save memory and install time. Default `false`. |
99
+ | `textureStyle` | `TextureStyle`/`TextureStyleOptions` override for the generated atlas (for example `{ scaleMode: 'nearest' }` for pixel fonts). |
100
+ | `dynamicFill` | Allow runtime tinting via `BitmapText.tint`. Requires the font `style.fill` to be white, no stroke, no drop shadow, or a drop shadow with color `0x000000` (black). The idiomatic way to color bitmap text without generating a new atlas per color. |
101
+
102
+ ```ts
103
+ import { BitmapFont, BitmapFontManager } from "pixi.js";
104
+
105
+ BitmapFont.install({
106
+ name: "UIFont",
107
+ chars: BitmapFontManager.ALPHANUMERIC,
108
+ resolution: window.devicePixelRatio,
109
+ padding: 8,
110
+ skipKerning: true,
111
+ textureStyle: { scaleMode: "nearest" },
112
+ dynamicFill: true,
113
+ style: { fontFamily: "Arial", fontSize: 32, fill: 0xffffff },
114
+ });
115
+
116
+ const hp = new BitmapText({
117
+ text: "100",
118
+ style: { fontFamily: "UIFont", fill: "red" },
119
+ });
120
+ const mp = new BitmapText({
121
+ text: "50",
122
+ style: { fontFamily: "UIFont", fill: "blue" },
123
+ });
124
+ ```
125
+
126
+ ### Loaded bitmap fonts (FNT / XML)
127
+
128
+ ```ts
129
+ import "pixi.js/text-bitmap";
130
+ import { Assets, BitmapText } from "pixi.js";
131
+
132
+ await Assets.load("fonts/arcade.fnt");
133
+
134
+ const arcade = new BitmapText({
135
+ text: "HIGH SCORE",
136
+ style: { fontFamily: "arcade", fontSize: 36 },
137
+ });
138
+ ```
139
+
140
+ Load `.fnt` or `.xml` files (AngelCode BMFont format) via Assets. Generate them from a `.ttf` / `.otf` with [AssetPack](https://pixijs.io/assetpack/). The side-effect import `'pixi.js/text-bitmap'` registers the loader; required for custom builds that set `skipExtensionImports: true`.
141
+
142
+ ### MSDF / SDF fonts for crisp scaling
143
+
144
+ Multi-channel Signed Distance Field (MSDF) fonts stay sharp at any size. Generate them with [AssetPack](https://pixijs.io/assetpack/) (Pixi's own asset pipeline, which takes a `.ttf` or `.otf` and emits the `.fnt` + atlas) or [msdf-bmfont](https://msdf-bmfont.donmccurdy.com/). Load them via Assets; they're detected automatically when the FNT file declares a distanceField section.
145
+
146
+ ```ts
147
+ await Assets.load("fonts/msdf-hero.fnt");
148
+
149
+ const heading = new BitmapText({
150
+ text: "Title",
151
+ style: { fontFamily: "msdf-hero", fontSize: 120 },
152
+ });
153
+
154
+ heading.scale.set(2);
155
+ ```
156
+
157
+ MSDF fonts trade CPU rendering time for a custom fragment shader, but remain crisp when scaled up or down.
158
+
159
+ ### Word wrap
160
+
161
+ ```ts
162
+ const paragraph = new BitmapText({
163
+ text: "A long wrapped paragraph of bitmap text",
164
+ style: {
165
+ fontFamily: "Arial",
166
+ fontSize: 24,
167
+ wordWrap: true,
168
+ wordWrapWidth: 300,
169
+ lineHeight: 30,
170
+ },
171
+ });
172
+ ```
173
+
174
+ Standard TextStyle wrapping properties work. Line-height and alignment (`align: 'center' | 'left' | 'right'`) apply to wrapped output.
175
+
176
+ ### Updating content
177
+
178
+ ```ts
179
+ score.text = `Score: ${value}`;
180
+ ```
181
+
182
+ Updates reposition glyph quads only. No canvas re-draw, no GPU upload. This is why `BitmapText` is the right choice for every-frame text updates.
183
+
184
+ ## Common Mistakes
185
+
186
+ ### [HIGH] Not importing `pixi.js/text-bitmap` in custom builds
187
+
188
+ Wrong (custom build with `skipExtensionImports: true`):
189
+
190
+ ```ts
191
+ import { Assets } from "pixi.js";
192
+ await Assets.load("font.fnt");
193
+ ```
194
+
195
+ Correct:
196
+
197
+ ```ts
198
+ import "pixi.js/text-bitmap";
199
+ import { Assets } from "pixi.js";
200
+ await Assets.load("font.fnt");
201
+ ```
202
+
203
+ Without the side-effect import, `.fnt` and `.xml` files aren't recognized by the asset loader; the call silently succeeds but returns raw data instead of a `BitmapFont`.
204
+
205
+
206
+ ### [MEDIUM] Setting `resolution` on BitmapText
207
+
208
+ Wrong:
209
+
210
+ ```ts
211
+ text.resolution = 2;
212
+ ```
213
+
214
+ `BitmapText` ignores `resolution` and logs a warning. The effective resolution is baked into the `BitmapFont` at install time. To get higher resolution, install the font with a larger `fontSize` and scale the text down.
215
+
216
+
217
+ ### [MEDIUM] Missing characters silently dropped
218
+
219
+ If the font atlas doesn't contain a glyph (e.g., a rare Unicode character), the glyph is silently skipped with no visible error. Text may appear incomplete. For unknown or user-generated content, fall back to canvas `Text` or `HTMLText`.
220
+
221
+
222
+ ### [HIGH] Using BitmapText for CJK or emoji-heavy content
223
+
224
+ CJK (Chinese/Japanese/Korean), Arabic, and emoji-heavy strings need thousands of glyphs. A bitmap atlas containing all of them exceeds GPU texture-size limits. Use `Text` or `HTMLText` for text with unpredictable or very large character sets.
225
+
226
+
227
+ ## API Reference
228
+
229
+ - [BitmapText](https://pixijs.download/release/docs/scene.BitmapText.html.md)
230
+ - [BitmapFont](https://pixijs.download/release/docs/text.BitmapFont.html.md)
231
+ - [BitmapFontManager](https://pixijs.download/release/docs/text.BitmapFontManager.html.md)
232
+ - [AbstractBitmapFont](https://pixijs.download/release/docs/text.AbstractBitmapFont.html.md)
@@ -0,0 +1,192 @@
1
+ # HTMLText
2
+
3
+ Text rendered via an SVG `<foreignObject>` wrapping an HTML fragment. This gives you the full HTML/CSS box model for typography; real `<b>`, `<i>`, `<br>`, `<div>`, line-breaks, nested styles, emoji; rasterized to a texture. Use `HTMLText` for rich formatting, mixed content, inline custom tags, or markup that the canvas `Text` class can't express.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ const rich = new HTMLText({
9
+ text: "<b>Bold</b> and <i>italic</i> text",
10
+ style: {
11
+ fontFamily: "Arial",
12
+ fontSize: 24,
13
+ fill: 0x333333,
14
+ wordWrap: true,
15
+ wordWrapWidth: 400,
16
+ },
17
+ });
18
+
19
+ app.stage.addChild(rich);
20
+ ```
21
+
22
+ `HTMLText` is a leaf. It uses `HTMLTextStyle`, which is `TextStyle` minus `leading`, `textBaseline`, `trim`, and `filters` (those four are unsupported by the SVG rendering path). Rendering is asynchronous; the text may not appear on the same frame it's created.
23
+
24
+ ## Construction
25
+
26
+ ```ts
27
+ const minimal = new HTMLText({ text: "<b>Hello</b>" });
28
+
29
+ const styled = new HTMLText({
30
+ text: "<i>Styled</i>",
31
+ style: { fontSize: 24, fill: 0xffffff },
32
+ anchor: 0.5,
33
+ resolution: 2,
34
+ autoGenerateMipmaps: true,
35
+ textureStyle: { scaleMode: "linear" },
36
+ });
37
+ ```
38
+
39
+ ### HTMLTextOptions
40
+
41
+ `HTMLText` extends the base `TextOptions` (typed with `HTMLTextStyle` / `HTMLTextStyleOptions` as its style) and adds HTML-specific fields. Inherited `text`, `style`, `anchor`, `resolution`, and `roundPixels` behave as documented in `references/text.md` — only the HTMLText-specific additions are listed here.
42
+
43
+ | Option | Type | Default | Description |
44
+ | --------------------- | --------------------------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
45
+ | `style` | `HTMLTextStyle \| HTMLTextStyleOptions` | `new HTMLTextStyle()` | HTML text style object or options. Matches `TextStyle` minus `leading`, `textBaseline`, `trim`, and `filters`. Adds `cssOverrides` for raw CSS injection. |
46
+ | `textureStyle` | `TextureStyle \| TextureStyleOptions` | `undefined` | Scale mode for the generated texture (`nearest` or `linear`); every other `TextureStyle` field is ignored. (@advanced) |
47
+ | `autoGenerateMipmaps` | `boolean` | `TextureSource.defaultOptions.autoGenerateMipmaps` | Generate mipmaps for the text texture; improves quality when scaled down. |
48
+
49
+ All base text options (`text`, `anchor`, `resolution`, `roundPixels`) are inherited from `TextOptions` — see `references/text.md`.
50
+
51
+ All `Container` options (`position`, `scale`, `tint`, `label`, `filters`, `zIndex`, etc.) are also valid here — see `skills/pixijs-scene-core-concepts/references/constructor-options.md`.
52
+
53
+ > Both `textureStyle` and `autoGenerateMipmaps` are also exposed as runtime instance properties, but they are only read when a new texture is generated for the text (a text, style or resolution change); `onViewUpdate()` alone does not regenerate it.
54
+
55
+ ## Core Patterns
56
+
57
+ ### Custom tags via `tagStyles`
58
+
59
+ ```ts
60
+ const message = new HTMLText({
61
+ text: "<warning>Low power</warning> <custom>Press any key</custom>",
62
+ style: {
63
+ fontFamily: "Arial",
64
+ fontSize: 28,
65
+ fill: 0xffffff,
66
+ tagStyles: {
67
+ warning: { fill: 0xff3333, fontWeight: "bold" },
68
+ custom: { fill: 0x66ccff, fontStyle: "italic" },
69
+ },
70
+ },
71
+ });
72
+ ```
73
+
74
+ `tagStyles` maps custom (or standard) HTML tag names to style overrides. Inherit is automatic; a nested `<warning>` inside `<custom>` inherits the outer style. Standard tags like `<b>`, `<i>`, `<u>`, `<br>` work as expected.
75
+
76
+ ### Raw CSS overrides
77
+
78
+ ```ts
79
+ const styled = new HTMLText({
80
+ text: "Underlined shadowed text",
81
+ style: { fontSize: 24, fill: 0xffffff },
82
+ });
83
+
84
+ styled.style.addOverride("text-decoration: underline");
85
+ styled.style.addOverride("text-shadow: 2px 2px 4px rgba(0,0,0,0.5)");
86
+ ```
87
+
88
+ For CSS properties without a `TextStyle` equivalent, use `addOverride` to inject raw CSS. Useful for `text-decoration`, `text-transform`, `letter-spacing` beyond what TextStyle exposes, and any other CSS property supported inside SVG `<foreignObject>`.
89
+
90
+ ### Word wrap
91
+
92
+ ```ts
93
+ const wrapped = new HTMLText({
94
+ text: "A long paragraph of HTML text that should wrap automatically",
95
+ style: {
96
+ fontFamily: "Arial",
97
+ fontSize: 20,
98
+ fill: 0xffffff,
99
+ wordWrap: true,
100
+ wordWrapWidth: 300,
101
+ align: "center",
102
+ },
103
+ });
104
+ ```
105
+
106
+ Word wrap is handled by the browser's SVG layout, so it supports everything CSS wrapping supports; including hyphenation, justification, and RTL scripts when the font and the rendered CSS support them.
107
+
108
+ ### Resolution and mipmaps
109
+
110
+ ```ts
111
+ const crisp = new HTMLText({
112
+ text: "Retina crisp",
113
+ style: { fontSize: 32, fill: 0xffffff },
114
+ resolution: 2,
115
+ autoGenerateMipmaps: true,
116
+ });
117
+ ```
118
+
119
+ Same pattern as canvas `Text`: `resolution` controls the rasterized texture density; `autoGenerateMipmaps` improves quality when drawn smaller than native.
120
+
121
+ ### Async rendering
122
+
123
+ ```ts
124
+ const htmlText = new HTMLText({
125
+ text: "Initial content",
126
+ style: { fontSize: 24, fill: 0xffffff },
127
+ });
128
+ htmlText.visible = false;
129
+ app.stage.addChild(htmlText);
130
+
131
+ app.ticker.addOnce(() => {
132
+ htmlText.visible = true;
133
+ });
134
+ ```
135
+
136
+ HTMLText renders to an SVG blob, then a texture. The texture is available one frame after creation. If you need the text ready before showing it, add it while hidden and reveal it on the next tick.
137
+
138
+ ## Common Mistakes
139
+
140
+ ### [HIGH] Updating HTMLText content every frame
141
+
142
+ Wrong:
143
+
144
+ ```ts
145
+ app.ticker.add(() => {
146
+ htmlText.text = `Score: ${score}`;
147
+ });
148
+ ```
149
+
150
+ Correct:
151
+
152
+ ```ts
153
+ const bitmap = new BitmapText({ text: "Score: 0", style });
154
+ app.ticker.add(() => {
155
+ bitmap.text = `Score: ${score}`;
156
+ });
157
+ ```
158
+
159
+ Each `HTMLText.text` assignment re-renders the SVG, rasterizes it, and uploads to the GPU. At 60fps this is far too expensive. Use `BitmapText` for any text that changes per-frame.
160
+
161
+
162
+ ### [HIGH] Missing CORS headers on fonts
163
+
164
+ If the HTML references a web font loaded from a different origin without CORS headers, the SVG `<foreignObject>` is tainted and the rasterization fails (or falls back to a default font). Host fonts on the same origin or include `Access-Control-Allow-Origin`.
165
+
166
+
167
+ ### [MEDIUM] Expecting HTMLText frame on creation
168
+
169
+ Wrong:
170
+
171
+ ```ts
172
+ const text = new HTMLText({ text: "Hello", style });
173
+ text.x = (app.screen.width - text.width) / 2; // text.width is 0 here
174
+ ```
175
+
176
+ Correct:
177
+
178
+ ```ts
179
+ const text = new HTMLText({ text: "Hello", style });
180
+ app.ticker.addOnce(() => {
181
+ text.x = (app.screen.width - text.width) / 2;
182
+ });
183
+ ```
184
+
185
+ HTMLText measurement happens asynchronously. Defer layout calculations to the next frame, or use canvas `Text` when you need immediate metrics.
186
+
187
+
188
+ ## API Reference
189
+
190
+ - [HTMLText](https://pixijs.download/release/docs/scene.HTMLText.html.md)
191
+ - [HTMLTextStyle](https://pixijs.download/release/docs/text.HTMLTextStyle.html.md)
192
+ - [HTMLTextSystem](https://pixijs.download/release/docs/rendering.HTMLTextSystem.html.md)
@@ -0,0 +1,187 @@
1
+ # SplitBitmapText (experimental)
2
+
3
+ The bitmap counterpart to `SplitText`. Wraps a `BitmapText` and exposes `lines`, `words`, and `chars` as independently-animatable containers. Use `SplitBitmapText` when you want per-character animation on long strings, many simultaneous instances, or text that changes frequently; scenarios where `SplitText`'s per-char canvas rasterization would be too expensive.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ import { BitmapFont, SplitBitmapText } from "pixi.js";
9
+
10
+ BitmapFont.install({
11
+ name: "GameFont",
12
+ style: { fontFamily: "Arial", fontSize: 48 },
13
+ });
14
+
15
+ const split = new SplitBitmapText({
16
+ text: "Fast Animate",
17
+ style: { fontFamily: "GameFont", fontSize: 48 },
18
+ charAnchor: { x: 0.5, y: 1 },
19
+ });
20
+
21
+ app.stage.addChild(split);
22
+
23
+ split.chars.forEach((char, i) => {
24
+ char.onRender = () => {
25
+ const t = performance.now() / 200 + i;
26
+ char.y = Math.sin(t) * 5;
27
+ };
28
+ });
29
+ ```
30
+
31
+ The API mirrors `SplitText` exactly; the only difference is the underlying text engine. Install a bitmap font (or load one from a `.fnt` file) before creating the instance.
32
+
33
+ ## Construction
34
+
35
+ ```ts
36
+ const minimal = new SplitBitmapText({
37
+ text: "Hello World",
38
+ style: { fontFamily: "GameFont", fontSize: 32 },
39
+ });
40
+
41
+ const full = new SplitBitmapText({
42
+ text: "Fast\nPer-char",
43
+ style: { fontFamily: "GameFont", fontSize: 48, fill: 0xffffff },
44
+ autoSplit: true,
45
+ lineAnchor: 0.5,
46
+ wordAnchor: { x: 0, y: 0.5 },
47
+ charAnchor: { x: 0.5, y: 1 },
48
+ x: 100,
49
+ y: 200,
50
+ });
51
+ ```
52
+
53
+ ### SplitBitmapTextOptions
54
+
55
+ `SplitBitmapText` uses the same option shape as `SplitText`: all splitting fields are inherited from `AbstractSplitOptions`, and the only concrete difference is that `style` drives a `BitmapText` render instead of a `Text` render. Like `SplitText`, it is a `Container`, not a `ViewContainer`; the top-level options do NOT include `anchor`, `resolution`, `roundPixels`, `textureStyle`, or `autoGenerateMipmaps`.
56
+
57
+ | Option | Type | Default | Description |
58
+ | ------------ | ---------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
59
+ | `text` | `string` | — | Text content to render and segment. Required. |
60
+ | `style` | `TextStyle \| Partial<TextStyleOptions>` | — | TextStyle instance or style options; `fill` defaults to `0xffffff` when unset, matching `BitmapText`. See `references/bitmap-text.md` for which fields the bitmap pipeline respects. Required. |
61
+ | `autoSplit` | `boolean` | `true` | Automatically re-split when `text` or `style` changes; set `false` to batch updates and call `split.split()` manually. |
62
+ | `lineAnchor` | `number \| PointData` | `0` | Normalized transform origin (0–1) for each line container. |
63
+ | `wordAnchor` | `number \| PointData` | `0` | Normalized transform origin for each word container. |
64
+ | `charAnchor` | `number \| PointData` | `0` | Normalized transform origin for each character container. |
65
+
66
+ All `Container` options (`position`, `scale`, `tint`, `label`, `filters`, `zIndex`, etc.) are also valid here — see `skills/pixijs-scene-core-concepts/references/constructor-options.md`.
67
+
68
+ > `SplitBitmapText.defaultOptions` overrides the defaults globally for every new `SplitBitmapText` instance. `SplitBitmapText.from(existingBitmapText, options?)` builds an instance by cloning the source's text and style — `tagStyles` on the source are discarded (bitmap text does not support them) and a warning is logged.
69
+
70
+ ## Core Patterns
71
+
72
+ ### Segment access
73
+
74
+ ```ts
75
+ split.lines.forEach((line) => {
76
+ line.alpha = 0.9;
77
+ });
78
+ split.words.forEach((word) => {
79
+ word.scale.set(1.1);
80
+ });
81
+ split.chars.forEach((char) => {
82
+ char.rotation = 0.05;
83
+ });
84
+ ```
85
+
86
+ Each `lines[i]`, `words[i]`, `chars[i]` is a Container wrapping a `BitmapText` instance for that segment. BitmapText glyph quads are cheap, so iterating and transforming hundreds of characters stays performant.
87
+
88
+ ### Transform origins
89
+
90
+ ```ts
91
+ const split = new SplitBitmapText({
92
+ text: "Wave motion",
93
+ style: { fontFamily: "GameFont", fontSize: 48 },
94
+ lineAnchor: 0.5,
95
+ wordAnchor: { x: 0, y: 0.5 },
96
+ charAnchor: { x: 0.5, y: 1 },
97
+ });
98
+ ```
99
+
100
+ Same normalized 0–1 anchors as `SplitText`: line, word, and char containers each get a separate transform origin. Set once at construction; the anchors apply to every future re-split.
101
+
102
+ ### Stagger animation
103
+
104
+ ```ts
105
+ split.chars.forEach((char, i) => {
106
+ char.alpha = 0;
107
+ });
108
+
109
+ let elapsed = 0;
110
+ app.ticker.add((ticker) => {
111
+ elapsed += ticker.deltaMS;
112
+ split.chars.forEach((char, i) => {
113
+ if (elapsed > i * 50) char.alpha = Math.min(char.alpha + 0.05, 1);
114
+ });
115
+ });
116
+ ```
117
+
118
+ Reveal characters one at a time. Because each char is a cheap BitmapText, this scales to long strings without dropping frames.
119
+
120
+ ### Constructing from an existing BitmapText
121
+
122
+ ```ts
123
+ const label = new BitmapText({
124
+ text: "Press start",
125
+ style: { fontFamily: "GameFont", fontSize: 32 },
126
+ });
127
+
128
+ const animatable = SplitBitmapText.from(label);
129
+ ```
130
+
131
+ `SplitBitmapText.from(existingBitmapText)` copies content and style, then splits. Useful for attaching per-character animation to a text that was already laid out elsewhere.
132
+
133
+ ### Updating content
134
+
135
+ ```ts
136
+ split.text = "New string";
137
+ ```
138
+
139
+ `autoSplit` (default `true`) rebuilds the segment arrays on every text/style change. Per-segment animations attached via `onRender` persist across re-splits as long as you re-apply them in the update step.
140
+
141
+ ## Common Mistakes
142
+
143
+ ### [HIGH] Using SplitBitmapText without a BitmapFont
144
+
145
+ Wrong:
146
+
147
+ ```ts
148
+ const split = new SplitBitmapText({
149
+ text: "Hello",
150
+ style: { fontFamily: "Arial", fontSize: 48 },
151
+ });
152
+ ```
153
+
154
+ The above works; dynamic bitmap fonts auto-generate; but for known game fonts prefer pre-installing:
155
+
156
+ Correct:
157
+
158
+ ```ts
159
+ BitmapFont.install({
160
+ name: "GameFont",
161
+ style: { fontFamily: "Arial", fontSize: 48 },
162
+ });
163
+ const split = new SplitBitmapText({
164
+ text: "Hello",
165
+ style: { fontFamily: "GameFont", fontSize: 48 },
166
+ });
167
+ ```
168
+
169
+ Pre-installation avoids first-render latency and gives you control over the atlas.
170
+
171
+
172
+ ### [MEDIUM] Expecting CJK or emoji support
173
+
174
+ `SplitBitmapText` inherits BitmapText's limitations: the glyph atlas must contain every character, and very large character sets exceed GPU texture size. For per-character animation on CJK or emoji-heavy text, use `SplitText` (which accepts the performance cost) or pre-generate a targeted atlas covering only the characters you'll use.
175
+
176
+
177
+ ### [MEDIUM] Missing glyphs silently dropped
178
+
179
+ If a character isn't in the font atlas, its segment is skipped and no error is thrown. Array indices may not line up one-to-one with source character positions if glyphs are missing. Always test your font against the full string content.
180
+
181
+
182
+ ## API Reference
183
+
184
+ - [SplitBitmapText](https://pixijs.download/release/docs/text.SplitBitmapText.html.md)
185
+ - [AbstractSplitText](https://pixijs.download/release/docs/text.AbstractSplitText.html.md)
186
+ - [BitmapText](https://pixijs.download/release/docs/scene.BitmapText.html.md)
187
+ - [BitmapFont](https://pixijs.download/release/docs/text.BitmapFont.html.md)