@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,168 @@
1
+ # SplitText
2
+
3
+ A container that splits a canvas `Text` render into independently-animatable `lines`, `words`, and `chars`; each exposed as its own `Text` instance. Use `SplitText` for per-character intro animations, staggered reveals, or any effect where you need to transform each glyph, word, or line separately.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ const split = new SplitText({
9
+ text: "Animate Me",
10
+ style: { fontSize: 48, fill: 0xffffff },
11
+ charAnchor: { x: 0.5, y: 1 },
12
+ });
13
+
14
+ app.stage.addChild(split);
15
+
16
+ split.chars.forEach((char, i) => {
17
+ char.alpha = 0;
18
+ char.y = -40;
19
+ const delay = i * 80;
20
+ setTimeout(() => {
21
+ app.ticker.add(() => {
22
+ char.alpha = Math.min(char.alpha + 0.05, 1);
23
+ char.y += (0 - char.y) * 0.1;
24
+ });
25
+ }, delay);
26
+ });
27
+ ```
28
+
29
+ `SplitText` is new in v8; API shape may still evolve. It wraps `Text` internally, so the same TextStyle options apply. Every character is a full `Text` instance; use sparingly and prefer `SplitBitmapText` for long strings or many animated instances.
30
+
31
+ ## Construction
32
+
33
+ ```ts
34
+ const minimal = new SplitText({
35
+ text: "Hello World",
36
+ style: { fontSize: 32, fill: 0xffffff },
37
+ });
38
+
39
+ const full = new SplitText({
40
+ text: "Animate\nEvery Character",
41
+ style: { fontSize: 48, fill: "white", stroke: { color: "black", width: 2 } },
42
+ autoSplit: true,
43
+ lineAnchor: 0.5,
44
+ wordAnchor: { x: 0, y: 0.5 },
45
+ charAnchor: { x: 0.5, y: 1 },
46
+ x: 100,
47
+ y: 200,
48
+ alpha: 0.8,
49
+ });
50
+ ```
51
+
52
+ ### SplitTextOptions
53
+
54
+ `SplitText` is a `Container` (not a `ViewContainer`), so unlike `Text` it does NOT take `anchor`, `resolution`, `roundPixels`, `textureStyle`, or `autoGenerateMipmaps` at the top level. Those belong on the internal per-character `Text` instances. The splitting behavior is controlled by the fields below.
55
+
56
+ | Option | Type | Default | Description |
57
+ | ------------ | ---------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------- |
58
+ | `text` | `string` | — | Text content to render and segment. Required. |
59
+ | `style` | `TextStyle \| Partial<TextStyleOptions>` | — | TextStyle instance or style options; the same TextStyle used by `Text`. See `references/text.md`. Required. |
60
+ | `autoSplit` | `boolean` | `true` | Automatically re-split when `text` or `style` changes; set `false` to batch updates and call `split.split()` manually. |
61
+ | `lineAnchor` | `number \| PointData` | `0` | Normalized transform origin (0–1) for each line container; controls the pivot of per-line rotations/scales. |
62
+ | `wordAnchor` | `number \| PointData` | `0` | Same as `lineAnchor` but for each word container. |
63
+ | `charAnchor` | `number \| PointData` | `0` | Same as `lineAnchor` but for each character container. |
64
+
65
+ All `Container` options (`position`, `scale`, `tint`, `label`, `filters`, `zIndex`, etc.) are also valid here — see `skills/pixijs-scene-core-concepts/references/constructor-options.md`.
66
+
67
+ > `SplitText.defaultOptions` overrides the defaults globally for every new `SplitText` instance. The built-in defaults are the values above.
68
+
69
+ ## Core Patterns
70
+
71
+ ### Segment access
72
+
73
+ ```ts
74
+ split.lines.forEach((line) => {
75
+ line.alpha = 0.8;
76
+ });
77
+ split.words.forEach((word) => {
78
+ word.rotation = 0.1;
79
+ });
80
+ split.chars.forEach((char) => {
81
+ char.scale.set(1.2);
82
+ });
83
+ ```
84
+
85
+ `lines` and `words` are `Container[]`; `chars` is `Text[]` directly (or `BitmapText[]` for `SplitBitmapText`). All three arrays are refreshed whenever the text or style changes (when `autoSplit` is `true`).
86
+
87
+ ### Transform origins
88
+
89
+ ```ts
90
+ const split = new SplitText({
91
+ text: "Wave",
92
+ style: { fontSize: 64, fill: 0xffffff },
93
+ lineAnchor: 0.5,
94
+ wordAnchor: { x: 0, y: 0.5 },
95
+ charAnchor: { x: 0.5, y: 1 },
96
+ });
97
+ ```
98
+
99
+ - `lineAnchor`: transform origin for each line container (0–1 normalized).
100
+ - `wordAnchor`: transform origin for each word container.
101
+ - `charAnchor`: transform origin for each character container.
102
+
103
+ Setting these once at construction time ensures rotations and scales pivot around the intended point (center, bottom, etc.).
104
+
105
+ ### Animating per character
106
+
107
+ ```ts
108
+ split.chars.forEach((char, i) => {
109
+ char.onRender = () => {
110
+ const t = performance.now() / 200 + i;
111
+ char.y = Math.sin(t) * 5;
112
+ };
113
+ });
114
+ ```
115
+
116
+ Using each character's `onRender` hook avoids one global ticker callback. Each char updates itself every render pass.
117
+
118
+ ### Auto-split on change
119
+
120
+ ```ts
121
+ split.text = "New text";
122
+ ```
123
+
124
+ With `autoSplit = true` (default), reassigning `text` or `style` re-splits and rebuilds the segment arrays. Set `autoSplit = false` to batch multiple changes before calling `split.split()` manually (see `pixijs-scene-text` source).
125
+
126
+ ### Constructing from an existing Text
127
+
128
+ ```ts
129
+ const plain = new Text({ text: "Convert me", style: { fontSize: 32 } });
130
+ const converted = SplitText.from(plain);
131
+ ```
132
+
133
+ `SplitText.from(existingText)` copies content and style, then splits. Useful when you already have a `Text` instance and want to apply per-character animation retroactively.
134
+
135
+ ## Common Mistakes
136
+
137
+ ### [HIGH] Many SplitText instances with long strings
138
+
139
+ Each character is a full `Text` instance with its own canvas rasterization and GPU texture. A 40-character `SplitText` creates 40 text renders at construction time. For long strings, use `SplitBitmapText`; it wraps `BitmapText` instead, so each character reuses the glyph atlas.
140
+
141
+
142
+ ### [MEDIUM] Modifying `chars` array directly
143
+
144
+ Wrong:
145
+
146
+ ```ts
147
+ split.chars.push(extraChar);
148
+ ```
149
+
150
+ Correct:
151
+
152
+ ```ts
153
+ split.text = split.text + "extra";
154
+ ```
155
+
156
+ `chars`, `words`, and `lines` are managed arrays. Pushing to them is ignored and will be overwritten on the next auto-split. Always update via the `text` property and let the class rebuild segments.
157
+
158
+
159
+ ### [MEDIUM] Expecting segments before the first render
160
+
161
+ When `autoSplit` is true, splitting happens lazily on first property read or render. If you need segments immediately after construction, access `chars` (or call `split.split()` manually) once before iterating.
162
+
163
+
164
+ ## API Reference
165
+
166
+ - [SplitText](https://pixijs.download/release/docs/text.SplitText.html.md)
167
+ - [AbstractSplitText](https://pixijs.download/release/docs/text.AbstractSplitText.html.md)
168
+ - [SplitTextOptions](https://pixijs.download/release/docs/text.SplitTextOptions.html.md)
@@ -0,0 +1,311 @@
1
+ # Text (Canvas Text)
2
+
3
+ The primary text renderer in PixiJS v8. Rasterizes strings to an off-screen canvas via the native Canvas API, then uploads the result as a GPU texture. Use `Text` for high-quality typography, styled labels, UI text, and anything where visual fidelity matters more than update speed. For frequently-changing numeric displays (scores, timers), prefer `BitmapText`.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ const text = new Text({
9
+ text: "Hello PixiJS",
10
+ style: {
11
+ fontFamily: "Arial",
12
+ fontSize: 36,
13
+ fill: 0xffffff,
14
+ stroke: { color: "#4a1850", width: 5 },
15
+ dropShadow: {
16
+ color: "#000000",
17
+ blur: 4,
18
+ distance: 6,
19
+ angle: Math.PI / 6,
20
+ },
21
+ },
22
+ anchor: 0.5,
23
+ x: 400,
24
+ y: 40,
25
+ });
26
+
27
+ app.stage.addChild(text);
28
+ ```
29
+
30
+ Text is a leaf (`allowChildren = false`). It uses an options-object constructor; positional `(string, style)` arguments from v7 are no longer supported.
31
+
32
+ ## Construction
33
+
34
+ ```ts
35
+ const minimal = new Text({ text: "Hello" });
36
+
37
+ const styled = new Text({
38
+ text: "Styled Text",
39
+ style: { fontSize: 24, fill: 0xff1010 },
40
+ anchor: 0.5,
41
+ resolution: 2,
42
+ roundPixels: true,
43
+ });
44
+
45
+ const crisp = new Text({
46
+ text: "Crisp Text",
47
+ style: { fontSize: 32 },
48
+ textureStyle: { scaleMode: "nearest" },
49
+ autoGenerateMipmaps: true,
50
+ });
51
+ ```
52
+
53
+ ### CanvasTextOptions
54
+
55
+ These are the options accepted by `new Text({ ... })`. The concrete `Text` constructor takes `CanvasTextOptions`, which extends the base `TextOptions` with the canvas-specific `textureStyle` and `autoGenerateMipmaps` fields.
56
+
57
+ | Option | Type | Default | Description |
58
+ | --------------------- | ----------------------------------------------------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
59
+ | `text` | `TextString` (`string \| number \| { toString(): string }`) | `''` | Text content to display; `'\n'` inserts a line break. |
60
+ | `style` | `TextStyle \| TextStyleOptions` | `new TextStyle()` | Text style object or options. See the existing TextStyle docs below for field details. |
61
+ | `anchor` | `PointData \| number` | `0` | Draw origin in `[0, 1]`; `0.5` is center, `1` is bottom-right. |
62
+ | `resolution` | `number` | `null` (auto) | Pixel density of the rasterized texture; `null` follows the renderer's resolution (setting to `null` at runtime enables auto-resolution; the interface type is `number`). |
63
+ | `roundPixels` | `boolean` | `false` | Snap rendered x/y to whole pixels to avoid sub-pixel anti-aliasing. |
64
+ | `textureStyle` | `TextureStyle \| TextureStyleOptions` | `undefined` | Scale mode for the generated texture (`nearest` or `linear`); every other `TextureStyle` field is ignored. (@advanced) |
65
+ | `autoGenerateMipmaps` | `boolean` | `TextureSource.defaultOptions.autoGenerateMipmaps` | Generate mipmaps for the text texture; improves quality when scaled down. |
66
+
67
+ All `Container` options (`position`, `scale`, `tint`, `label`, `filters`, `zIndex`, etc.) are also valid here — see `skills/pixijs-scene-core-concepts/references/constructor-options.md`.
68
+
69
+ The `style` field is a rich nested type; the rest of this document covers its key properties.
70
+
71
+ ## Core Patterns
72
+
73
+ ### TextStyle properties
74
+
75
+ ```ts
76
+ const styled = new Text({
77
+ text: "Styled",
78
+ style: {
79
+ fontFamily: "Arial",
80
+ fontSize: 32,
81
+ fontWeight: "bold",
82
+ fontStyle: "italic",
83
+ fill: 0xff1010,
84
+ stroke: { color: "#4a1850", width: 5 },
85
+ dropShadow: {
86
+ color: "#000000",
87
+ blur: 4,
88
+ distance: 6,
89
+ angle: Math.PI / 6,
90
+ alpha: 0.8,
91
+ },
92
+ align: "center",
93
+ wordWrap: true,
94
+ wordWrapWidth: 300,
95
+ lineHeight: 45,
96
+ letterSpacing: 2,
97
+ padding: 4,
98
+ },
99
+ });
100
+ ```
101
+
102
+ Key TextStyle properties:
103
+
104
+ - `fontFamily`, `fontSize`, `fontWeight`, `fontStyle`
105
+ - `fill`: color, gradient, or pattern (same `FillInput` as `Graphics`)
106
+ - `stroke`: `{ color, width }` object
107
+ - `dropShadow`: `{ color, blur, distance, angle, alpha }`
108
+ - `wordWrap`, `wordWrapWidth`
109
+ - `breakWords`: allow breaking mid-word when wrapping. Requires `wordWrap: true`
110
+ - `whiteSpace`: `'normal' | 'pre' | 'pre-line'` whitespace handling for multi-line strings
111
+ - `align`: `'left'`, `'center'`, `'right'`, `'justify'`; only affects multi-line text
112
+ - `textBaseline`: `'alphabetic' | 'top' | 'hanging' | 'middle' | 'ideographic' | 'bottom'`
113
+ - `lineHeight`, `letterSpacing`
114
+ - `leading`: additional line spacing in pixels on top of `lineHeight`
115
+ - `trim`: boolean; crop transparent padding after rasterization (expensive, use only when needed)
116
+ - `padding`: extra space around the rendered texture; increase when a stroke or shadow gets clipped
117
+ - `filters`: array of Pixi filters applied to the generated text texture at bake time, cheaper than filters on the `Text` node for static strings
118
+ - `tagStyles`: per-tag inline style overrides
119
+
120
+ ### Tagged text
121
+
122
+ ```ts
123
+ const alert = new Text({
124
+ text: "<red>Warning:</red> system <b>overloaded</b>",
125
+ style: {
126
+ fontSize: 24,
127
+ fill: 0xffffff,
128
+ tagStyles: {
129
+ red: { fill: 0xff0000 },
130
+ b: { fontWeight: "bold" },
131
+ },
132
+ },
133
+ });
134
+ ```
135
+
136
+ Tags are parsed only when `tagStyles` has entries; without entries, `<` is treated literally. Nested tags inherit from outer tags via an internal style stack.
137
+
138
+ ### Font loading
139
+
140
+ ```ts
141
+ await Assets.load({
142
+ src: "my-font.woff2",
143
+ data: { family: "MyFont" },
144
+ });
145
+
146
+ const text = new Text({
147
+ text: "Custom Font",
148
+ style: { fontFamily: "MyFont", fontSize: 36, fill: 0xffffff },
149
+ });
150
+ ```
151
+
152
+ Supported formats: `woff2` (preferred), `woff`, `ttf`, `otf`. The `data` object is forwarded to `FontFace`; valid fields are `family`, `display`, `style`, `weights` (string array, e.g., `['normal', 'bold']`), `stretch`, `unicodeRange`, `featureSettings`, `variant`.
153
+
154
+ ```ts
155
+ await Assets.load({
156
+ src: "titan-one.woff",
157
+ data: { family: "Titan One", weights: ["normal", "bold"] },
158
+ });
159
+ ```
160
+
161
+ ### Resolution and mipmaps
162
+
163
+ ```ts
164
+ const sharp = new Text({
165
+ text: "Crisp on retina",
166
+ style: { fontSize: 36, fill: 0xffffff },
167
+ resolution: 2,
168
+ autoGenerateMipmaps: true,
169
+ });
170
+ ```
171
+
172
+ - `resolution` (default: renderer's resolution): pixel density of the underlying texture. Higher values produce sharper text on high-DPI displays.
173
+ - `autoGenerateMipmaps`: improves quality when the text is drawn smaller than its native size.
174
+
175
+ ### Dynamic content
176
+
177
+ ```ts
178
+ app.ticker.add(() => {
179
+ const next = `Score: ${score}`;
180
+ if (scoreText.text !== next) {
181
+ scoreText.text = next;
182
+ }
183
+ });
184
+ ```
185
+
186
+ Guard text updates with an equality check when using `Text` for live values. Every assignment triggers a canvas re-render and GPU upload.
187
+
188
+ ### Sharing a TextStyle across instances
189
+
190
+ ```ts
191
+ const style = new TextStyle({ fontSize: 24, fill: 0xffffff });
192
+
193
+ const title = new Text({ text: "Title", style });
194
+ const label = new BitmapText({ text: "Label", style });
195
+
196
+ style.fill = 0xff0000; // both re-render
197
+
198
+ title.destroy(); // detaches from `style`; `label` keeps using it
199
+ ```
200
+
201
+ A `TextStyle` instance can be shared by any number of `Text`, `BitmapText`, and `HTMLText` objects; changing it re-renders all of them. `destroy()` detaches the text from the style without destroying it. Only pass `destroy({ style: true })` (or `destroy(true)`) when no other text object uses that style, since it destroys the shared instance.
202
+
203
+ ### Gradient and pattern fills
204
+
205
+ ```ts
206
+ import { FillGradient } from "pixi.js";
207
+
208
+ const gradient = new FillGradient({
209
+ end: { x: 0, y: 1 },
210
+ colorStops: [
211
+ { color: 0xff0000, offset: 0 },
212
+ { color: 0x0000ff, offset: 1 },
213
+ ],
214
+ });
215
+
216
+ const title = new Text({
217
+ text: "Gradient",
218
+ style: { fontSize: 64, fill: gradient },
219
+ });
220
+ ```
221
+
222
+ For a texture fill, pass a `FillPattern`. Its constructor takes an options object; the legacy positional form `new FillPattern(texture, repetition)` is also accepted.
223
+
224
+ ```ts
225
+ import { Assets, FillPattern } from "pixi.js";
226
+
227
+ const pattern = new FillPattern({
228
+ texture: await Assets.load("bricks.png"),
229
+ repetition: "repeat",
230
+ });
231
+
232
+ const label = new Text({
233
+ text: "PixiJS",
234
+ style: { fontSize: 64, fill: pattern },
235
+ });
236
+ ```
237
+
238
+ Canvas-rendered text ignores the pattern's `textureSpace`; the texture tiles in the text's pixel space at its native size. Use `pattern.setTransform(matrix)` to scale, rotate, or offset the tiles. A `FillPattern` works for `stroke` too, e.g. `style: { stroke: { fill: pattern, width: 10 } }`.
239
+
240
+ `fill` accepts any `FillInput` that `Graphics` accepts; gradients, patterns, solid colors, and arrays of stops.
241
+
242
+ ## Common Mistakes
243
+
244
+ ### [HIGH] Updating Text content every frame
245
+
246
+ Wrong:
247
+
248
+ ```ts
249
+ app.ticker.add(() => {
250
+ scoreText.text = `Score: ${score}`;
251
+ });
252
+ ```
253
+
254
+ Correct:
255
+
256
+ ```ts
257
+ const scoreText = new BitmapText({ text: "Score: 0", style });
258
+ app.ticker.add(() => {
259
+ scoreText.text = `Score: ${score}`;
260
+ });
261
+ ```
262
+
263
+ Every `Text` update re-rasterizes the full string and uploads a new texture. At 60fps this burns frame budget. Use `BitmapText` for values that change per-frame, or at minimum guard with an equality check against the previous string.
264
+
265
+
266
+ ### [HIGH] Using positional constructor args
267
+
268
+ Wrong:
269
+
270
+ ```ts
271
+ const text = new Text("Hello", { fontSize: 24 });
272
+ ```
273
+
274
+ Correct:
275
+
276
+ ```ts
277
+ const text = new Text({ text: "Hello", style: { fontSize: 24 } });
278
+ ```
279
+
280
+ v8 `Text` uses an options object. The v7 `(string, style)` signature is not supported.
281
+
282
+
283
+ ### [MEDIUM] Stroke or shadow getting clipped at edges
284
+
285
+ Wrong:
286
+
287
+ ```ts
288
+ const text = new Text({
289
+ text: "Hello",
290
+ style: { stroke: { color: "red", width: 10 } },
291
+ });
292
+ ```
293
+
294
+ Correct:
295
+
296
+ ```ts
297
+ const text = new Text({
298
+ text: "Hello",
299
+ style: { stroke: { color: "red", width: 10 }, padding: 10 },
300
+ });
301
+ ```
302
+
303
+ The underlying canvas is sized from the text metrics; heavy strokes or drop-shadows render past those bounds and get clipped. Add `padding` to the style to enlarge the texture.
304
+
305
+
306
+ ## API Reference
307
+
308
+ - [Text](https://pixijs.download/release/docs/scene.Text.html.md)
309
+ - [TextStyle](https://pixijs.download/release/docs/text.TextStyle.html.md)
310
+ - [TextOptions](https://pixijs.download/release/docs/text.TextOptions.html.md)
311
+ - [AbstractText](https://pixijs.download/release/docs/scene.AbstractText.html.md)