@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,141 @@
1
+ ---
2
+ name: pixijs-scene-mesh
3
+ description: "Use this skill when rendering custom geometry in PixiJS v8. Covers Mesh with MeshGeometry (positions, uvs, indices, topology), MeshSimple for per-frame vertex animation, MeshPlane for subdivided deformation, MeshRope for path-following textures, PerspectiveMesh for 2.5D corners. Triggers on: Mesh, MeshGeometry, MeshSimple, MeshPlane, MeshRope, PerspectiveMesh, positions, uvs, indices, topology, setCorners, constructor options, MeshOptions, MeshPlaneOptions, MeshRopeOptions, SimpleMeshOptions, PerspectivePlaneOptions."
4
+ license: MIT
5
+ ---
6
+
7
+ Meshes render arbitrary 2D (or perspective-projected) geometry with a texture or custom shader. PixiJS ships the base `Mesh` class plus four specialized subclasses for common shapes: `MeshSimple`, `MeshPlane`, `MeshRope`, and `PerspectiveMesh`. Pick the subclass that matches your shape; drop to the base `Mesh` when you need full vertex-level control or a custom shader.
8
+
9
+ Assumes familiarity with `pixijs-scene-core-concepts`. Meshes are leaf nodes; they cannot have children. Wrap multiple meshes in a `Container` to group them.
10
+
11
+ ## Quick Start
12
+
13
+ ```ts
14
+ const texture = await Assets.load("pattern.png");
15
+
16
+ const geometry = new MeshGeometry({
17
+ positions: new Float32Array([0, 0, 100, 0, 100, 100, 0, 100]),
18
+ uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
19
+ indices: new Uint32Array([0, 1, 2, 0, 2, 3]),
20
+ topology: "triangle-list",
21
+ });
22
+
23
+ const mesh = new Mesh({
24
+ geometry,
25
+ texture,
26
+ roundPixels: false,
27
+ });
28
+ app.stage.addChild(mesh);
29
+ ```
30
+
31
+ Every `Mesh` subclass takes a single options object. The base `Mesh` requires a `geometry`; subclasses (`MeshSimple`, `MeshPlane`, `MeshRope`, `PerspectiveMesh`) build the geometry internally and require a `texture` instead. See each variant's reference for the full field list.
32
+
33
+ ## Variants
34
+
35
+ | Variant | Use when | Trade-offs | Reference |
36
+ | ----------------- | ----------------------------------------------------- | ------------------------------------------------------- | ---------------------------------------------------------------- |
37
+ | `Mesh` | Full control, custom geometry, custom shaders | You build the `MeshGeometry` yourself | [references/mesh.md](references/mesh.md) |
38
+ | `MeshSimple` | Quick textured shapes with per-frame vertex animation | Thin wrapper; auto-updates the vertex buffer | [references/mesh-simple.md](references/mesh-simple.md) |
39
+ | `MeshPlane` | Subdivided textured rectangle for distortion effects | Fixed topology; `verticesX`/`verticesY` control density | [references/mesh-plane.md](references/mesh-plane.md) |
40
+ | `MeshRope` | Texture following a polyline path | Bent at each point; needs many points for smooth curves | [references/mesh-rope.md](references/mesh-rope.md) |
41
+ | `PerspectiveMesh` | 2D plane with perspective corners | Not true 3D; UV-level perspective correction only | [references/mesh-perspective.md](references/mesh-perspective.md) |
42
+
43
+ ## When to use what
44
+
45
+ - **"I need a textured quad"** → `Sprite` (see `pixijs-scene-sprite`), not a mesh. Meshes are for cases Sprite can't express.
46
+ - **"I need to deform a textured rectangle"** → `MeshPlane`. Set `verticesX`/`verticesY` for the desired smoothness.
47
+ - **"I need a rope or trail that follows points"** → `MeshRope`. Control thickness with `width`; use `textureScale: 0` to stretch or `> 0` to repeat.
48
+ - **"I need a tilted 2D card or floor"** → `PerspectiveMesh`. Pass four corner positions; not real 3D but good enough for 2.5D effects.
49
+ - **"I need per-frame animated vertices with a simple shape"** → `MeshSimple`. It handles the buffer-update dance for you.
50
+ - **"I need a custom shader or unusual geometry"** → Base `Mesh` with a hand-built `MeshGeometry`. See `pixijs-custom-rendering` for shader authoring.
51
+ - **"I need true 3D rendering"** → Use a dedicated 3D library. `PerspectiveMesh` simulates perspective at the UV level but has no depth buffer.
52
+
53
+ ## Quick concepts
54
+
55
+ ### MeshGeometry owns the vertex data
56
+
57
+ `MeshGeometry` holds the `positions`, `uvs`, `indices`, and `topology`. You can share one geometry across multiple `Mesh` instances; positions are reference-counted.
58
+
59
+ ### Batching
60
+
61
+ A mesh batches (combines with other draw calls) only if it uses `MeshGeometry`, has no custom shader, no depth or culling state, and the `'auto'` rule (`batchMode = 'auto'` and ≤100 vertices). Custom shaders always render independently.
62
+
63
+ ### Topology is on the geometry, not the mesh
64
+
65
+ `new MeshGeometry({ topology: 'triangle-strip' })`; topology is a geometry property. The default is `'triangle-list'`; set it explicitly if your data is organized differently.
66
+
67
+ ### Extra knobs
68
+
69
+ - `new MeshGeometry({ shrinkBuffersToFit: true })` — trims GPU buffer storage to the actual vertex count on creation. Use it when feeding large, one-shot geometries.
70
+ - `Mesh.containsPoint(point)` — topology-aware hit test that walks the triangles. Works with any `MeshGeometry`, including custom layouts.
71
+ - `new Mesh({ geometry, state })` — pass a `State` object to control blend, depth, and culling. Batching is disabled automatically if depth or culling flags are set. Defaults to `State.for2d()` when omitted.
72
+
73
+ ## Common Mistakes
74
+
75
+ ### [HIGH] Using old `SimpleMesh` / `SimplePlane` / `SimpleRope` names
76
+
77
+ Wrong:
78
+
79
+ ```ts
80
+ import { SimpleRope } from "pixi.js";
81
+ const rope = new SimpleRope(texture, points);
82
+ ```
83
+
84
+ Correct:
85
+
86
+ ```ts
87
+ import { MeshRope } from "pixi.js";
88
+ const rope = new MeshRope({ texture, points });
89
+ ```
90
+
91
+ Renamed in v8: `SimpleMesh` → `MeshSimple`, `SimplePlane` → `MeshPlane`, `SimpleRope` → `MeshRope`. All switched to options-object constructors.
92
+
93
+
94
+ ### [HIGH] Positional constructor args for `MeshGeometry`
95
+
96
+ Wrong:
97
+
98
+ ```ts
99
+ const geom = new MeshGeometry(vertices, uvs, indices);
100
+ ```
101
+
102
+ Correct:
103
+
104
+ ```ts
105
+ const geom = new MeshGeometry({
106
+ positions: vertices,
107
+ uvs,
108
+ indices,
109
+ topology: "triangle-list",
110
+ });
111
+ ```
112
+
113
+ v8 uses an options object. Note the property is `positions`, not `vertices`; the `vertices` name is only used by `MeshSimple`.
114
+
115
+
116
+ ### [MEDIUM] Adding children to a mesh
117
+
118
+ Wrong:
119
+
120
+ ```ts
121
+ mesh.addChild(otherMesh);
122
+ ```
123
+
124
+ Correct:
125
+
126
+ ```ts
127
+ const group = new Container();
128
+ group.addChild(mesh, otherMesh);
129
+ ```
130
+
131
+ `Mesh` sets `allowChildren = false`. Adding children logs a deprecation warning. Group meshes inside a plain `Container`.
132
+
133
+
134
+ ## API Reference
135
+
136
+ - [Mesh](https://pixijs.download/release/docs/scene.Mesh.html.md)
137
+ - [MeshGeometry](https://pixijs.download/release/docs/scene.MeshGeometry.html.md)
138
+ - [MeshSimple](https://pixijs.download/release/docs/scene.MeshSimple.html.md)
139
+ - [MeshPlane](https://pixijs.download/release/docs/scene.MeshPlane.html.md)
140
+ - [MeshRope](https://pixijs.download/release/docs/scene.MeshRope.html.md)
141
+ - [PerspectiveMesh](https://pixijs.download/release/docs/scene.PerspectiveMesh.html.md)
@@ -0,0 +1,189 @@
1
+ # PerspectiveMesh
2
+
3
+ A mesh that renders a textured plane with perspective projection via four corner points. The UV interpolation is computed per vertex in a subdivided grid, so the more vertices you allocate, the smoother the projection. Use `PerspectiveMesh` for 2D billboards, floor planes, angled cards, fake 3D layouts, or anywhere you want a texture to appear tilted into the scene.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ const texture = await Assets.load("card.png");
9
+
10
+ const mesh = new PerspectiveMesh({
11
+ texture,
12
+ verticesX: 20,
13
+ verticesY: 20,
14
+ x0: 0,
15
+ y0: 0, // top-left
16
+ x1: 300,
17
+ y1: 30, // top-right (raised)
18
+ x2: 280,
19
+ y2: 300, // bottom-right
20
+ x3: 20,
21
+ y3: 280, // bottom-left
22
+ });
23
+
24
+ app.stage.addChild(mesh);
25
+ ```
26
+
27
+ The four corner coordinates define a quadrilateral in local space; the mesh warps the texture to fit it with perspective-correct UVs.
28
+
29
+ ## Constructor options
30
+
31
+ `new PerspectiveMesh(options: PerspectivePlaneOptions)`
32
+
33
+ > Note: the interface is `PerspectivePlaneOptions`, not `PerspectiveMeshOptions`. It extends `MeshPlaneOptions`.
34
+
35
+ | Option | Type | Default | Description |
36
+ | ----------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------- |
37
+ | `texture` | `Texture` | `Texture.WHITE` | Texture warped onto the quad. Inherited from `MeshPlaneOptions`; also drives the geometry's initial `width`/`height`. |
38
+ | `verticesX` | `number` | `10` | Grid columns. More vertices yield smoother perspective at higher draw cost. |
39
+ | `verticesY` | `number` | `10` | Grid rows. More vertices yield smoother perspective at higher draw cost. |
40
+ | `x0` | `number` | `0` | Top-left corner x. |
41
+ | `y0` | `number` | `0` | Top-left corner y. |
42
+ | `x1` | `number` | `100` | Top-right corner x. |
43
+ | `y1` | `number` | `0` | Top-right corner y. |
44
+ | `x2` | `number` | `100` | Bottom-right corner x. |
45
+ | `y2` | `number` | `100` | Bottom-right corner y. |
46
+ | `x3` | `number` | `0` | Bottom-left corner x. |
47
+ | `y3` | `number` | `100` | Bottom-left corner y. |
48
+
49
+ Corners must be listed clockwise from the top-left. Defaults form a 100x100 square with `Texture.WHITE`; `PerspectiveMesh.defaultOptions` overrides them globally. The constructor omits `geometry` (it builds its own `PerspectivePlaneGeometry`). Other `MeshOptions` fields (`shader`, `state`, `roundPixels`) are inherited from `mesh.md`.
50
+
51
+ All `Container` options (`position`, `scale`, `tint`, `label`, `filters`, `zIndex`, etc.) are also valid here — see `skills/pixijs-scene-core-concepts/references/constructor-options.md`.
52
+
53
+ Call `mesh.setCorners(x0, y0, x1, y1, x2, y2, x3, y3)` at runtime to animate the warp.
54
+
55
+ ## Core Patterns
56
+
57
+ ### Corner order
58
+
59
+ ```ts
60
+ mesh.setCorners(
61
+ 0,
62
+ 0, // top-left (x0, y0)
63
+ 200,
64
+ 0, // top-right (x1, y1)
65
+ 200,
66
+ 200, // bottom-right(x2, y2)
67
+ 0,
68
+ 200, // bottom-left (x3, y3)
69
+ );
70
+ ```
71
+
72
+ Corners must be specified clockwise starting from the top-left. `setCorners` updates the geometry in place; use it for animation.
73
+
74
+ ### Animated perspective
75
+
76
+ ```ts
77
+ const mesh = new PerspectiveMesh({
78
+ texture,
79
+ verticesX: 20,
80
+ verticesY: 20,
81
+ });
82
+
83
+ app.ticker.add(() => {
84
+ const t = performance.now() / 1000;
85
+ const wave = Math.sin(t) * 30;
86
+
87
+ mesh.setCorners(0, wave, 200, -wave, 200, 200, 0, 200);
88
+ });
89
+ ```
90
+
91
+ Call `setCorners` each frame to animate the warp. The geometry recalculates perspective-correct UVs automatically.
92
+
93
+ ### Vertex density vs quality
94
+
95
+ ```ts
96
+ const coarse = new PerspectiveMesh({ texture, verticesX: 5, verticesY: 5 });
97
+ const smooth = new PerspectiveMesh({ texture, verticesX: 30, verticesY: 30 });
98
+ ```
99
+
100
+ The number of vertices controls how smooth the perspective projection looks. A 5×5 grid shows obvious triangular stretching; 20×20 is a good default; 30×30+ is smooth but adds draw overhead. Each axis defaults to `10`.
101
+
102
+ ### Fake floor
103
+
104
+ ```ts
105
+ const floor = new PerspectiveMesh({
106
+ texture: floorTex,
107
+ verticesX: 20,
108
+ verticesY: 20,
109
+ x0: 200,
110
+ y0: 300, // near left on screen
111
+ x1: 600,
112
+ y1: 300, // near right
113
+ x2: 800,
114
+ y2: 200, // far right
115
+ x3: 0,
116
+ y3: 200, // far left
117
+ });
118
+
119
+ app.stage.addChild(floor);
120
+ ```
121
+
122
+ Put the "far" corners higher on the screen and closer together than the "near" corners to create a floor-extending-into-the-distance effect. Use with a scrolling TilingSprite above for a stylized 2D driving game.
123
+
124
+ ### Updating the texture
125
+
126
+ ```ts
127
+ mesh.texture = await Assets.load("new-card.png");
128
+ ```
129
+
130
+ Changing the texture rebuilds the geometry to match the new dimensions while keeping the current corner positions. The perspective projection persists through texture swaps.
131
+
132
+ ## Common Mistakes
133
+
134
+ ### [HIGH] Expecting true 3D
135
+
136
+ `PerspectiveMesh` is a 2D mesh with UV correction to simulate perspective. There is no Z axis, no depth buffer, and no camera. For real 3D, use a full WebGL/WebGPU library on top of PixiJS, or drive vertex positions through a manual transform.
137
+
138
+
139
+ ### [MEDIUM] Too few vertices for a noticeable tilt
140
+
141
+ Wrong:
142
+
143
+ ```ts
144
+ const mesh = new PerspectiveMesh({
145
+ texture,
146
+ verticesX: 2,
147
+ verticesY: 2,
148
+ x0: 0,
149
+ y0: 0,
150
+ x1: 300,
151
+ y1: 50,
152
+ x2: 280,
153
+ y2: 250,
154
+ x3: 20,
155
+ y3: 200,
156
+ });
157
+ ```
158
+
159
+ Correct:
160
+
161
+ ```ts
162
+ const mesh = new PerspectiveMesh({
163
+ texture,
164
+ verticesX: 20,
165
+ verticesY: 20,
166
+ x0: 0,
167
+ y0: 0,
168
+ x1: 300,
169
+ y1: 50,
170
+ x2: 280,
171
+ y2: 250,
172
+ x3: 20,
173
+ y3: 200,
174
+ });
175
+ ```
176
+
177
+ A 2×2 grid has only two triangles; the texture stretches linearly with no perspective correction. Bump density above 10×10 for any visible tilt.
178
+
179
+
180
+ ### [MEDIUM] Non-convex corners
181
+
182
+ If your four corners form a non-convex (self-intersecting or bow-tie) quadrilateral, the UV interpolation produces visual artifacts. Keep the corners in consistent clockwise order and check that the quad is convex.
183
+
184
+
185
+ ## API Reference
186
+
187
+ - [PerspectiveMesh](https://pixijs.download/release/docs/scene.PerspectiveMesh.html.md)
188
+ - [PerspectivePlaneOptions](https://pixijs.download/release/docs/scene.PerspectivePlaneOptions.html.md)
189
+ - [MeshPlane](https://pixijs.download/release/docs/scene.MeshPlane.html.md)
@@ -0,0 +1,159 @@
1
+ # MeshPlane
2
+
3
+ A mesh that maps a texture onto a subdivided plane with configurable vertex density. Use `MeshPlane` for distortion effects, wave simulations, cloth, heat haze, or any effect that needs per-vertex deformation of a flat textured rectangle.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ const texture = await Assets.load("background.png");
9
+
10
+ const plane = new MeshPlane({
11
+ texture,
12
+ verticesX: 10,
13
+ verticesY: 10,
14
+ });
15
+
16
+ app.stage.addChild(plane);
17
+ ```
18
+
19
+ `verticesX` / `verticesY` control the grid density (each defaults to `10`). More vertices give smoother deformation at higher draw overhead. The plane sizes itself to the texture by default.
20
+
21
+ ## Constructor options
22
+
23
+ `new MeshPlane(options: MeshPlaneOptions)`
24
+
25
+ | Option | Type | Default | Description |
26
+ | ----------- | --------- | ------- | ---------------------------------------------------------------------------------- |
27
+ | `texture` | `Texture` | — | Texture mapped onto the plane. Required; also drives the initial `width`/`height`. |
28
+ | `verticesX` | `number` | `10` | Grid columns. Higher values yield smoother deformation at higher draw cost. |
29
+ | `verticesY` | `number` | `10` | Grid rows. Higher values yield smoother deformation at higher draw cost. |
30
+
31
+ `MeshPlane` builds its own `PlaneGeometry`, so you cannot pass `geometry` — it is omitted from the options type. Other `MeshOptions` fields (`shader`, `state`, `roundPixels`) are inherited from `mesh.md` and behave identically.
32
+
33
+ All `Container` options (`position`, `scale`, `tint`, `label`, `filters`, `zIndex`, etc.) are also valid here — see `skills/pixijs-scene-core-concepts/references/constructor-options.md`.
34
+
35
+ `autoResize` is a runtime property set to `true` by the constructor, not a constructor option. Toggle it after construction to control whether texture changes rebuild the plane geometry.
36
+
37
+ ## Core Patterns
38
+
39
+ ### Deforming the vertex grid
40
+
41
+ ```ts
42
+ const { buffer } = plane.geometry.getAttribute("aPosition");
43
+
44
+ app.ticker.add(() => {
45
+ for (let i = 0; i < buffer.data.length; i++) {
46
+ buffer.data[i] += Math.sin(performance.now() / 1000 + i) * 0.3;
47
+ }
48
+ buffer.update();
49
+ });
50
+ ```
51
+
52
+ Grab the position buffer via `getAttribute('aPosition')`, mutate the `data` array, then call `buffer.update()` to push changes to the GPU. The texture UVs are fixed once the plane is built, so as long as you only move vertices (not change the grid topology), the texture stretches to follow.
53
+
54
+ ### Auto-resize on texture change
55
+
56
+ ```ts
57
+ plane.texture = await Assets.load("new-background.png");
58
+ ```
59
+
60
+ `autoResize` defaults to `true`. When the plane's texture changes (or emits an `'update'` event), the geometry rebuilds to match the new texture dimensions. Set `autoResize = false` to keep the original size regardless of the new texture.
61
+
62
+ ### Fixed-size plane
63
+
64
+ ```ts
65
+ const fixedPlane = new MeshPlane({
66
+ texture,
67
+ verticesX: 20,
68
+ verticesY: 20,
69
+ });
70
+ fixedPlane.autoResize = false;
71
+
72
+ const geometry = fixedPlane.geometry;
73
+ geometry.width = 500;
74
+ geometry.height = 300;
75
+ geometry.build({});
76
+ ```
77
+
78
+ For a plane whose size is decoupled from the texture, disable `autoResize` and set the geometry's `width` / `height` explicitly. Call `build({})` to regenerate vertex positions at the new size.
79
+
80
+ ### Higher vertex density for smooth distortion
81
+
82
+ ```ts
83
+ const smooth = new MeshPlane({
84
+ texture,
85
+ verticesX: 40,
86
+ verticesY: 40,
87
+ });
88
+ ```
89
+
90
+ Vertex density directly controls how smoothly the plane can deform. A 10×10 grid is fine for coarse ripples; for waves, cloth, or fine distortion, bump density to 20×20 or higher. Density above ~50×50 starts to affect draw overhead on lower-end devices.
91
+
92
+ ### Wave animation
93
+
94
+ ```ts
95
+ const plane = new MeshPlane({ texture, verticesX: 30, verticesY: 30 });
96
+ const { buffer } = plane.geometry.getAttribute("aPosition");
97
+ const original = new Float32Array(buffer.data);
98
+
99
+ app.ticker.add((ticker) => {
100
+ const t = performance.now() / 500;
101
+ for (let i = 0; i < buffer.data.length; i += 2) {
102
+ buffer.data[i] = original[i];
103
+ buffer.data[i + 1] = original[i + 1] + Math.sin(t + original[i] * 0.1) * 5;
104
+ }
105
+ buffer.update();
106
+ });
107
+ ```
108
+
109
+ Cache the original positions once, then offset from them each frame. Resetting to the base positions each frame avoids cumulative drift.
110
+
111
+ ## Common Mistakes
112
+
113
+ ### [HIGH] Using the old `SimplePlane` name
114
+
115
+ Wrong:
116
+
117
+ ```ts
118
+ import { SimplePlane } from "pixi.js";
119
+ const plane = new SimplePlane(texture, 10, 10);
120
+ ```
121
+
122
+ Correct:
123
+
124
+ ```ts
125
+ import { MeshPlane } from "pixi.js";
126
+ const plane = new MeshPlane({ texture, verticesX: 10, verticesY: 10 });
127
+ ```
128
+
129
+ `SimplePlane` was renamed to `MeshPlane` in v8 and switched to an options-object constructor.
130
+
131
+
132
+ ### [MEDIUM] Mutating positions without calling `buffer.update()`
133
+
134
+ Wrong:
135
+
136
+ ```ts
137
+ buffer.data[1] = 50;
138
+ ```
139
+
140
+ Correct:
141
+
142
+ ```ts
143
+ buffer.data[1] = 50;
144
+ buffer.update();
145
+ ```
146
+
147
+ The buffer does not observe its own `data` array. Without `update()`, the changes stay on the CPU and the next render draws stale vertex data.
148
+
149
+
150
+ ### [MEDIUM] High vertex density on pixel-art textures
151
+
152
+ A dense grid on a small pixel-art texture can cause visible UV interpolation artifacts. Use fewer vertices (10×10 or less) for pixel art, or set `roundPixels: true` on the mesh.
153
+
154
+
155
+ ## API Reference
156
+
157
+ - [MeshPlane](https://pixijs.download/release/docs/scene.MeshPlane.html.md)
158
+ - [MeshPlaneOptions](https://pixijs.download/release/docs/scene.MeshPlaneOptions.html.md)
159
+ - [PlaneGeometry](https://pixijs.download/release/docs/scene.PlaneGeometry.html.md)
@@ -0,0 +1,176 @@
1
+ # MeshRope
2
+
3
+ A mesh that renders a texture along a path defined by points. Each segment bends the texture to follow the curve. Use `MeshRope` for ropes, chains, snakes, trails, whip effects, tentacles, and any effect where you want a textured ribbon that follows a moving polyline.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ const texture = await Assets.load("rope.png");
9
+
10
+ const points = [];
11
+ for (let i = 0; i < 20; i++) {
12
+ points.push(new Point(i * 50, 0));
13
+ }
14
+
15
+ const rope = new MeshRope({
16
+ texture,
17
+ points,
18
+ textureScale: 0,
19
+ width: texture.height,
20
+ });
21
+ app.stage.addChild(rope);
22
+
23
+ app.ticker.add(() => {
24
+ const t = performance.now() / 500;
25
+ for (let i = 0; i < points.length; i++) {
26
+ points[i].y = Math.sin(i * 0.5 + t) * 30;
27
+ }
28
+ });
29
+ ```
30
+
31
+ The rope uses the y-axis of the texture as its thickness and stretches the x-axis along the path. Move points each frame; with `autoUpdate` enabled (default), the geometry updates automatically.
32
+
33
+ ## Constructor options
34
+
35
+ `new MeshRope(options: MeshRopeOptions)`
36
+
37
+ | Option | Type | Default | Description |
38
+ | -------------- | ------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
39
+ | `texture` | `Texture` | — | Texture sampled along the rope. Required. |
40
+ | `points` | `PointData[]` | — | Ordered path the rope follows. Required. Each entry bends the texture; more points yield smoother curves. |
41
+ | `textureScale` | `number` | `0` | `0` stretches the texture across the full length. Positive values repeat the texture while preserving aspect ratio and switch the source's `addressMode` to `'repeat'`. Values `< 1` with a larger source reduce alpha artifacts. |
42
+ | `width` | `number` | `texture.height` | Rope thickness. Defaults to the texture height when omitted. |
43
+
44
+ `MeshRope` builds its own `RopeGeometry`, so `geometry` is omitted from the options type. Other `MeshOptions` fields (`shader`, `state`, `roundPixels`) are inherited from `mesh.md` and behave identically.
45
+
46
+ All `Container` options (`position`, `scale`, `tint`, `label`, `filters`, `zIndex`, etc.) are also valid here — see `skills/pixijs-scene-core-concepts/references/constructor-options.md`.
47
+
48
+ `autoUpdate` is a runtime property (defaults to `true`), not a constructor option. Set `rope.autoUpdate = false` after construction to control when the geometry recomputes from the points. `MeshRope.defaultOptions` overrides the `textureScale` default globally.
49
+
50
+ ## Core Patterns
51
+
52
+ ### `textureScale`: stretch vs repeat
53
+
54
+ ```ts
55
+ // stretch (default); entire texture maps across the rope
56
+ const stretched = new MeshRope({ texture, points, textureScale: 0 });
57
+
58
+ // repeat; texture tiles along the rope, preserving aspect ratio
59
+ const repeated = new MeshRope({ texture, points, textureScale: 1 });
60
+
61
+ // higher resolution; downsample an HD texture for better quality
62
+ const sharp = new MeshRope({ texture: hdRope, points, textureScale: 0.5 });
63
+ ```
64
+
65
+ - `textureScale: 0` (default): stretches the texture across the full rope length.
66
+ - `textureScale > 0`: repeats the texture while preserving its aspect ratio. The underlying texture source has its `addressMode` set to `'repeat'`. Power-of-two textures are recommended for WebGL compatibility.
67
+ - `textureScale < 1` with a larger source texture reduces alpha-channel artifacts.
68
+
69
+ ### Rope width
70
+
71
+ ```ts
72
+ const thick = new MeshRope({
73
+ texture,
74
+ points,
75
+ width: 60,
76
+ });
77
+ ```
78
+
79
+ `width` (thickness) defaults to `texture.height`. Override it for a rope narrower or wider than the source art.
80
+
81
+ ### Manual update mode
82
+
83
+ ```ts
84
+ const rope = new MeshRope({ texture, points });
85
+ rope.autoUpdate = false;
86
+
87
+ app.ticker.add(() => {
88
+ for (let i = 0; i < points.length; i++) {
89
+ points[i].y = Math.sin(i + performance.now() / 1000) * 30;
90
+ }
91
+ (rope.geometry as RopeGeometry).update();
92
+ });
93
+ ```
94
+
95
+ Set `autoUpdate = false` to control when the geometry recomputes from the points. Useful when your point array only changes occasionally, or when you want to update once per multiple frames for performance.
96
+
97
+ ### Trail effect
98
+
99
+ ```ts
100
+ const trailPoints: Point[] = [];
101
+ for (let i = 0; i < 30; i++) {
102
+ trailPoints.push(new Point(0, 0));
103
+ }
104
+
105
+ const trail = new MeshRope({
106
+ texture: trailTex,
107
+ points: trailPoints,
108
+ textureScale: 0,
109
+ });
110
+ app.stage.addChild(trail);
111
+
112
+ app.ticker.add(() => {
113
+ for (let i = trailPoints.length - 1; i > 0; i--) {
114
+ trailPoints[i].x = trailPoints[i - 1].x;
115
+ trailPoints[i].y = trailPoints[i - 1].y;
116
+ }
117
+ trailPoints[0].x = mouseX;
118
+ trailPoints[0].y = mouseY;
119
+ });
120
+ ```
121
+
122
+ A simple tail effect: shift all points one slot down each frame, then write the new head. Stretch texture mode (`textureScale: 0`) makes the full texture visible along the trail regardless of length.
123
+
124
+ ## Common Mistakes
125
+
126
+ ### [HIGH] Using the old `SimpleRope` or `Rope` name
127
+
128
+ Wrong:
129
+
130
+ ```ts
131
+ import { SimpleRope } from "pixi.js";
132
+ const rope = new SimpleRope(texture, points);
133
+ ```
134
+
135
+ Correct:
136
+
137
+ ```ts
138
+ import { MeshRope } from "pixi.js";
139
+ const rope = new MeshRope({ texture, points });
140
+ ```
141
+
142
+ `SimpleRope` was renamed to `MeshRope` in v8 and switched to an options-object constructor.
143
+
144
+
145
+ ### [HIGH] Too few points for a smooth curve
146
+
147
+ Wrong:
148
+
149
+ ```ts
150
+ const rope = new MeshRope({
151
+ texture,
152
+ points: [new Point(0, 0), new Point(400, 0)],
153
+ });
154
+ ```
155
+
156
+ Correct:
157
+
158
+ ```ts
159
+ const points = [];
160
+ for (let i = 0; i < 20; i++) points.push(new Point(i * 20, 0));
161
+ const rope = new MeshRope({ texture, points });
162
+ ```
163
+
164
+ The rope only bends at point boundaries. Two points produce a straight segment; a curved rope needs many closely-spaced points (typically 15–30 for a visible bend).
165
+
166
+
167
+ ### [MEDIUM] Non-power-of-two texture with `textureScale > 0`
168
+
169
+ When `textureScale` is positive, the rope sets the texture source's `addressMode` to `'repeat'`. Some WebGL drivers clamp non-power-of-two textures instead of wrapping, causing the tile pattern to stretch. Resize the source to power-of-two dimensions (128, 256, 512, etc.) for reliable wrapping.
170
+
171
+
172
+ ## API Reference
173
+
174
+ - [MeshRope](https://pixijs.download/release/docs/scene.MeshRope.html.md)
175
+ - [MeshRopeOptions](https://pixijs.download/release/docs/scene.MeshRopeOptions.html.md)
176
+ - [RopeGeometry](https://pixijs.download/release/docs/scene.RopeGeometry.html.md)