@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,181 @@
1
+ # Sprite
2
+
3
+ The core image-drawing leaf. Displays a single `Texture` at a transform. Use `Sprite` whenever you want to draw a static image that isn't animated (`AnimatedSprite`), repeating (`TilingSprite`), or resizable with borders (`NineSliceSprite`).
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ const texture = await Assets.load("bunny.png");
9
+
10
+ const sprite = new Sprite({
11
+ texture,
12
+ anchor: 0.5,
13
+ tint: 0xff8888,
14
+ });
15
+ sprite.x = app.screen.width / 2;
16
+ sprite.y = app.screen.height / 2;
17
+
18
+ app.stage.addChild(sprite);
19
+ ```
20
+
21
+ `Sprite` is a leaf; `allowChildren` is `false`. Wrap sprites in a `Container` if you need to group or nest them.
22
+
23
+ Position is set after construction because `app.screen.width / 2` depends on the live renderer; literal positions can go directly in the options as `x`/`y`.
24
+
25
+ ## Core Patterns
26
+
27
+ ### Construction
28
+
29
+ ```ts
30
+ const fromTexture = new Sprite(texture);
31
+
32
+ const fromCache = Sprite.from("bunny.png");
33
+
34
+ const fromCanvasNoCache = Sprite.from(canvas, true);
35
+
36
+ const withOptions = new Sprite({
37
+ texture,
38
+ anchor: 0.5,
39
+ x: 100,
40
+ y: 200,
41
+ tint: 0xffcc00,
42
+ alpha: 0.8,
43
+ roundPixels: true,
44
+ });
45
+ ```
46
+
47
+ #### SpriteOptions
48
+
49
+ | Option | Type | Default | Description |
50
+ | ------------- | --------------------- | --------------- | ------------------------------------------------------------------------------------- |
51
+ | `texture` | `Texture` | `Texture.EMPTY` | Texture to draw. |
52
+ | `anchor` | `PointData \| number` | `0` | Normalized draw origin in `[0, 1]`; falls back to `texture.defaultAnchor` when unset. |
53
+ | `roundPixels` | `boolean` | `false` | Snap rendering coordinates to integers for crisp pixel art. |
54
+
55
+ All `Container` options (`position`, `scale`, `tint`, `label`, `filters`, `zIndex`, etc.) are also valid here — see `skills/pixijs-scene-core-concepts/references/constructor-options.md`.
56
+
57
+ `Sprite.from(source, skipCache?)` accepts a `Texture` or a `TextureSourceLike` (canvas, video, URL). With a cached alias it only reads the cache and returns `Texture.EMPTY` if the texture was not loaded first; always `await Assets.load(...)` for images. The optional second `skipCache` argument forwards to `Texture.from` to avoid storing ephemeral textures in the global cache.
58
+
59
+ Video and canvas elements work as texture sources too. Load a video file via `await Assets.load('clip.mp4')` and pass the returned texture to `new Sprite(texture)`; on mobile platforms, start playback from a user gesture to satisfy autoplay policies.
60
+
61
+ ### Sizing helpers
62
+
63
+ ```ts
64
+ sprite.setSize(200); // square: both axes
65
+ sprite.setSize(200, 120); // width and height
66
+ sprite.setSize({ width: 200, height: 120 });
67
+
68
+ const size = sprite.getSize(); // { width, height }
69
+ const reused = { width: 0, height: 0 };
70
+ sprite.getSize(reused); // write into an existing object
71
+ ```
72
+
73
+ `setSize` avoids the double bounds recalculation of setting `width` and `height` separately. `getSize(out?)` returns the current drawn size and optionally writes into a passed object.
74
+
75
+ ### Visual vs source bounds
76
+
77
+ ```ts
78
+ const drawn = sprite.visualBounds; // minX, maxX, minY, maxY of the drawn region (anchor-aware)
79
+ ```
80
+
81
+ `sprite.visualBounds` is the rectangle the sprite actually draws in local space, accounting for anchor and texture trim. It differs from `getLocalBounds()` when the texture has padding/trim or a non-zero anchor.
82
+
83
+ ### Anchor
84
+
85
+ ```ts
86
+ sprite.anchor.set(0.5); // center both axes
87
+ sprite.anchor.set(0, 0); // top-left (default)
88
+ sprite.anchor.set(1, 0); // top-right
89
+ sprite.anchor = { x: 0.5, y: 1 }; // bottom-center
90
+ ```
91
+
92
+ `anchor` is normalized `[0, 1]` relative to the texture dimensions. It shifts where the texture draws relative to the sprite's `(x, y)` without offsetting the sprite's position. If omitted, falls back to `texture.defaultAnchor`. Anchor is Sprite-only; it differs from `pivot` (inherited from `Container`, in pixel space); pivot shifts both transform origin and visual position.
93
+
94
+ ### Tint and alpha
95
+
96
+ ```ts
97
+ sprite.tint = 0xff0000; // multiply against the texture colors
98
+ sprite.alpha = 0.5; // parent-combined transparency
99
+ ```
100
+
101
+ `tint` multiplies pixel values; white (`0xffffff`) is a no-op. `alpha` is combined with ancestor alpha up the tree.
102
+
103
+ ### Round pixels
104
+
105
+ ```ts
106
+ const sprite = new Sprite({ texture, roundPixels: true });
107
+ ```
108
+
109
+ Snaps rendering coordinates to integers for crisp pixel-art. Apply per-sprite, or globally via `TextureStyle.defaultOptions.scaleMode = 'nearest'` + `roundPixels: true` on the renderer.
110
+
111
+ ### Dynamic textures
112
+
113
+ ```ts
114
+ texture.dynamic = true;
115
+ texture.frame.width /= 2;
116
+ texture.update();
117
+ ```
118
+
119
+ v8 removed event-based change notification. Set `texture.dynamic = true` once, then normal `texture.update()` calls propagate to all sprites that reference it. Without `dynamic`, you must call `sprite['onViewUpdate']()` manually after mutating the texture.
120
+
121
+ ## Common Mistakes
122
+
123
+ ### [HIGH] Using `Texture.from(url)` to load
124
+
125
+ Wrong:
126
+
127
+ ```ts
128
+ const texture = Texture.from("https://example.com/image.png");
129
+ const sprite = new Sprite(texture);
130
+ ```
131
+
132
+ Correct:
133
+
134
+ ```ts
135
+ const texture = await Assets.load("https://example.com/image.png");
136
+ const sprite = new Sprite(texture);
137
+ ```
138
+
139
+ In v8, `Texture.from()` only retrieves from the cache. It does not fetch. Use `Assets.load()` first; its return value is the texture, so you don't need a separate `Texture.from()` call.
140
+
141
+
142
+ ### [HIGH] Confusing anchor with pivot
143
+
144
+ Wrong:
145
+
146
+ ```ts
147
+ sprite.pivot.set(sprite.width / 2, sprite.height / 2);
148
+ ```
149
+
150
+ Correct:
151
+
152
+ ```ts
153
+ sprite.anchor.set(0.5);
154
+ ```
155
+
156
+ `anchor` is normalized `[0, 1]` and shifts where the texture draws without offsetting position. `pivot` is in pixel space and offsets both the transform origin and the rendered position. For centering a sprite, always use `anchor`.
157
+
158
+
159
+ ### [MEDIUM] Adding children to a Sprite
160
+
161
+ Wrong:
162
+
163
+ ```ts
164
+ sprite.addChild(childSprite);
165
+ ```
166
+
167
+ Correct:
168
+
169
+ ```ts
170
+ const group = new Container();
171
+ group.addChild(sprite, childSprite);
172
+ ```
173
+
174
+ `Sprite` sets `allowChildren = false`. Adding children logs a deprecation warning and will become a hard error. Group leaves inside a `Container`.
175
+
176
+
177
+ ## API Reference
178
+
179
+ - [Sprite](https://pixijs.download/release/docs/scene.Sprite.html.md)
180
+ - [SpriteOptions](https://pixijs.download/release/docs/scene.SpriteOptions.html.md)
181
+ - [Texture](https://pixijs.download/release/docs/rendering.Texture.html.md)
@@ -0,0 +1,216 @@
1
+ # TilingSprite
2
+
3
+ A sprite variant that repeats a texture across a given area. The texture can be scrolled, scaled, and rotated independently of the sprite itself. Use for scrolling backgrounds, parallax layers, repeating ground patterns, and any surface that tiles a single texture.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ const texture = await Assets.load("grass.png");
9
+
10
+ const bg = new TilingSprite({
11
+ texture,
12
+ width: app.screen.width,
13
+ height: app.screen.height,
14
+ });
15
+
16
+ app.stage.addChild(bg);
17
+
18
+ app.ticker.add((ticker) => {
19
+ bg.tilePosition.x -= 1 * ticker.deltaTime;
20
+ });
21
+ ```
22
+
23
+ `width` / `height` define the visible tiling region. `tilePosition` scrolls the pattern within that region.
24
+
25
+ ## Construction
26
+
27
+ ```ts
28
+ const bg = new TilingSprite({
29
+ texture,
30
+ width: 800,
31
+ height: 600,
32
+ tilePosition: { x: 0, y: 0 },
33
+ tileScale: { x: 1.5, y: 1.5 },
34
+ anchor: 0.5,
35
+ roundPixels: true,
36
+ });
37
+
38
+ const fromTexture = TilingSprite.from(texture, { width: 800, height: 600 });
39
+ const fromCache = TilingSprite.from("pattern.png", { width: 800, height: 600 });
40
+ ```
41
+
42
+ `TilingSprite.from(source, options?)` accepts a `Texture` or a cached alias string. The alias form reads from the Assets cache only; `await Assets.load('pattern.png')` first or the returned sprite draws `Texture.EMPTY`.
43
+
44
+ ### TilingSpriteOptions
45
+
46
+ | Option | Type | Default | Description |
47
+ | ---------------------- | --------------------- | ---------------- | ---------------------------------------------------------------------------------- |
48
+ | `texture` | `Texture` | `Texture.EMPTY` | Texture repeated across the tiling region. |
49
+ | `width` | `number` | `256` | Width of the visible tiling region. |
50
+ | `height` | `number` | `256` | Height of the visible tiling region. |
51
+ | `anchor` | `PointData \| number` | `{ x: 0, y: 0 }` | Normalized origin of the tiling sprite itself (not the pattern). |
52
+ | `tilePosition` | `PointData` | `{ x: 0, y: 0 }` | Offset of the repeated pattern within the region; animate to scroll. |
53
+ | `tileScale` | `PointData` | `{ x: 1, y: 1 }` | Scale applied to the tile pattern only; sprite region stays the same size. |
54
+ | `tileRotation` | `number` | `0` | Rotation in radians applied to the texture before tiling. |
55
+ | `applyAnchorToTexture` | `boolean` | `false` | Shift the texture origin by the anchor instead of locking `(0,0)` to the top-left. |
56
+ | `roundPixels` | `boolean` | `false` | Snap the sprite's position (not the tile pattern) to integer coordinates. |
57
+
58
+ All `Container` options (`position`, `scale`, `tint`, `label`, `filters`, `zIndex`, etc.) are also valid here — see `skills/pixijs-scene-core-concepts/references/constructor-options.md`.
59
+
60
+ ## Core Patterns
61
+
62
+ ### Scrolling pattern
63
+
64
+ ```ts
65
+ app.ticker.add((ticker) => {
66
+ bg.tilePosition.x -= 2 * ticker.deltaTime;
67
+ bg.tilePosition.y -= 0.5 * ticker.deltaTime;
68
+ });
69
+ ```
70
+
71
+ `tilePosition` is an `ObservablePoint`. Shifting it moves the pattern without moving the sprite. This is the cheapest way to scroll a background.
72
+
73
+ ### Tile scale and rotation
74
+
75
+ ```ts
76
+ bg.tileScale.set(2, 2);
77
+ bg.tileRotation = Math.PI / 4;
78
+ ```
79
+
80
+ - `tileScale`: scales the pattern independently of the sprite. A value of `{ x: 2, y: 2 }` doubles each tile.
81
+ - `tileRotation`: rotates the tile pattern in radians. The rotation is applied to the texture before tiling, so the underlying sprite stays axis-aligned.
82
+
83
+ ### Anchor on the tiling region
84
+
85
+ ```ts
86
+ const bg = new TilingSprite({
87
+ texture,
88
+ width: 800,
89
+ height: 600,
90
+ anchor: 0.5,
91
+ });
92
+
93
+ bg.x = app.screen.width / 2;
94
+ bg.y = app.screen.height / 2;
95
+ ```
96
+
97
+ `anchor` is the normalized origin of the tiling sprite itself (same semantics as `Sprite`), not of the repeated tile. The visible region is anchored, the tiles fill it.
98
+
99
+ ### `applyAnchorToTexture`
100
+
101
+ ```ts
102
+ const bg = new TilingSprite({
103
+ texture,
104
+ width: 800,
105
+ height: 600,
106
+ anchor: 0.5,
107
+ applyAnchorToTexture: true,
108
+ });
109
+ ```
110
+
111
+ By default, the top-left corner of the tiling region always maps to the `(0, 0)` texture coordinate. Set `applyAnchorToTexture: true` to shift the texture origin based on the anchor; useful when you want the pattern to stay centered on the sprite's anchor point as it scales.
112
+
113
+ ### Parallax layers
114
+
115
+ ```ts
116
+ const far = new TilingSprite({ texture: farTex, width: 800, height: 600 });
117
+ const near = new TilingSprite({ texture: nearTex, width: 800, height: 600 });
118
+
119
+ app.stage.addChild(far, near);
120
+
121
+ app.ticker.add((ticker) => {
122
+ far.tilePosition.x -= 0.5 * ticker.deltaTime;
123
+ near.tilePosition.x -= 2 * ticker.deltaTime;
124
+ });
125
+ ```
126
+
127
+ Give each layer a different `tilePosition` scroll rate for a parallax effect. Scroll speeds are independent per sprite.
128
+
129
+ ### Round pixels
130
+
131
+ ```ts
132
+ const bg = new TilingSprite({
133
+ texture,
134
+ width: 800,
135
+ height: 600,
136
+ roundPixels: true,
137
+ });
138
+ ```
139
+
140
+ Snaps the sprite's position (not the tile pattern) to integer coordinates. Useful for pixel-art tilesets to avoid shimmer.
141
+
142
+ ### Hit testing
143
+
144
+ ```ts
145
+ bg.eventMode = "static";
146
+ bg.on("pointertap", (e) => {
147
+ console.log("tile clicked", bg.toLocal(e.global));
148
+ });
149
+ ```
150
+
151
+ `TilingSprite` overrides `containsPoint` so hit testing respects the anchor-offset bounds of the tiling region (not the texture). Use it as a regular event target for clickable backgrounds.
152
+
153
+ ### Global defaults
154
+
155
+ ```ts
156
+ TilingSprite.defaultOptions.texture = Texture.from("defaultPattern.png");
157
+ TilingSprite.defaultOptions.tileScale = { x: 2, y: 2 };
158
+ ```
159
+
160
+ `TilingSprite.defaultOptions` is a mutable static object merged with any options passed to the constructor. Override fields once at startup for project-wide defaults.
161
+
162
+ ### Resizing the tiling region
163
+
164
+ ```ts
165
+ bg.setSize(app.screen.width, app.screen.height);
166
+ const size = bg.getSize();
167
+ ```
168
+
169
+ `setSize(value, height?)` accepts a square value, two numbers, or `{ width, height }`. `getSize(out?)` returns the current region and optionally writes into an existing object. Both override the base `Sprite` behavior so a single call avoids recomputing bounds twice.
170
+
171
+ ## Common Mistakes
172
+
173
+ ### [HIGH] Forgetting to pass a texture
174
+
175
+ Wrong:
176
+
177
+ ```ts
178
+ const bg = new TilingSprite({ width: 800, height: 600 });
179
+ ```
180
+
181
+ Correct:
182
+
183
+ ```ts
184
+ const texture = await Assets.load("pattern.png");
185
+ const bg = new TilingSprite({ texture, width: 800, height: 600 });
186
+ ```
187
+
188
+ The runtime default is `Texture.EMPTY` (set in `TilingSprite.defaultOptions`), so omitting the texture produces an invisible sprite with nothing to tile. Always pass a real texture.
189
+
190
+
191
+ ### [HIGH] Scaling the sprite instead of the tile
192
+
193
+ Wrong:
194
+
195
+ ```ts
196
+ bg.scale.set(2);
197
+ ```
198
+
199
+ Correct:
200
+
201
+ ```ts
202
+ bg.tileScale.set(2);
203
+ ```
204
+
205
+ Scaling the sprite stretches everything; including the visible area. Use `tileScale` to make each tile larger while keeping the sprite's region the same size.
206
+
207
+
208
+ ### [MEDIUM] Non-power-of-two textures with `tileScale`
209
+
210
+ Some WebGL implementations cannot repeat non-power-of-two textures in hardware. If you see the pattern clamp to the edge instead of wrapping, resize the source texture to power-of-two dimensions (128, 256, 512, etc.) or pre-bake the tile pattern into a larger texture.
211
+
212
+
213
+ ## API Reference
214
+
215
+ - [TilingSprite](https://pixijs.download/release/docs/scene.TilingSprite.html.md)
216
+ - [TilingSpriteOptions](https://pixijs.download/release/docs/scene.TilingSpriteOptions.html.md)
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: pixijs-scene-text
3
+ description: "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."
4
+ license: MIT
5
+ ---
6
+
7
+ PixiJS has five text-rendering classes that cover different trade-offs between styling, performance, and animation. `Text` renders to a canvas for full CSS-style fidelity. `BitmapText` reads from a pre-generated atlas for cheap updates. `HTMLText` renders an HTML fragment via SVG `<foreignObject>` for rich markup. `SplitText` and `SplitBitmapText` wrap the first two classes and expose per-character, per-word, and per-line containers for animation.
8
+
9
+ Assumes familiarity with `pixijs-scene-core-concepts`. All text classes are leaf nodes; they cannot have children. Wrap multiple text instances in a `Container` to group them.
10
+
11
+ ## Quick Start
12
+
13
+ ```ts
14
+ const text = new Text({
15
+ text: "Hello PixiJS",
16
+ style: {
17
+ fontFamily: "Arial",
18
+ fontSize: 36,
19
+ fill: 0xffffff,
20
+ stroke: { color: 0x4a1850, width: 5 },
21
+ dropShadow: { color: 0x000000, blur: 4, distance: 6 },
22
+ },
23
+ });
24
+
25
+ text.anchor.set(0.5);
26
+ text.x = app.screen.width / 2;
27
+ text.y = 40;
28
+
29
+ app.stage.addChild(text);
30
+ ```
31
+
32
+ All text classes use options-object constructors; positional `(string, style)` from v7 is not supported.
33
+
34
+ **Related skills:** `pixijs-scene-core-concepts` (leaves, transforms), `pixijs-assets` (font loading), `pixijs-performance` (BitmapText tradeoffs), `pixijs-color` (`FillInput` for fill/stroke), `pixijs-scene-graphics` (gradients and patterns reused via `FillInput`).
35
+
36
+ ## Variants
37
+
38
+ | Variant | Use when | Trade-offs | Reference |
39
+ | ----------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------- | ------------------------------------------------------------------ |
40
+ | `Text` | High-quality static or infrequent-update labels | Expensive to update (canvas re-draw + GPU upload) | [references/text.md](references/text.md) |
41
+ | `BitmapText` | Scores, timers, gameplay labels, anything that changes every frame | Limited styling; fixed glyph atlas; requires MSDF for crisp scaling | [references/bitmap-text.md](references/bitmap-text.md) |
42
+ | `HTMLText` | Rich formatted text, mixed styles, real HTML tags | Async rendering (one frame delay); similar update cost to `Text` | [references/html-text.md](references/html-text.md) |
43
+ | `SplitText` | Per-character animation with rich styling | Each char is a full `Text`; expensive for long strings | [references/split-text.md](references/split-text.md) |
44
+ | `SplitBitmapText` | Per-character animation on long strings or dynamic content | Inherits BitmapText limitations (glyph atlas, no MSDF-free crispness) | [references/split-bitmap-text.md](references/split-bitmap-text.md) |
45
+
46
+ ## When to use what
47
+
48
+ - **"I need a styled static label"** → `Text`. Use for titles, menus, dialog, error messages. See `references/text.md`.
49
+ - **"I need a score or timer that updates every frame"** → `BitmapText`. Updates only reposition quads; no canvas re-draw. See `references/bitmap-text.md`.
50
+ - **"I need mixed formatting with `<b>`, `<i>`, `<br>`"** → `HTMLText`. Real HTML/CSS rendering via SVG. See `references/html-text.md`.
51
+ - **"I need inline colored tags like `<red>Warning:</red>`"** → `Text` or `HTMLText` with `tagStyles`. Both support it.
52
+ - **"I need to animate each character individually"** → `SplitText` for short strings, `SplitBitmapText` for long strings or many instances. See `references/split-text.md` / `references/split-bitmap-text.md`.
53
+ - **"I need CJK / Arabic / emoji-heavy text"** → `Text` or `HTMLText`. `BitmapText` fails because the glyph set is too large for a single atlas.
54
+ - **"I need a custom font"** → Load via `Assets.load({ src: 'font.woff2', data: { family: 'MyFont' } })` first, then set `style.fontFamily: 'MyFont'`. Works for `Text` and `HTMLText`.
55
+
56
+ ## Update cost comparison
57
+
58
+ | Update trigger | Text | BitmapText | HTMLText | SplitText | SplitBitmapText |
59
+ | ------------------- | ---- | ---------- | -------- | ----------------------------- | ------------------------ |
60
+ | Changing `.text` | High | Very low | High | Very high (N text re-renders) | Low (N quad repositions) |
61
+ | Changing `.style` | High | Medium | High | Very high | Medium |
62
+ | Moving (`.x`, `.y`) | Free | Free | Free | Free | Free |
63
+ | Rotating / scaling | Free | Free | Free | Free | Free |
64
+
65
+ "Free" = normal Container transform cost. "High" = new canvas draw + GPU upload. "Very low" = quad reposition only. Update strings that change per-frame only on `BitmapText` or `SplitBitmapText`.
66
+
67
+ ## Quick concepts
68
+
69
+ - **Options-object constructors.** Every v8 text class uses `new Text({ text, style, ... })`. The v7 `(string, style)` form is removed.
70
+ - **`tagStyles`.** `Text` and `HTMLText` support per-tag styling via `style.tagStyles`. Tags are only parsed when `tagStyles` has entries; otherwise `<` is treated literally.
71
+ - **`BitmapFont.install`.** Pre-generates an atlas before you create any `BitmapText`. Without install, the first `BitmapText` with a new `fontFamily` generates the atlas lazily.
72
+ - **MSDF fonts.** Multi-channel Signed Distance Field fonts stay sharp at any size. Generate with external tools (e.g., msdf-bmfont), load via `Assets.load('font.fnt')`. Requires `import 'pixi.js/text-bitmap'` in custom builds.
73
+
74
+ ## Common Mistakes
75
+
76
+ ### [HIGH] Updating `Text.text` every frame
77
+
78
+ Wrong:
79
+
80
+ ```ts
81
+ app.ticker.add(() => {
82
+ scoreText.text = `Score: ${score}`;
83
+ });
84
+ ```
85
+
86
+ Correct:
87
+
88
+ ```ts
89
+ const scoreText = new BitmapText({ text: "Score: 0", style });
90
+ app.ticker.add(() => {
91
+ scoreText.text = `Score: ${score}`;
92
+ });
93
+ ```
94
+
95
+ Every `Text` update re-rasterizes the whole string. Use `BitmapText` for any value that changes per-frame.
96
+
97
+
98
+ ### [HIGH] Positional constructor args
99
+
100
+ Wrong:
101
+
102
+ ```ts
103
+ const text = new Text("Hello", { fontSize: 24 });
104
+ ```
105
+
106
+ Correct:
107
+
108
+ ```ts
109
+ const text = new Text({ text: "Hello", style: { fontSize: 24 } });
110
+ ```
111
+
112
+ v8 removed the `(string, style)` form. All text classes use options objects.
113
+
114
+
115
+ ### [HIGH] Not importing `pixi.js/text-bitmap` in custom builds
116
+
117
+ Under `skipExtensionImports: true` or aggressive tree-shaking, `Assets.load('font.fnt')` silently returns raw data unless you add `import 'pixi.js/text-bitmap'`. The standard `import { ... } from 'pixi.js'` bundle includes the extension.
118
+
119
+
120
+ ### [MEDIUM] Adding children to a text instance
121
+
122
+ Every text class sets `allowChildren = false`. Wrap in a `Container` to group text with other content.
123
+
124
+
125
+ ## API Reference
126
+
127
+ - [Text](https://pixijs.download/release/docs/scene.Text.html.md)
128
+ - [TextStyle](https://pixijs.download/release/docs/text.TextStyle.html.md)
129
+ - [BitmapText](https://pixijs.download/release/docs/scene.BitmapText.html.md)
130
+ - [BitmapFont](https://pixijs.download/release/docs/text.BitmapFont.html.md)
131
+ - [HTMLText](https://pixijs.download/release/docs/scene.HTMLText.html.md)
132
+ - [HTMLTextStyle](https://pixijs.download/release/docs/text.HTMLTextStyle.html.md)
133
+ - [SplitText](https://pixijs.download/release/docs/text.SplitText.html.md)
134
+ - [SplitBitmapText](https://pixijs.download/release/docs/text.SplitBitmapText.html.md)
135
+ - [AbstractSplitText](https://pixijs.download/release/docs/text.AbstractSplitText.html.md)
136
+ - [AbstractText](https://pixijs.download/release/docs/scene.AbstractText.html.md)