@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,137 @@
1
+ # Background Loading
2
+
3
+ Background loading lets PixiJS fetch and prepare assets passively while other work happens. Use it to prime the next level while the current one is playing, preload assets during a splash screen, or prepare UI assets during initial load. `backgroundLoad` and `backgroundLoadBundle` are non-blocking and return immediately.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ await Assets.loadBundle("menu");
9
+ showMenu();
10
+
11
+ Assets.backgroundLoadBundle("level1");
12
+
13
+ playerClicksStart(() => {
14
+ Assets.loadBundle("level1").then(() => startLevel());
15
+ });
16
+ ```
17
+
18
+ The `backgroundLoadBundle` call starts loading `level1` immediately without blocking. The later `loadBundle` call resolves quickly if background loading finished in the meantime.
19
+
20
+ ## Core Patterns
21
+
22
+ ### Background-loading a single asset
23
+
24
+ ```ts
25
+ Assets.backgroundLoad("images/level2-assets.png");
26
+
27
+ // later, when we need it:
28
+ const texture = await Assets.load("images/level2-assets.png");
29
+ ```
30
+
31
+ Fire-and-forget. Background loading happens one asset at a time to avoid blocking the main thread. When your code later calls `Assets.load(url)` for the same asset, it either resolves immediately (if background work finished) or waits for the already-in-progress load.
32
+
33
+ ### Background-loading an array
34
+
35
+ ```ts
36
+ Assets.backgroundLoad([
37
+ "images/sprite1.png",
38
+ "images/sprite2.png",
39
+ "images/background.png",
40
+ ]);
41
+ ```
42
+
43
+ Queues multiple assets for background loading. They're processed sequentially.
44
+
45
+ ### Background-loading a bundle
46
+
47
+ ```ts
48
+ await Assets.init({
49
+ manifest: {
50
+ bundles: [
51
+ { name: "home", assets: [{ alias: "bg", src: "home-bg.png" }] },
52
+ { name: "level-1", assets: [{ alias: "map", src: "level1-map.json" }] },
53
+ ],
54
+ },
55
+ });
56
+
57
+ await Assets.loadBundle("home");
58
+ showHome();
59
+
60
+ Assets.backgroundLoadBundle("level-1");
61
+
62
+ onPlayClicked(async () => {
63
+ await Assets.loadBundle("level-1");
64
+ startLevel();
65
+ });
66
+ ```
67
+
68
+ Same idea for bundles. Bundle assets are queued one at a time. Requires the bundle to exist via the manifest or `addBundle`.
69
+
70
+ ### Interrupting background loading
71
+
72
+ ```ts
73
+ Assets.backgroundLoadBundle("level-2");
74
+
75
+ onPlayerDecidedLevel3(async () => {
76
+ await Assets.loadBundle("level-3");
77
+ });
78
+ ```
79
+
80
+ Calling `Assets.load()` or `Assets.loadBundle()` interrupts background loading safely. The current background asset finishes, then the explicit load takes priority. Your explicit load resolves normally.
81
+
82
+ ### Combining with a progress bar
83
+
84
+ Background loading has no progress callback; it runs silently. To show a loading bar, use `Assets.loadBundle(name, onProgress)` in the foreground instead. Typical pattern: use background loading for nice-to-have preloads and foreground loading for the bundles you're actually waiting on.
85
+
86
+ ## Common Mistakes
87
+
88
+ ### [HIGH] Expecting progress from background loading
89
+
90
+ Wrong:
91
+
92
+ ```ts
93
+ Assets.backgroundLoadBundle("level2", (p) => updateBar(p));
94
+ ```
95
+
96
+ Correct:
97
+
98
+ ```ts
99
+ Assets.backgroundLoadBundle("level2");
100
+ // show a spinner or no UI while it runs
101
+ ```
102
+
103
+ `backgroundLoad` and `backgroundLoadBundle` don't accept progress callbacks. They're silent. For visible progress, use the foreground `Assets.load` / `Assets.loadBundle` with an `onProgress` argument.
104
+
105
+
106
+ ### [MEDIUM] Assuming background load completes before next foreground load
107
+
108
+ Wrong:
109
+
110
+ ```ts
111
+ Assets.backgroundLoadBundle("level-2");
112
+ setTimeout(() => startLevel2(), 0);
113
+ ```
114
+
115
+ Correct:
116
+
117
+ ```ts
118
+ Assets.backgroundLoadBundle("level-2");
119
+
120
+ onStart(async () => {
121
+ await Assets.loadBundle("level-2");
122
+ startLevel2();
123
+ });
124
+ ```
125
+
126
+ Background loading is best-effort. If the player hits Start before it finishes, the foreground `loadBundle` still needs to await the remaining work. Always `await` the real load before using the assets.
127
+
128
+
129
+ ### [MEDIUM] Background-loading assets that are never used
130
+
131
+ Each queued background load consumes bandwidth and GPU memory. If the player never visits level 2, you've wasted that bandwidth. Background-load only what you're confident will be needed soon.
132
+
133
+
134
+ ## API Reference
135
+
136
+ - [Assets](https://pixijs.download/release/docs/assets.Assets.html.md)
137
+ - [BackgroundLoader](https://pixijs.download/release/docs/assets.BackgroundLoader.html.md)
@@ -0,0 +1,122 @@
1
+ # Bundles
2
+
3
+ A bundle is a named group of assets you can load or unload as a unit. Use bundles to batch assets per game level, UI screen, or feature so that a single `loadBundle(name)` call resolves everything needed for that context. Bundles play well with background loading and manifest-based workflows.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ Assets.addBundle("level1", [
9
+ { alias: "bg", src: "level1/background.png" },
10
+ { alias: "tileset", src: "level1/tiles.json" },
11
+ { alias: "theme", src: "level1/music.mp3" },
12
+ ]);
13
+
14
+ const resources = await Assets.loadBundle("level1");
15
+ const bg = Sprite.from("bg");
16
+ ```
17
+
18
+ `loadBundle(name)` returns a `Record<alias, asset>`. Each alias is also available via `Assets.get(alias)` after the bundle resolves.
19
+
20
+ ## Core Patterns
21
+
22
+ ### Programmatic bundles
23
+
24
+ ```ts
25
+ Assets.addBundle("ui", [
26
+ { alias: "button", src: "ui/button.png" },
27
+ { alias: "panel", src: "ui/panel.png" },
28
+ { alias: "cursor", src: "ui/cursor.png" },
29
+ ]);
30
+
31
+ await Assets.loadBundle("ui");
32
+ ```
33
+
34
+ `addBundle(name, assets)` registers a bundle at runtime. The assets array uses the same `{ alias, src, data? }` shape as `Assets.add()`.
35
+
36
+ ### Loading multiple bundles at once
37
+
38
+ ```ts
39
+ await Assets.loadBundle(["ui", "level1", "sounds"]);
40
+ ```
41
+
42
+ Pass an array of bundle names to load them in parallel. The returned object is keyed by bundle name: `{ ui: {...}, level1: {...}, sounds: {...} }`.
43
+
44
+ ### Progress across a bundle
45
+
46
+ ```ts
47
+ await Assets.loadBundle("level1", (progress) => {
48
+ loadingBar.width = progress * maxBarWidth;
49
+ });
50
+ ```
51
+
52
+ The second argument is a `ProgressCallback` that fires as each asset in the bundle completes. Progress is normalized `[0, 1]` across the entire bundle.
53
+
54
+ ### Unloading a bundle
55
+
56
+ ```ts
57
+ await Assets.unloadBundle("level1");
58
+ ```
59
+
60
+ Tears down every asset in the bundle, releases GPU memory, and removes cached entries. Remove any Sprites or Text that reference the bundle's textures before unloading.
61
+
62
+ ### Sharing assets between bundles
63
+
64
+ ```ts
65
+ Assets.addBundle("main", [{ alias: "hero", src: "hero.png" }]);
66
+ Assets.addBundle("bossArea", [{ alias: "hero", src: "hero.png" }]);
67
+ ```
68
+
69
+ If two bundles declare the same alias with the same `src`, the underlying texture is loaded once and shared. There is no reference counting: unloading either bundle destroys the shared texture, and the other bundle's alias stays broken until you reload it.
70
+
71
+ ### Bundle IDs
72
+
73
+ ```ts
74
+ const resources = await Assets.loadBundle("level1");
75
+ const bg = resources["bg"];
76
+
77
+ const fromCache = Assets.get("bg");
78
+
79
+ const fromNamespaced = Assets.get("level1-bg");
80
+ ```
81
+
82
+ Inside the resolver, bundle assets are stored under a combined key like `'level1-bg'` by default. The plain `'bg'` alias still resolves thanks to resolver shortcuts. If you need to override the format, pass `bundleIdentifier` to `Assets.init()`.
83
+
84
+ ## Common Mistakes
85
+
86
+ ### [HIGH] Unloading while assets are still in use
87
+
88
+ Wrong:
89
+
90
+ ```ts
91
+ await Assets.unloadBundle("level1");
92
+ // level1 sprites still on the stage; they now reference destroyed textures
93
+ ```
94
+
95
+ Correct:
96
+
97
+ ```ts
98
+ level1Container.destroy({ children: true });
99
+ await Assets.unloadBundle("level1");
100
+ ```
101
+
102
+ Always destroy (or detach from the scene) any display objects that reference the bundle's textures before unloading. Otherwise the renderer hits freed GPU memory and errors.
103
+
104
+
105
+ ### [MEDIUM] Confusing `addBundle` and `init` manifests
106
+
107
+ Wrong:
108
+
109
+ ```ts
110
+ await Assets.init();
111
+ Assets.addBundle('ui', [...]);
112
+ await Assets.loadBundle('ui');
113
+ ```
114
+
115
+ Both work; this is not actually wrong; but a manifest passed to `Assets.init({ manifest: {...} })` registers all bundles at init time in one place. Prefer manifests when you know all bundles upfront; prefer `addBundle` when bundles are discovered dynamically at runtime.
116
+
117
+
118
+ ## API Reference
119
+
120
+ - [Assets](https://pixijs.download/release/docs/assets.Assets.html.md)
121
+ - [AssetsBundle](https://pixijs.download/release/docs/assets.AssetsBundle.html.md)
122
+ - [Resolver](https://pixijs.download/release/docs/assets.Resolver.html.md)
@@ -0,0 +1,143 @@
1
+ # Caching
2
+
3
+ Every asset loaded through `Assets` is cached until you explicitly unload it. The cache is a global singleton keyed by the resolved URL, alias, and any bundle identifier. Use the cache to avoid double-loading, retrieve loaded assets synchronously, and reclaim GPU memory when an asset is no longer needed.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ await Assets.load("hero.png");
9
+
10
+ const cached = Assets.get("hero.png");
11
+ const sprite = new Sprite(cached);
12
+
13
+ await Assets.unload("hero.png");
14
+ ```
15
+
16
+ `Assets.load` adds the asset to the cache; `Assets.get` retrieves it synchronously; `Assets.unload` removes it and releases the underlying GPU resource.
17
+
18
+ ## Core Patterns
19
+
20
+ ### Synchronous access to already-loaded assets
21
+
22
+ ```ts
23
+ await Assets.load(["hero.png", "enemy.png"]);
24
+
25
+ const hero = Assets.get("hero");
26
+ const enemy = Assets.get("enemy");
27
+
28
+ if (hero) {
29
+ app.stage.addChild(new Sprite(hero));
30
+ }
31
+ ```
32
+
33
+ `Assets.get(alias)` returns `undefined` if the asset has not been loaded yet. It is synchronous; use it in tight loops or anywhere `await` would be awkward.
34
+
35
+ ### Multiple keys at once
36
+
37
+ ```ts
38
+ await Assets.load(["hero", "enemy", "boss"]);
39
+
40
+ const all = Assets.get(["hero", "enemy", "boss"]);
41
+ const heroTex = all["hero"];
42
+ ```
43
+
44
+ Passing an array returns an object keyed by alias. Useful for retrieving all the assets a scene needs in one call.
45
+
46
+ ### Deduping load calls
47
+
48
+ ```ts
49
+ const tex1 = await Assets.load("hero.png");
50
+ const tex2 = await Assets.load("hero.png");
51
+ console.log(tex1 === tex2); // true
52
+ ```
53
+
54
+ Calling `Assets.load` with the same key multiple times returns the same cached result immediately on subsequent calls. Safe to call from multiple async functions concurrently.
55
+
56
+ ### Unloading
57
+
58
+ ```ts
59
+ sprite.destroy();
60
+ await Assets.unload("hero.png");
61
+ ```
62
+
63
+ `Assets.unload(id)` removes the asset from the cache, calls `destroy()` on the texture (releasing GPU memory), and removes any loader-specific wrappers. Always destroy or detach display objects that reference the asset before unloading, or you'll hit freed GPU memory.
64
+
65
+ ### Unloading a bundle
66
+
67
+ ```ts
68
+ level1Container.destroy({ children: true });
69
+ await Assets.unloadBundle("level1");
70
+ ```
71
+
72
+ Prefer `unloadBundle` over manually iterating. It has no reference counting: every asset in the bundle is removed from the cache and destroyed, even if another bundle declares the same `src`, and that bundle's alias stays broken until you reload it. Detach anything on the scene that still uses those assets first.
73
+
74
+ ### Inspecting the cache
75
+
76
+ ```ts
77
+ import { Cache } from "pixi.js";
78
+
79
+ const key = "hero.png";
80
+ if (Cache.has(key)) {
81
+ const texture = Cache.get(key);
82
+ }
83
+ ```
84
+
85
+ The low-level `Cache` class backs `Assets.get`. It exposes `has(key)`, `get(key)`, `set(key, value)`, and `remove(key)`. Most code should go through `Assets.get/unload` instead, but direct `Cache` access is useful for diagnostics or custom loader plugins.
86
+
87
+ ## Common Mistakes
88
+
89
+ ### [CRITICAL] Using `Assets.get` before `Assets.load`
90
+
91
+ Wrong:
92
+
93
+ ```ts
94
+ const texture = Assets.get("hero.png");
95
+ const sprite = new Sprite(texture); // texture is undefined
96
+ ```
97
+
98
+ Correct:
99
+
100
+ ```ts
101
+ await Assets.load("hero.png");
102
+ const texture = Assets.get("hero.png");
103
+ const sprite = new Sprite(texture);
104
+ ```
105
+
106
+ `Assets.get` is synchronous and returns `undefined` if the asset hasn't been loaded yet. Always await `Assets.load` first, or use the return value of `Assets.load` directly.
107
+
108
+
109
+ ### [HIGH] Not unloading between levels
110
+
111
+ Textures stay in the cache indefinitely. A game that loads level after level without calling `Assets.unload` or `Assets.unloadBundle` slowly accumulates GPU memory until it hits browser limits.
112
+
113
+ ```ts
114
+ await Assets.unloadBundle("level1");
115
+ await Assets.loadBundle("level2");
116
+ ```
117
+
118
+
119
+ ### [MEDIUM] Using sprites after unload
120
+
121
+ Wrong:
122
+
123
+ ```ts
124
+ const sprite = new Sprite(texture);
125
+ await Assets.unload("hero.png");
126
+ // sprite still references the destroyed texture
127
+ ```
128
+
129
+ Correct:
130
+
131
+ ```ts
132
+ sprite.destroy();
133
+ await Assets.unload("hero.png");
134
+ ```
135
+
136
+ `Assets.unload` destroys the underlying texture. Any sprite still referencing it will render Texture.EMPTY or crash depending on the backend. Destroy the leaf (or reassign its texture) before unloading.
137
+
138
+
139
+ ## API Reference
140
+
141
+ - [Assets](https://pixijs.download/release/docs/assets.Assets.html.md)
142
+ - [Cache](https://pixijs.download/release/docs/assets.Cache.html.md)
143
+ - [Texture](https://pixijs.download/release/docs/rendering.Texture.html.md)
@@ -0,0 +1,120 @@
1
+ # Compressed Textures
2
+
3
+ GPU-compressed texture formats (DDS, KTX, KTX2, Basis) use 4–8x less GPU memory than PNG/JPEG and skip runtime decoding. Use them for large textures, high-asset-count games, and anywhere memory budget matters. Each format requires a side-effect import to register its loader.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ import "pixi.js/ktx2";
9
+ import { Assets, Sprite } from "pixi.js";
10
+
11
+ const texture = await Assets.load("background.ktx2");
12
+
13
+ const bg = new Sprite(texture);
14
+ app.stage.addChild(bg);
15
+ ```
16
+
17
+ Without the side-effect import, the loader won't know how to parse the file and will skip it silently.
18
+
19
+ ## Core Patterns
20
+
21
+ ### Format imports
22
+
23
+ ```ts
24
+ import "pixi.js/dds"; // DirectDraw Surface (.dds)
25
+ import "pixi.js/ktx"; // KTX (Khronos Texture) v1
26
+ import "pixi.js/ktx2"; // KTX v2 (with Basis Universal support)
27
+ import "pixi.js/basis"; // Basis Universal (.basis)
28
+ ```
29
+
30
+ Each import registers a `LoaderParser` that can decode the matching file extension. Import only the formats you use; the loaders include decoder runtime that adds to your bundle size.
31
+
32
+ ### Format selection matrix
33
+
34
+ | Format | Platforms | Notes |
35
+ | ------ | --------- | --------------------------------------------------------------------------------------------------------------- |
36
+ | DDS | All | Legacy desktop formats (DXT, BC). Fast decoder; wide support. |
37
+ | KTX | All | Older Khronos container. Prefer KTX2 for new projects. |
38
+ | KTX2 | All | Newer container; typically used with Basis Universal. GPU-native when available. |
39
+ | Basis | All | Supercompressed; transcodes to the GPU-native format at load time. Best for "one file, any platform" workflows. |
40
+
41
+ Use KTX2 + Basis for new projects unless you have a specific need for one of the others.
42
+
43
+ ### With the resolver
44
+
45
+ ```ts
46
+ import "pixi.js/ktx2";
47
+ import { Assets } from "pixi.js";
48
+
49
+ Assets.add({
50
+ alias: "background",
51
+ src: "background.{ktx2,webp,png}",
52
+ });
53
+
54
+ const texture = await Assets.load("background");
55
+ ```
56
+
57
+ List compressed textures as first-preference format in the resolver. On browsers or hardware that can't sample the compressed format, the resolver falls back to WebP or PNG automatically.
58
+
59
+ ### Async decoding
60
+
61
+ ```ts
62
+ import "pixi.js/basis";
63
+ import { Assets } from "pixi.js";
64
+
65
+ const texture = await Assets.load("hero.basis");
66
+ ```
67
+
68
+ Basis Universal decodes asynchronously on a worker thread (where supported). You don't need to await anything beyond the normal `Assets.load`; the loader handles decoding.
69
+
70
+ ### Multiple compressed formats at once
71
+
72
+ ```ts
73
+ import "pixi.js/ktx2";
74
+ import "pixi.js/basis";
75
+ import "pixi.js/dds";
76
+ ```
77
+
78
+ Multiple format imports can coexist. Each registers an extension for its own file type. If you only use one format, import only that one to keep the bundle smaller.
79
+
80
+ ## Common Mistakes
81
+
82
+ ### [CRITICAL] Missing the format import
83
+
84
+ Wrong:
85
+
86
+ ```ts
87
+ import { Assets } from "pixi.js";
88
+ await Assets.load("background.ktx2");
89
+ ```
90
+
91
+ Correct:
92
+
93
+ ```ts
94
+ import "pixi.js/ktx2";
95
+ import { Assets } from "pixi.js";
96
+ await Assets.load("background.ktx2");
97
+ ```
98
+
99
+ Without the side-effect import, no loader parser is registered for `.ktx2` files. The load silently does nothing (or errors) and you get `undefined` back.
100
+
101
+
102
+ ### [HIGH] Relying on mipmaps from compressed textures in Canvas2D
103
+
104
+ Compressed textures require WebGL or WebGPU. The Canvas2D backend can't sample them. If you need Canvas support, include a PNG/WebP fallback via the resolver format list:
105
+
106
+ ```ts
107
+ Assets.add({ alias: "bg", src: "bg.{ktx2,png}" });
108
+ ```
109
+
110
+
111
+ ### [MEDIUM] Large Basis files in WebGL1
112
+
113
+ Basis Universal transcodes to different GPU formats based on what the device supports. On WebGL1 without extensions, some devices fall back to an uncompressed format, defeating the memory savings. Check `renderer.context.supports` for supported compressed formats if you're targeting older hardware.
114
+
115
+
116
+ ## API Reference
117
+
118
+ - [Assets](https://pixijs.download/release/docs/assets.Assets.html.md)
119
+ - [loadKTX2](https://pixijs.download/release/docs/assets.loadKTX2.html.md)
120
+ - [TextureSource](https://pixijs.download/release/docs/rendering.TextureSource.html.md)