@autoaiai/aicut 0.1.7 → 0.1.13

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 (306) hide show
  1. package/MANUAL.md +94 -84
  2. package/package.json +1 -1
  3. package/product.json +2 -1
  4. package/skills/aicut/SKILL.md +4 -4
  5. package/skills/aicut/references/commands.md +15 -15
  6. package/skills/aicut/references/film-format.md +1 -1
  7. package/skills/aicut/references/recipes.md +4 -4
  8. package/skills/aicut/references/troubleshooting.md +2 -2
  9. package/skills/aicut-motion/SKILL.md +75 -9
  10. package/skills/aicut-motion/THIRD_PARTY_NOTICES.md +14 -0
  11. package/skills/aicut-motion/assets/atlas/lib/harness.js +116 -0
  12. package/skills/aicut-motion/assets/atlas/lib/sound.js +274 -0
  13. package/skills/aicut-motion/assets/atlas/styles/001-flat-vector-science/code.js +937 -0
  14. package/skills/aicut-motion/assets/atlas/styles/001-flat-vector-science/poster.jpg +0 -0
  15. package/skills/aicut-motion/assets/atlas/styles/001-flat-vector-science/style.json +13 -0
  16. package/skills/aicut-motion/assets/atlas/styles/002-watercolor-wash/code.js +909 -0
  17. package/skills/aicut-motion/assets/atlas/styles/002-watercolor-wash/poster.jpg +0 -0
  18. package/skills/aicut-motion/assets/atlas/styles/002-watercolor-wash/style.json +13 -0
  19. package/skills/aicut-motion/assets/atlas/styles/003-shadow-puppet-theatre/code.js +881 -0
  20. package/skills/aicut-motion/assets/atlas/styles/003-shadow-puppet-theatre/poster.jpg +0 -0
  21. package/skills/aicut-motion/assets/atlas/styles/003-shadow-puppet-theatre/style.json +13 -0
  22. package/skills/aicut-motion/assets/atlas/styles/004-whiteboard-explainer/code.js +897 -0
  23. package/skills/aicut-motion/assets/atlas/styles/004-whiteboard-explainer/poster.jpg +0 -0
  24. package/skills/aicut-motion/assets/atlas/styles/004-whiteboard-explainer/style.json +13 -0
  25. package/skills/aicut-motion/assets/atlas/styles/005-psychedelic-poster/code.js +814 -0
  26. package/skills/aicut-motion/assets/atlas/styles/005-psychedelic-poster/poster.jpg +0 -0
  27. package/skills/aicut-motion/assets/atlas/styles/005-psychedelic-poster/style.json +13 -0
  28. package/skills/aicut-motion/assets/atlas/styles/006-tech-glow-explainer/code.js +990 -0
  29. package/skills/aicut-motion/assets/atlas/styles/006-tech-glow-explainer/poster.jpg +0 -0
  30. package/skills/aicut-motion/assets/atlas/styles/006-tech-glow-explainer/style.json +13 -0
  31. package/skills/aicut-motion/assets/atlas/styles/007-papercraft-models/code.js +994 -0
  32. package/skills/aicut-motion/assets/atlas/styles/007-papercraft-models/poster.jpg +0 -0
  33. package/skills/aicut-motion/assets/atlas/styles/007-papercraft-models/style.json +13 -0
  34. package/skills/aicut-motion/assets/atlas/styles/008-1940s-film-noir/code.js +792 -0
  35. package/skills/aicut-motion/assets/atlas/styles/008-1940s-film-noir/poster.jpg +0 -0
  36. package/skills/aicut-motion/assets/atlas/styles/008-1940s-film-noir/style.json +13 -0
  37. package/skills/aicut-motion/assets/atlas/styles/009-manim-style-math/code.js +840 -0
  38. package/skills/aicut-motion/assets/atlas/styles/009-manim-style-math/poster.jpg +0 -0
  39. package/skills/aicut-motion/assets/atlas/styles/009-manim-style-math/style.json +13 -0
  40. package/skills/aicut-motion/assets/atlas/styles/010-illuminated-manuscript/code.js +1126 -0
  41. package/skills/aicut-motion/assets/atlas/styles/010-illuminated-manuscript/poster.jpg +0 -0
  42. package/skills/aicut-motion/assets/atlas/styles/010-illuminated-manuscript/style.json +13 -0
  43. package/skills/aicut-motion/assets/atlas/styles/011-editorial-essay-collage/code.js +854 -0
  44. package/skills/aicut-motion/assets/atlas/styles/011-editorial-essay-collage/poster.jpg +0 -0
  45. package/skills/aicut-motion/assets/atlas/styles/011-editorial-essay-collage/style.json +13 -0
  46. package/skills/aicut-motion/assets/atlas/styles/012-bioluminescent-deep-sea/code.js +1124 -0
  47. package/skills/aicut-motion/assets/atlas/styles/012-bioluminescent-deep-sea/poster.jpg +0 -0
  48. package/skills/aicut-motion/assets/atlas/styles/012-bioluminescent-deep-sea/style.json +13 -0
  49. package/skills/aicut-motion/assets/atlas/styles/013-product-launch-reveal/code.js +728 -0
  50. package/skills/aicut-motion/assets/atlas/styles/013-product-launch-reveal/poster.jpg +0 -0
  51. package/skills/aicut-motion/assets/atlas/styles/013-product-launch-reveal/style.json +13 -0
  52. package/skills/aicut-motion/assets/atlas/styles/014-halftone-pop-panel/code.js +664 -0
  53. package/skills/aicut-motion/assets/atlas/styles/014-halftone-pop-panel/poster.jpg +0 -0
  54. package/skills/aicut-motion/assets/atlas/styles/014-halftone-pop-panel/style.json +13 -0
  55. package/skills/aicut-motion/assets/atlas/styles/015-isometric-pastel/code.js +991 -0
  56. package/skills/aicut-motion/assets/atlas/styles/015-isometric-pastel/poster.jpg +0 -0
  57. package/skills/aicut-motion/assets/atlas/styles/015-isometric-pastel/style.json +13 -0
  58. package/skills/aicut-motion/assets/atlas/styles/016-oscilloscope-vector-art/code.js +801 -0
  59. package/skills/aicut-motion/assets/atlas/styles/016-oscilloscope-vector-art/poster.jpg +0 -0
  60. package/skills/aicut-motion/assets/atlas/styles/016-oscilloscope-vector-art/style.json +13 -0
  61. package/skills/aicut-motion/assets/atlas/styles/017-risograph-zine/code.js +692 -0
  62. package/skills/aicut-motion/assets/atlas/styles/017-risograph-zine/poster.jpg +0 -0
  63. package/skills/aicut-motion/assets/atlas/styles/017-risograph-zine/style.json +13 -0
  64. package/skills/aicut-motion/assets/atlas/styles/018-claymation-set/code.js +756 -0
  65. package/skills/aicut-motion/assets/atlas/styles/018-claymation-set/poster.jpg +0 -0
  66. package/skills/aicut-motion/assets/atlas/styles/018-claymation-set/style.json +13 -0
  67. package/skills/aicut-motion/assets/atlas/styles/019-neon-sign-at-night/code.js +922 -0
  68. package/skills/aicut-motion/assets/atlas/styles/019-neon-sign-at-night/poster.jpg +0 -0
  69. package/skills/aicut-motion/assets/atlas/styles/019-neon-sign-at-night/style.json +13 -0
  70. package/skills/aicut-motion/assets/atlas/styles/020-kawaii-anime/code.js +852 -0
  71. package/skills/aicut-motion/assets/atlas/styles/020-kawaii-anime/poster.jpg +0 -0
  72. package/skills/aicut-motion/assets/atlas/styles/020-kawaii-anime/style.json +13 -0
  73. package/skills/aicut-motion/assets/atlas/styles/021-ukiyo-e-woodblock/code.js +724 -0
  74. package/skills/aicut-motion/assets/atlas/styles/021-ukiyo-e-woodblock/poster.jpg +0 -0
  75. package/skills/aicut-motion/assets/atlas/styles/021-ukiyo-e-woodblock/style.json +13 -0
  76. package/skills/aicut-motion/assets/atlas/styles/022-16-bit-pixel-odyssey/code.js +793 -0
  77. package/skills/aicut-motion/assets/atlas/styles/022-16-bit-pixel-odyssey/poster.jpg +0 -0
  78. package/skills/aicut-motion/assets/atlas/styles/022-16-bit-pixel-odyssey/style.json +13 -0
  79. package/skills/aicut-motion/assets/atlas/styles/023-chalkboard-lesson/code.js +846 -0
  80. package/skills/aicut-motion/assets/atlas/styles/023-chalkboard-lesson/poster.jpg +0 -0
  81. package/skills/aicut-motion/assets/atlas/styles/023-chalkboard-lesson/style.json +13 -0
  82. package/skills/aicut-motion/assets/atlas/styles/024-cut-paper-diorama/code.js +1008 -0
  83. package/skills/aicut-motion/assets/atlas/styles/024-cut-paper-diorama/poster.jpg +0 -0
  84. package/skills/aicut-motion/assets/atlas/styles/024-cut-paper-diorama/style.json +13 -0
  85. package/skills/aicut-motion/assets/atlas/styles/025-cathedral-glass/code.js +680 -0
  86. package/skills/aicut-motion/assets/atlas/styles/025-cathedral-glass/poster.jpg +0 -0
  87. package/skills/aicut-motion/assets/atlas/styles/025-cathedral-glass/style.json +13 -0
  88. package/skills/aicut-motion/assets/atlas/styles/026-editorial-chart/code.js +633 -0
  89. package/skills/aicut-motion/assets/atlas/styles/026-editorial-chart/poster.jpg +0 -0
  90. package/skills/aicut-motion/assets/atlas/styles/026-editorial-chart/style.json +13 -0
  91. package/skills/aicut-motion/assets/atlas/styles/027-synthwave-outrun/code.js +757 -0
  92. package/skills/aicut-motion/assets/atlas/styles/027-synthwave-outrun/poster.jpg +0 -0
  93. package/skills/aicut-motion/assets/atlas/styles/027-synthwave-outrun/style.json +13 -0
  94. package/skills/aicut-motion/assets/atlas/styles/028-origami-studio/code.js +828 -0
  95. package/skills/aicut-motion/assets/atlas/styles/028-origami-studio/poster.jpg +0 -0
  96. package/skills/aicut-motion/assets/atlas/styles/028-origami-studio/style.json +13 -0
  97. package/skills/aicut-motion/assets/atlas/styles/029-linocut-relief-print/code.js +697 -0
  98. package/skills/aicut-motion/assets/atlas/styles/029-linocut-relief-print/poster.jpg +0 -0
  99. package/skills/aicut-motion/assets/atlas/styles/029-linocut-relief-print/style.json +13 -0
  100. package/skills/aicut-motion/assets/atlas/styles/030-holographic-foil-card/code.js +687 -0
  101. package/skills/aicut-motion/assets/atlas/styles/030-holographic-foil-card/poster.jpg +0 -0
  102. package/skills/aicut-motion/assets/atlas/styles/030-holographic-foil-card/style.json +13 -0
  103. package/skills/aicut-motion/assets/atlas/styles/031-voxel-diorama/code.js +727 -0
  104. package/skills/aicut-motion/assets/atlas/styles/031-voxel-diorama/poster.jpg +0 -0
  105. package/skills/aicut-motion/assets/atlas/styles/031-voxel-diorama/style.json +13 -0
  106. package/skills/aicut-motion/assets/atlas/styles/032-sumi-e-ink-wash/code.js +903 -0
  107. package/skills/aicut-motion/assets/atlas/styles/032-sumi-e-ink-wash/poster.jpg +0 -0
  108. package/skills/aicut-motion/assets/atlas/styles/032-sumi-e-ink-wash/style.json +13 -0
  109. package/skills/aicut-motion/assets/atlas/styles/033-etch-a-sketch-toy/code.js +662 -0
  110. package/skills/aicut-motion/assets/atlas/styles/033-etch-a-sketch-toy/poster.jpg +0 -0
  111. package/skills/aicut-motion/assets/atlas/styles/033-etch-a-sketch-toy/style.json +13 -0
  112. package/skills/aicut-motion/assets/atlas/styles/034-cosmic-star-chart/code.js +951 -0
  113. package/skills/aicut-motion/assets/atlas/styles/034-cosmic-star-chart/poster.jpg +0 -0
  114. package/skills/aicut-motion/assets/atlas/styles/034-cosmic-star-chart/style.json +13 -0
  115. package/skills/aicut-motion/assets/atlas/styles/035-punk-zine-collage/code.js +759 -0
  116. package/skills/aicut-motion/assets/atlas/styles/035-punk-zine-collage/poster.jpg +0 -0
  117. package/skills/aicut-motion/assets/atlas/styles/035-punk-zine-collage/style.json +13 -0
  118. package/skills/aicut-motion/assets/atlas/styles/036-thermal-camera/code.js +738 -0
  119. package/skills/aicut-motion/assets/atlas/styles/036-thermal-camera/poster.jpg +0 -0
  120. package/skills/aicut-motion/assets/atlas/styles/036-thermal-camera/style.json +13 -0
  121. package/skills/aicut-motion/assets/atlas/styles/037-engineering-blueprint/code.js +793 -0
  122. package/skills/aicut-motion/assets/atlas/styles/037-engineering-blueprint/poster.jpg +0 -0
  123. package/skills/aicut-motion/assets/atlas/styles/037-engineering-blueprint/style.json +13 -0
  124. package/skills/aicut-motion/assets/atlas/styles/038-impasto-night/code.js +673 -0
  125. package/skills/aicut-motion/assets/atlas/styles/038-impasto-night/poster.jpg +0 -0
  126. package/skills/aicut-motion/assets/atlas/styles/038-impasto-night/style.json +13 -0
  127. package/skills/aicut-motion/assets/atlas/styles/039-win95-desktop/code.js +907 -0
  128. package/skills/aicut-motion/assets/atlas/styles/039-win95-desktop/poster.jpg +0 -0
  129. package/skills/aicut-motion/assets/atlas/styles/039-win95-desktop/style.json +13 -0
  130. package/skills/aicut-motion/assets/atlas/styles/040-low-poly-faceted/code.js +833 -0
  131. package/skills/aicut-motion/assets/atlas/styles/040-low-poly-faceted/poster.jpg +0 -0
  132. package/skills/aicut-motion/assets/atlas/styles/040-low-poly-faceted/style.json +13 -0
  133. package/skills/aicut-motion/assets/atlas/styles/041-manga-page/code.js +845 -0
  134. package/skills/aicut-motion/assets/atlas/styles/041-manga-page/poster.jpg +0 -0
  135. package/skills/aicut-motion/assets/atlas/styles/041-manga-page/style.json +13 -0
  136. package/skills/aicut-motion/assets/atlas/styles/042-wood-type-letterpress/code.js +496 -0
  137. package/skills/aicut-motion/assets/atlas/styles/042-wood-type-letterpress/poster.jpg +0 -0
  138. package/skills/aicut-motion/assets/atlas/styles/042-wood-type-letterpress/style.json +13 -0
  139. package/skills/aicut-motion/assets/atlas/styles/043-light-painting/code.js +635 -0
  140. package/skills/aicut-motion/assets/atlas/styles/043-light-painting/poster.jpg +0 -0
  141. package/skills/aicut-motion/assets/atlas/styles/043-light-painting/style.json +13 -0
  142. package/skills/aicut-motion/assets/atlas/styles/044-felt-patchwork/code.js +799 -0
  143. package/skills/aicut-motion/assets/atlas/styles/044-felt-patchwork/poster.jpg +0 -0
  144. package/skills/aicut-motion/assets/atlas/styles/044-felt-patchwork/style.json +13 -0
  145. package/skills/aicut-motion/assets/atlas/styles/045-phosphor-terminal/code.js +547 -0
  146. package/skills/aicut-motion/assets/atlas/styles/045-phosphor-terminal/poster.jpg +0 -0
  147. package/skills/aicut-motion/assets/atlas/styles/045-phosphor-terminal/style.json +13 -0
  148. package/skills/aicut-motion/assets/atlas/styles/046-glassmorphism-ui/code.js +592 -0
  149. package/skills/aicut-motion/assets/atlas/styles/046-glassmorphism-ui/poster.jpg +0 -0
  150. package/skills/aicut-motion/assets/atlas/styles/046-glassmorphism-ui/style.json +13 -0
  151. package/skills/aicut-motion/assets/atlas/styles/047-tarot-card/code.js +768 -0
  152. package/skills/aicut-motion/assets/atlas/styles/047-tarot-card/poster.jpg +0 -0
  153. package/skills/aicut-motion/assets/atlas/styles/047-tarot-card/style.json +13 -0
  154. package/skills/aicut-motion/assets/atlas/styles/048-transit-map/code.js +666 -0
  155. package/skills/aicut-motion/assets/atlas/styles/048-transit-map/poster.jpg +0 -0
  156. package/skills/aicut-motion/assets/atlas/styles/048-transit-map/style.json +13 -0
  157. package/skills/aicut-motion/assets/atlas/styles/049-gouache-travel-poster/code.js +559 -0
  158. package/skills/aicut-motion/assets/atlas/styles/049-gouache-travel-poster/poster.jpg +0 -0
  159. package/skills/aicut-motion/assets/atlas/styles/049-gouache-travel-poster/style.json +13 -0
  160. package/skills/aicut-motion/assets/atlas/styles/050-napkin-sketch/code.js +943 -0
  161. package/skills/aicut-motion/assets/atlas/styles/050-napkin-sketch/poster.jpg +0 -0
  162. package/skills/aicut-motion/assets/atlas/styles/050-napkin-sketch/style.json +13 -0
  163. package/skills/aicut-motion/assets/atlas/styles/051-art-deco-foil/code.js +606 -0
  164. package/skills/aicut-motion/assets/atlas/styles/051-art-deco-foil/poster.jpg +0 -0
  165. package/skills/aicut-motion/assets/atlas/styles/051-art-deco-foil/style.json +13 -0
  166. package/skills/aicut-motion/assets/atlas/styles/052-radiograph-on-lightbox/code.js +730 -0
  167. package/skills/aicut-motion/assets/atlas/styles/052-radiograph-on-lightbox/poster.jpg +0 -0
  168. package/skills/aicut-motion/assets/atlas/styles/052-radiograph-on-lightbox/style.json +13 -0
  169. package/skills/aicut-motion/assets/atlas/styles/053-vaporwave/code.js +782 -0
  170. package/skills/aicut-motion/assets/atlas/styles/053-vaporwave/poster.jpg +0 -0
  171. package/skills/aicut-motion/assets/atlas/styles/053-vaporwave/style.json +13 -0
  172. package/skills/aicut-motion/assets/atlas/styles/054-ebru-paper-marbling/code.js +504 -0
  173. package/skills/aicut-motion/assets/atlas/styles/054-ebru-paper-marbling/poster.jpg +0 -0
  174. package/skills/aicut-motion/assets/atlas/styles/054-ebru-paper-marbling/style.json +13 -0
  175. package/skills/aicut-motion/assets/atlas/styles/055-isotype-pictograms/code.js +517 -0
  176. package/skills/aicut-motion/assets/atlas/styles/055-isotype-pictograms/poster.jpg +0 -0
  177. package/skills/aicut-motion/assets/atlas/styles/055-isotype-pictograms/style.json +13 -0
  178. package/skills/aicut-motion/assets/atlas/styles/056-soft-3d-clay/code.js +713 -0
  179. package/skills/aicut-motion/assets/atlas/styles/056-soft-3d-clay/poster.jpg +0 -0
  180. package/skills/aicut-motion/assets/atlas/styles/056-soft-3d-clay/style.json +13 -0
  181. package/skills/aicut-motion/assets/atlas/styles/057-cross-stitch-sampler/code.js +717 -0
  182. package/skills/aicut-motion/assets/atlas/styles/057-cross-stitch-sampler/poster.jpg +0 -0
  183. package/skills/aicut-motion/assets/atlas/styles/057-cross-stitch-sampler/style.json +13 -0
  184. package/skills/aicut-motion/assets/atlas/styles/058-constructivist-propaganda/code.js +540 -0
  185. package/skills/aicut-motion/assets/atlas/styles/058-constructivist-propaganda/poster.jpg +0 -0
  186. package/skills/aicut-motion/assets/atlas/styles/058-constructivist-propaganda/style.json +13 -0
  187. package/skills/aicut-motion/assets/atlas/styles/059-pocket-monochrome/code.js +524 -0
  188. package/skills/aicut-motion/assets/atlas/styles/059-pocket-monochrome/poster.jpg +0 -0
  189. package/skills/aicut-motion/assets/atlas/styles/059-pocket-monochrome/style.json +13 -0
  190. package/skills/aicut-motion/assets/atlas/styles/060-botanical-plate/code.js +934 -0
  191. package/skills/aicut-motion/assets/atlas/styles/060-botanical-plate/poster.jpg +0 -0
  192. package/skills/aicut-motion/assets/atlas/styles/060-botanical-plate/style.json +13 -0
  193. package/skills/aicut-motion/assets/atlas/styles/061-kinetic-type/code.js +690 -0
  194. package/skills/aicut-motion/assets/atlas/styles/061-kinetic-type/poster.jpg +0 -0
  195. package/skills/aicut-motion/assets/atlas/styles/061-kinetic-type/style.json +13 -0
  196. package/skills/aicut-motion/assets/atlas/styles/062-byzantine-mosaic/code.js +612 -0
  197. package/skills/aicut-motion/assets/atlas/styles/062-byzantine-mosaic/poster.jpg +0 -0
  198. package/skills/aicut-motion/assets/atlas/styles/062-byzantine-mosaic/style.json +13 -0
  199. package/skills/aicut-motion/assets/atlas/styles/063-y2k-liquid-chrome/code.js +666 -0
  200. package/skills/aicut-motion/assets/atlas/styles/063-y2k-liquid-chrome/poster.jpg +0 -0
  201. package/skills/aicut-motion/assets/atlas/styles/063-y2k-liquid-chrome/style.json +13 -0
  202. package/skills/aicut-motion/assets/atlas/styles/064-sticky-note-wall/code.js +651 -0
  203. package/skills/aicut-motion/assets/atlas/styles/064-sticky-note-wall/poster.jpg +0 -0
  204. package/skills/aicut-motion/assets/atlas/styles/064-sticky-note-wall/style.json +13 -0
  205. package/skills/aicut-motion/assets/atlas/styles/065-vintage-newsprint/code.js +656 -0
  206. package/skills/aicut-motion/assets/atlas/styles/065-vintage-newsprint/poster.jpg +0 -0
  207. package/skills/aicut-motion/assets/atlas/styles/065-vintage-newsprint/style.json +13 -0
  208. package/skills/aicut-motion/assets/atlas/styles/066-hidden-line-wireframe/code.js +672 -0
  209. package/skills/aicut-motion/assets/atlas/styles/066-hidden-line-wireframe/poster.jpg +0 -0
  210. package/skills/aicut-motion/assets/atlas/styles/066-hidden-line-wireframe/style.json +13 -0
  211. package/skills/aicut-motion/assets/atlas/styles/067-memphis-group/code.js +548 -0
  212. package/skills/aicut-motion/assets/atlas/styles/067-memphis-group/poster.jpg +0 -0
  213. package/skills/aicut-motion/assets/atlas/styles/067-memphis-group/style.json +13 -0
  214. package/skills/aicut-motion/assets/atlas/styles/068-ballpoint-notebook/code.js +989 -0
  215. package/skills/aicut-motion/assets/atlas/styles/068-ballpoint-notebook/poster.jpg +0 -0
  216. package/skills/aicut-motion/assets/atlas/styles/068-ballpoint-notebook/style.json +13 -0
  217. package/skills/aicut-motion/assets/atlas/styles/069-op-art-sphere/code.js +440 -0
  218. package/skills/aicut-motion/assets/atlas/styles/069-op-art-sphere/poster.jpg +0 -0
  219. package/skills/aicut-motion/assets/atlas/styles/069-op-art-sphere/style.json +13 -0
  220. package/skills/aicut-motion/assets/atlas/styles/070-topographic-survey/code.js +895 -0
  221. package/skills/aicut-motion/assets/atlas/styles/070-topographic-survey/poster.jpg +0 -0
  222. package/skills/aicut-motion/assets/atlas/styles/070-topographic-survey/style.json +13 -0
  223. package/skills/aicut-motion/assets/atlas/styles/071-pointillist-afternoon/code.js +563 -0
  224. package/skills/aicut-motion/assets/atlas/styles/071-pointillist-afternoon/poster.jpg +0 -0
  225. package/skills/aicut-motion/assets/atlas/styles/071-pointillist-afternoon/style.json +13 -0
  226. package/skills/aicut-motion/assets/atlas/styles/072-vector-arcade-1980/code.js +627 -0
  227. package/skills/aicut-motion/assets/atlas/styles/072-vector-arcade-1980/poster.jpg +0 -0
  228. package/skills/aicut-motion/assets/atlas/styles/072-vector-arcade-1980/style.json +13 -0
  229. package/skills/aicut-motion/assets/atlas/styles/073-patent-drawing/code.js +1096 -0
  230. package/skills/aicut-motion/assets/atlas/styles/073-patent-drawing/poster.jpg +0 -0
  231. package/skills/aicut-motion/assets/atlas/styles/073-patent-drawing/style.json +13 -0
  232. package/skills/aicut-motion/assets/atlas/styles/074-bauhaus-poster/code.js +595 -0
  233. package/skills/aicut-motion/assets/atlas/styles/074-bauhaus-poster/poster.jpg +0 -0
  234. package/skills/aicut-motion/assets/atlas/styles/074-bauhaus-poster/style.json +13 -0
  235. package/skills/aicut-motion/assets/atlas/styles/075-bitmap-paint-doodle/code.js +665 -0
  236. package/skills/aicut-motion/assets/atlas/styles/075-bitmap-paint-doodle/poster.jpg +0 -0
  237. package/skills/aicut-motion/assets/atlas/styles/075-bitmap-paint-doodle/style.json +13 -0
  238. package/skills/aicut-motion/assets/atlas/styles/076-nail-thread-string-art/code.js +645 -0
  239. package/skills/aicut-motion/assets/atlas/styles/076-nail-thread-string-art/poster.jpg +0 -0
  240. package/skills/aicut-motion/assets/atlas/styles/076-nail-thread-string-art/style.json +13 -0
  241. package/skills/aicut-motion/assets/atlas/styles/077-ridgeline/code.js +436 -0
  242. package/skills/aicut-motion/assets/atlas/styles/077-ridgeline/poster.jpg +0 -0
  243. package/skills/aicut-motion/assets/atlas/styles/077-ridgeline/style.json +13 -0
  244. package/skills/aicut-motion/assets/atlas/styles/078-sketchbook-graphite/code.js +1237 -0
  245. package/skills/aicut-motion/assets/atlas/styles/078-sketchbook-graphite/poster.jpg +0 -0
  246. package/skills/aicut-motion/assets/atlas/styles/078-sketchbook-graphite/style.json +13 -0
  247. package/skills/aicut-motion/assets/atlas/styles/079-teletext-page/code.js +622 -0
  248. package/skills/aicut-motion/assets/atlas/styles/079-teletext-page/poster.jpg +0 -0
  249. package/skills/aicut-motion/assets/atlas/styles/079-teletext-page/style.json +13 -0
  250. package/skills/aicut-motion/assets/atlas/styles/080-silkscreen-grid/code.js +524 -0
  251. package/skills/aicut-motion/assets/atlas/styles/080-silkscreen-grid/poster.jpg +0 -0
  252. package/skills/aicut-motion/assets/atlas/styles/080-silkscreen-grid/style.json +13 -0
  253. package/skills/aicut-motion/assets/atlas/styles/081-guilloch-security-print/code.js +689 -0
  254. package/skills/aicut-motion/assets/atlas/styles/081-guilloch-security-print/poster.jpg +0 -0
  255. package/skills/aicut-motion/assets/atlas/styles/081-guilloch-security-print/style.json +13 -0
  256. package/skills/aicut-motion/assets/atlas/styles/082-ascii-demoscene/code.js +574 -0
  257. package/skills/aicut-motion/assets/atlas/styles/082-ascii-demoscene/poster.jpg +0 -0
  258. package/skills/aicut-motion/assets/atlas/styles/082-ascii-demoscene/style.json +13 -0
  259. package/skills/aicut-motion/assets/atlas/styles/083-international-typographic-style/code.js +469 -0
  260. package/skills/aicut-motion/assets/atlas/styles/083-international-typographic-style/poster.jpg +0 -0
  261. package/skills/aicut-motion/assets/atlas/styles/083-international-typographic-style/style.json +13 -0
  262. package/skills/aicut-motion/assets/atlas/styles/084-flow-field/code.js +531 -0
  263. package/skills/aicut-motion/assets/atlas/styles/084-flow-field/poster.jpg +0 -0
  264. package/skills/aicut-motion/assets/atlas/styles/084-flow-field/style.json +13 -0
  265. package/skills/aicut-motion/assets/atlas/styles/085-macpaint-1984/code.js +675 -0
  266. package/skills/aicut-motion/assets/atlas/styles/085-macpaint-1984/poster.jpg +0 -0
  267. package/skills/aicut-motion/assets/atlas/styles/085-macpaint-1984/style.json +13 -0
  268. package/skills/aicut-motion/assets/atlas/styles/086-multi-scale-truchet/code.js +609 -0
  269. package/skills/aicut-motion/assets/atlas/styles/086-multi-scale-truchet/poster.jpg +0 -0
  270. package/skills/aicut-motion/assets/atlas/styles/086-multi-scale-truchet/style.json +13 -0
  271. package/skills/aicut-motion/references/design-systems/README.md +1 -1
  272. package/skills/aicut-motion/references/motion-delivery.md +55 -0
  273. package/skills/aicut-motion/references/pages.md +1 -1
  274. package/skills/aicut-motion/references/style-index.json +690 -0
  275. package/skills/aicut-motion/references/style-research.md +73 -0
  276. package/skills/aicut-motion/references/style-selection.md +71 -0
  277. package/skills/aicut-motion/scripts/atlas-viewer.html +195 -0
  278. package/skills/aicut-motion/scripts/atlas.mjs +109 -0
  279. package/studio/client.mjs +3 -3
  280. package/studio/server/fetch-github.mjs +14 -3
  281. package/studio/server/server.mjs +71 -6
  282. package/studio/server/skill-summaries.mjs +60 -0
  283. package/studio/server/skills.mjs +121 -7
  284. package/studio/server/styles-store.mjs +235 -0
  285. package/studio/server/template-posters.mjs +2 -2
  286. package/studio/server/templates-page.mjs +93 -93
  287. package/studio/server/templates.mjs +32 -7
  288. package/studio/ui/dist/assets/ExportCenter-DasulhAv.js +1 -0
  289. package/studio/ui/dist/assets/SettingsModal-BZw0Hz2_.js +2 -0
  290. package/studio/ui/dist/assets/apple-touch-icon-ClxQ7j-O.png +0 -0
  291. package/studio/ui/dist/assets/es-C8XPZARI.js +1 -0
  292. package/studio/ui/dist/assets/favicon-Blwx8Trs.png +0 -0
  293. package/studio/ui/dist/assets/index-BjJVmBzB.js +1623 -0
  294. package/studio/ui/dist/assets/index-C3BfKZFO.css +1 -0
  295. package/studio/ui/dist/assets/ja-BeNkdaEj.js +1 -0
  296. package/studio/ui/dist/assets/ko-DcTVhdzK.js +1 -0
  297. package/studio/ui/dist/assets/zh-CN-Cg51ctbL.js +1 -0
  298. package/studio/ui/dist/index.html +4 -3
  299. package/studio/ui/dist/assets/ExportCenter-F-2vF-lQ.js +0 -1
  300. package/studio/ui/dist/assets/SettingsModal-BgVYguNu.js +0 -2
  301. package/studio/ui/dist/assets/es-BRUzvuoM.js +0 -1
  302. package/studio/ui/dist/assets/index-Bhg-9dA3.css +0 -1
  303. package/studio/ui/dist/assets/index-CWur1Iw9.js +0 -1625
  304. package/studio/ui/dist/assets/ja-Cth-uDcW.js +0 -1
  305. package/studio/ui/dist/assets/ko-upvw591D.js +0 -1
  306. package/studio/ui/dist/assets/zh-CN-BCfJFazB.js +0 -1
@@ -0,0 +1,833 @@
1
+ {
2
+ // ---------- tiny 3D pipeline: perspective camera + flat-shaded, depth-sorted triangles ----------
3
+ const sub = (a, b) => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
4
+ const add3 = (a, b) => [a[0] + b[0], a[1] + b[1], a[2] + b[2]];
5
+ const scl = (a, k) => [a[0] * k, a[1] * k, a[2] * k];
6
+ const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
7
+ const cross = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
8
+ const norm = (a) => { const l = Math.hypot(a[0], a[1], a[2]) || 1; return [a[0] / l, a[1] / l, a[2] / l]; };
9
+
10
+ function makeCamera(pos, pitch, f, W, Hh) {
11
+ const ca = Math.cos(pitch), sa = Math.sin(pitch);
12
+ return {
13
+ pos,
14
+ view(p) { const d = sub(p, pos); return [d[0], d[1] * ca + d[2] * sa, -d[1] * sa + d[2] * ca]; },
15
+ proj(p) { const v = this.view(p); return [W / 2 + (f * v[0]) / v[2], Hh / 2 - (f * v[1]) / v[2], v[2]]; },
16
+ };
17
+ }
18
+ // icosahedron (unit)
19
+ const ICO = (() => {
20
+ const t = (1 + Math.sqrt(5)) / 2;
21
+ const v = [[-1, t, 0], [1, t, 0], [-1, -t, 0], [1, -t, 0], [0, -1, t], [0, 1, t], [0, -1, -t], [0, 1, -t], [t, 0, -1], [t, 0, 1], [-t, 0, -1], [-t, 0, 1]].map(norm);
22
+ const f = [[0, 11, 5], [0, 5, 1], [0, 1, 7], [0, 7, 10], [0, 10, 11], [1, 5, 9], [5, 11, 4], [11, 10, 2], [10, 7, 6], [7, 1, 8], [3, 9, 4], [3, 4, 2], [3, 2, 6], [3, 6, 8], [3, 8, 9], [4, 9, 5], [2, 4, 11], [6, 2, 10], [8, 6, 7], [9, 8, 1]];
23
+ return { v, f };
24
+ })();
25
+
26
+ // ================= EXPLAINER: a camera flight down a low-poly valley — data floats down the river into a crystal "model" =================
27
+ function makeCamYaw(pos, yaw, pitch, f, W, Hh) {
28
+ const cy = Math.cos(yaw), sy = Math.sin(yaw), cp = Math.cos(pitch), sp = Math.sin(pitch);
29
+ return {
30
+ pos,
31
+ proj(p) {
32
+ const dx = p[0] - pos[0], dy = p[1] - pos[1], dz = p[2] - pos[2];
33
+ const x1 = dx * cy - dz * sy, z1 = dx * sy + dz * cy;
34
+ const y2 = dy * cp + z1 * sp, z2 = -dy * sp + z1 * cp;
35
+ return [W / 2 + (f * x1) / z2, Hh / 2 - (f * y2) / z2, z2];
36
+ },
37
+ };
38
+ }
39
+ function lpPetFace(c, kind, x, y, r, col, ink) {
40
+ // faceted pet face: polygonal head split into light/dark facets
41
+ c.save(); c.translate(x, y);
42
+ const facet = (pts, cc) => { c.fillStyle = H.rgba(cc); c.beginPath(); pts.forEach((p, i) => i ? c.lineTo(p[0] * r, p[1] * r) : c.moveTo(p[0] * r, p[1] * r)); c.closePath(); c.fill(); };
43
+ const light = H.mix(col, [255, 255, 255], 0.25), dark = H.mix(col, [60, 40, 90], 0.25);
44
+ if (kind === 'cat') { facet([[-0.9, -0.15], [-0.7, -1.15], [-0.15, -0.7]], dark); facet([[0.9, -0.15], [0.7, -1.15], [0.15, -0.7]], col); }
45
+ else { facet([[-0.75, -0.6], [-1.15, 0.0], [-0.85, 0.75], [-0.55, -0.1]], dark); facet([[0.75, -0.6], [1.15, 0.0], [0.85, 0.75], [0.55, -0.1]], dark); }
46
+ const hx = [[0, -0.95], [0.82, -0.48], [0.9, 0.35], [0, 0.95], [-0.9, 0.35], [-0.82, -0.48]];
47
+ for (let i = 0; i < 6; i++) facet([[0, 0], hx[i], hx[(i + 1) % 6]], H.mix(light, dark, i / 5));
48
+ c.fillStyle = ink;
49
+ for (const sx of [-1, 1]) { c.beginPath(); c.moveTo(sx * 0.42 * r, -0.22 * r); c.lineTo(sx * 0.28 * r, -0.05 * r); c.lineTo(sx * 0.48 * r, -0.02 * r); c.closePath(); c.fill(); }
50
+ c.beginPath(); c.moveTo(-0.14 * r, 0.22 * r); c.lineTo(0.14 * r, 0.22 * r); c.lineTo(0, 0.4 * r); c.closePath(); c.fill();
51
+ c.restore();
52
+ }
53
+ // cut-corner tag (faceted label)
54
+ function lpTag(ctx, x, y, text, o = {}) {
55
+ ctx.save();
56
+ ctx.font = o.font || '700 28px "Space Grotesk"';
57
+ const fsz = parseInt((ctx.font.match(/(\d+)px/) || [0, 28])[1]);
58
+ const w = ctx.measureText(text).width + fsz * 1.3, h = o.h || Math.round(fsz * 1.75), k = o.k ?? 1, ch = h * 0.32;
59
+ ctx.translate(x, y); ctx.scale(k, k);
60
+ const pts = [[-w / 2 + ch, -h / 2], [w / 2, -h / 2], [w / 2, h / 2 - ch], [w / 2 - ch, h / 2], [-w / 2, h / 2], [-w / 2, -h / 2 + ch]];
61
+ ctx.fillStyle = o.shadow || 'rgba(40,20,70,0.35)'; ctx.beginPath(); pts.forEach((p, i) => i ? ctx.lineTo(p[0] + 4, p[1] + 4) : ctx.moveTo(p[0] + 4, p[1] + 4)); ctx.closePath(); ctx.fill();
62
+ const bg = H.hex(o.bg || '#fff6f0');
63
+ ctx.fillStyle = H.rgba(bg); ctx.beginPath(); pts.forEach((p, i) => i ? ctx.lineTo(p[0], p[1]) : ctx.moveTo(p[0], p[1])); ctx.closePath(); ctx.fill();
64
+ ctx.fillStyle = H.rgba(H.mix(bg, [255, 255, 255], 0.5)); ctx.beginPath(); ctx.moveTo(pts[0][0], pts[0][1]); ctx.lineTo(pts[1][0], pts[1][1]); ctx.lineTo(w / 2 - h * 0.6, 0); ctx.lineTo(-w / 2, 0); ctx.lineTo(pts[5][0], pts[5][1]); ctx.closePath(); ctx.fill();
65
+ ctx.fillStyle = o.col || '#2a1f4f'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillText(text, 0, 1);
66
+ ctx.restore();
67
+ }
68
+ // faceted arrow: angular polyline ribbon, each segment split into a lit and a shaded facet
69
+ function lpArrow(ctx, a, c, b, prog, colA, w = 12) {
70
+ if (prog <= 0) return null;
71
+ const q = (u) => [(1 - u) * (1 - u) * a[0] + 2 * u * (1 - u) * c[0] + u * u * b[0], (1 - u) * (1 - u) * a[1] + 2 * u * (1 - u) * c[1] + u * u * b[1]];
72
+ const N = 7, pts = []; for (let i = 0; i <= N; i++) pts.push(q(prog * i / N));
73
+ const light = H.rgba(H.mix(colA, [255, 255, 255], 0.3)), dark = H.rgba(H.mix(colA, [40, 20, 70], 0.25));
74
+ const end = pts.length - 1;
75
+ for (let i = 0; i < end; i++) {
76
+ const p0 = pts[i], p1 = pts[i + 1], dx = p1[0] - p0[0], dy = p1[1] - p0[1], L = Math.hypot(dx, dy) || 1;
77
+ const nx = -dy / L * w / 2, ny = dx / L * w / 2;
78
+ const shrink = i === end - 1 ? 0.35 : 0;
79
+ const p1b = [p1[0] - dx * shrink, p1[1] - dy * shrink];
80
+ ctx.fillStyle = light; ctx.beginPath(); ctx.moveTo(p0[0] + nx, p0[1] + ny); ctx.lineTo(p1b[0] + nx, p1b[1] + ny); ctx.lineTo(p1b[0], p1b[1]); ctx.lineTo(p0[0], p0[1]); ctx.closePath(); ctx.fill();
81
+ ctx.fillStyle = dark; ctx.beginPath(); ctx.moveTo(p0[0] - nx, p0[1] - ny); ctx.lineTo(p1b[0] - nx, p1b[1] - ny); ctx.lineTo(p1b[0], p1b[1]); ctx.lineTo(p0[0], p0[1]); ctx.closePath(); ctx.fill();
82
+ }
83
+ const e = pts[end], e0 = pts[end - 1], ang = Math.atan2(e[1] - e0[1], e[0] - e0[0]);
84
+ ctx.save(); ctx.translate(e[0], e[1]); ctx.rotate(ang);
85
+ ctx.fillStyle = light; ctx.beginPath(); ctx.moveTo(4, 0); ctx.lineTo(-w * 1.4, -w * 1.1); ctx.lineTo(-w * 1.4, 0); ctx.closePath(); ctx.fill();
86
+ ctx.fillStyle = dark; ctx.beginPath(); ctx.moveTo(4, 0); ctx.lineTo(-w * 1.4, w * 1.1); ctx.lineTo(-w * 1.4, 0); ctx.closePath(); ctx.fill();
87
+ ctx.restore();
88
+ return q;
89
+ }
90
+ let LP_TERRAIN = null, LP_GEM = null;
91
+ function lpExplainer(ctx, W, H_, t) {
92
+ const ph = (a, b) => H.clamp((t - a) / (b - a));
93
+ const E = (a, b) => H.ease.inOut(ph(a, b));
94
+ const EO = (a, b) => H.ease.out(ph(a, b));
95
+ const nz = H.makeNoise(31);
96
+ const SUN_DIR = norm([0.75, 0.55, 0.45]);
97
+ const SUN_COL = [255, 226, 190], AMB = [104, 98, 150];
98
+ const FOG = [236, 160, 150], FOG_HI = [180, 140, 190];
99
+ const CORAL = [255, 112, 96], INK = '#2a1f4f';
100
+ // ---------- camera flight keyframes: [t, x, y, z, yaw, pitch] ----------
101
+ const KF = [[0, 0, 44, -30, 0.0, 0.3], [1.5, 0, 42, -24, 0.0, 0.3], [2.9, -4, 19, 2, 0.06, 0.25], [5.7, -4, 18, 10, 0.06, 0.24], [6.9, -6, 17, 52, 0.22, 0.13], [10.2, -6, 17, 54, 0.22, 0.13], [11.2, 18, 22, 68, 0.3, 0.19], [12.8, 18, 22, 71, 0.3, 0.19], [13.9, 4, 52, -8, 0.22, 0.4], [20, 4, 52, -6, 0.22, 0.4]];
102
+ let k = 0; while (k < KF.length - 2 && t > KF[k + 1][0]) k++;
103
+ const A = KF[k], B = KF[k + 1], u = H.ease.inOut(H.clamp((t - A[0]) / (B[0] - A[0])));
104
+ const L = (i) => H.lerp(A[i], B[i], u);
105
+ const cam = makeCamYaw([L(1), L(2), L(3)], L(4), L(5), 760, W, H_);
106
+
107
+ // ---------- sky ----------
108
+ const sky = ctx.createLinearGradient(0, 0, 0, H_ * 0.62);
109
+ sky.addColorStop(0, '#1b2350'); sky.addColorStop(0.38, '#4d3f84'); sky.addColorStop(0.7, '#c06a93'); sky.addColorStop(1, '#ffb08a');
110
+ ctx.fillStyle = sky; ctx.fillRect(0, 0, W, H_);
111
+ const R0 = H.rng(77);
112
+ for (let i = 0; i < 90; i++) { const x = R0() * W, y = R0() * 160, a = (1 - y / 160) * R0() * 0.8; ctx.fillStyle = `rgba(255,240,255,${a})`; ctx.fillRect(x, y, 1, 1); }
113
+ { // faceted sun, fixed far away in world space so it parallaxes with the camera
114
+ const sp = cam.proj([cam.pos[0] + 30, cam.pos[1] + 12, cam.pos[2] + 400]);
115
+ const g = ctx.createRadialGradient(sp[0], sp[1], 30, sp[0], sp[1], 320);
116
+ g.addColorStop(0, 'rgba(255,214,160,0.5)'); g.addColorStop(1, 'rgba(255,214,160,0)');
117
+ ctx.fillStyle = g; ctx.fillRect(0, 0, W, H_);
118
+ for (let i = 0; i < 14; i++) {
119
+ const a0 = (i / 14) * Math.PI * 2, a1 = ((i + 1) / 14) * Math.PI * 2;
120
+ ctx.fillStyle = H.rgba(H.mix('#ffd49a', '#fff4d8', 0.5 + 0.5 * Math.cos(a0 - 2.3)));
121
+ ctx.beginPath(); ctx.moveTo(sp[0], sp[1]); ctx.lineTo(sp[0] + Math.cos(a0) * 50, sp[1] + Math.sin(a0) * 50); ctx.lineTo(sp[0] + Math.cos(a1) * 50, sp[1] + Math.sin(a1) * 50); ctx.closePath(); ctx.fill();
122
+ }
123
+ }
124
+
125
+ // ---------- static terrain (cached: world-space triangles + base colours) ----------
126
+ const height = (x, z) => {
127
+ const valley = Math.pow(Math.abs(x - 4 * Math.sin(z * 0.035)) / 55, 1.7) * 22;
128
+ const far = H.smooth(130, 210, z) * 18;
129
+ let h = nz.fbm2(x * 0.045, z * 0.045, 4) * 7 + valley + far - 3;
130
+ const dc = Math.hypot(x, z - 88); h = H.lerp(3.5, h, H.smooth(8, 16, dc)); // plateau under the crystal
131
+ const dq = Math.hypot((x - 34) / 1.8, z - 116); h = H.lerp(4.5, h, H.smooth(9, 18, dq)); // plateau for the pillars
132
+ return h;
133
+ };
134
+ const WATER = -0.6;
135
+ if (!LP_TERRAIN) {
136
+ const tris = [];
137
+ const CELL = 4.4, X0 = -110, X1 = 130, Z0 = -20, Z1 = 230;
138
+ const nx = Math.round((X1 - X0) / CELL), nzc = Math.round((Z1 - Z0) / CELL);
139
+ const jr = H.rng(5), V = [];
140
+ for (let j = 0; j <= nzc; j++) { const row = []; for (let i = 0; i <= nx; i++) { const x = X0 + i * CELL + (i > 0 && i < nx ? jr.range(-0.38, 0.38) * CELL : 0), z = Z0 + j * CELL + (j > 0 && j < nzc ? jr.range(-0.38, 0.38) * CELL : 0); row.push([x, height(x, z), z]); } V.push(row); }
141
+ const tc = (y, slope) => {
142
+ let c;
143
+ if (y < WATER + 0.6) c = [214, 196, 150];
144
+ else if (y < 6) c = H.mix([86, 160, 112], [60, 128, 96], H.clamp(y / 6));
145
+ else if (y < 14) c = H.mix([60, 128, 96], [110, 112, 120], H.smooth(9, 14, y));
146
+ else if (y < 22) c = [118, 110, 128]; else c = [244, 238, 248];
147
+ if (slope > 0.55 && y > 3 && y < 22) c = H.mix(c, [124, 112, 124], 0.6);
148
+ return c;
149
+ };
150
+ for (let j = 0; j < nzc; j++) for (let i = 0; i < nx; i++) {
151
+ const a = V[j][i], b = V[j][i + 1], c = V[j + 1][i], d = V[j + 1][i + 1];
152
+ const faces = (i + j) % 2 ? [[a, c, b], [b, c, d]] : [[a, c, d], [a, d, b]];
153
+ for (const f of faces) {
154
+ if (Math.max(f[0][1], f[1][1], f[2][1]) < WATER) { tris.push({ p: f.map(p => [p[0], WATER + nz.n2(p[0] * 0.4, p[2] * 0.4) * 0.35, p[2]]), col: [96, 120, 190], water: true }); continue; }
155
+ let n = norm(cross(sub(f[1], f[0]), sub(f[2], f[0]))); if (n[1] < 0) n = scl(n, -1);
156
+ tris.push({ p: f, col: tc((f[0][1] + f[1][1] + f[2][1]) / 3, 1 - Math.abs(n[1])), terrain: true });
157
+ }
158
+ }
159
+ const tr = H.rng(9);
160
+ const cone = (base, r, h, col, rot) => { const vs = [add3(base, [0, h, 0])]; for (let i = 0; i < 5; i++) { const a = rot + i / 5 * Math.PI * 2; vs.push(add3(base, [Math.cos(a) * r, 0, Math.sin(a) * r])); } for (let i = 0; i < 5; i++) tris.push({ p: [vs[0], vs[1 + i], vs[1 + (i + 1) % 5]], col, center: add3(base, [0, h * 0.3, 0]) }); };
161
+ for (let kk = 0, placed = 0; kk < 1600 && placed < 220; kk++) {
162
+ const x = tr.range(-80, 90), z = tr.range(0, 170), y = height(x, z);
163
+ if (y < 0.6 || y > 12) continue;
164
+ if (Math.hypot(x, z - 88) < 15 || Math.hypot((x - 34) / 1.8, z - 116) < 17) continue;
165
+ if (nz.fbm2(x * 0.05 + 40, z * 0.05, 2) < -0.05) continue;
166
+ const s = tr.range(1.5, 2.4), g = H.mix([40, 110, 90], [70, 140, 100], tr()), rot = tr() * 6;
167
+ cone([x, y - 0.2, z], s * 0.75, s * 1.6, g, rot); cone([x, y + s * 0.85, z], s * 0.55, s * 1.4, H.mix(g, [120, 180, 120], 0.25), rot + 0.6);
168
+ placed++;
169
+ }
170
+ LP_TERRAIN = tris;
171
+ }
172
+ const tris = LP_TERRAIN.slice();
173
+ const pushTri = (a, b, c, col, opt = {}) => tris.push({ p: [a, b, c], col, ...opt });
174
+ const meshTris = (vs, fs, col, center, opt = {}) => { for (const [i, j, kk] of fs) pushTri(vs[i], vs[j], vs[kk], typeof col === 'function' ? col(i, j, kk) : col, { center, ...opt }); };
175
+ const prism = (cx, y0, cz, r, h, sides, col, rot = 0) => {
176
+ const vs = []; for (let i = 0; i < sides; i++) { const a = rot + i / sides * Math.PI * 2; vs.push([cx + Math.cos(a) * r, y0, cz + Math.sin(a) * r]); }
177
+ for (let i = 0; i < sides; i++) { const a = rot + i / sides * Math.PI * 2; vs.push([cx + Math.cos(a) * r, y0 + h, cz + Math.sin(a) * r]); }
178
+ const fs = []; for (let i = 0; i < sides; i++) { const j = (i + 1) % sides; fs.push([i, j, sides + j], [i, sides + j, sides + i]); }
179
+ for (let i = 1; i < sides - 1; i++) fs.push([sides, sides + i, sides + i + 1]);
180
+ meshTris(vs, fs, col, [cx, y0 + h / 2, cz]);
181
+ };
182
+
183
+ // ---------- beat 2: labelled example cards drifting down the river ----------
184
+ const cards = [];
185
+ if (t > 2.3 && t < 6.6) {
186
+ for (let j = 0; j < 18; j++) {
187
+ const z = 14 + (t - 2.3) * 12 - j * 4.6;
188
+ if (z < 12 || z > 84) continue;
189
+ const x = 4 * Math.sin(z * 0.035) + Math.sin(j * 2.7) * 3;
190
+ cards.push({ x, z, y: WATER + 0.2 + Math.sin(t * 2 + j) * 0.15, kind: (j * 5 + 1) % 3 === 0 ? 'cat' : (j % 2 ? 'cat' : 'dog'), a: Math.sin(j * 1.3) * 0.25 });
191
+ }
192
+ }
193
+ if (t > 5.9 && t < 7.2) { const z = H.lerp(46, 84, E(5.9, 7.1)); cards.push({ x: 4 * Math.sin(z * 0.035), z, y: WATER + 0.2, kind: 'cat', test: true, a: 0 }); }
194
+ for (const cd of cards) {
195
+ const w = 1.8, h = 2.4, ca = Math.cos(cd.a), sa = Math.sin(cd.a);
196
+ const P0 = (dx, dy) => [cd.x + dx * ca, cd.y + dy, cd.z + dx * sa];
197
+ const v = [P0(-w, 0), P0(w, 0), P0(w, h * 2), P0(-w, h * 2)];
198
+ pushTri(v[0], v[1], v[2], cd.test ? [255, 210, 196] : [250, 246, 250], { twoSided: true, card: true });
199
+ pushTri(v[0], v[2], v[3], cd.test ? [255, 196, 180] : [236, 230, 244], { twoSided: true, card: true });
200
+ }
201
+ // counter totem: a faceted stack that grows with the data
202
+ const cnt = Math.floor(1e6 * Math.pow(EO(2.9, 5.7), 1.6));
203
+ const stackH = 1 + 9 * Math.pow(EO(2.8, 5.8), 1.2);
204
+ for (let i = 0; i < Math.ceil(stackH / 1.2); i++) prism(-12, 3 + i * 1.2, 40, 2.6 - (i % 2) * 0.2, Math.min(1.1, stackH - i * 1.2), 6, i % 2 ? [255, 214, 196] : [210, 220, 250], i * 0.4);
205
+
206
+ // ---------- beat 3: the crystal model + answer sign ----------
207
+ const adj = E(8.6, 9.4);
208
+ const CRY = [0, 15 + Math.sin(t * 1.6) * 0.6, 88];
209
+ const spin = t * 0.45 + adj * 1.2;
210
+ const cr = H.rng(44);
211
+ const errFlash = ph(8.0, 8.4) * (1 - ph(8.8, 9.2));
212
+ {
213
+ const r = 6.5;
214
+ // geodesic-cut gem: each icosahedron face split in 4, midpoints pushed part-way out (crisp, gem-like facets)
215
+ if (!LP_GEM) {
216
+ const vs = ICO.v.map(v => v.slice()), fs = [], mid = {};
217
+ const m = (a, b) => { const key = a < b ? a + '_' + b : b + '_' + a; if (mid[key] == null) { const p = norm(add3(vs[a], vs[b])); const k2 = 0.93; vs.push(scl(p, k2)); mid[key] = vs.length - 1; } return mid[key]; };
218
+ for (const [a, b, c] of ICO.f) { const ab = m(a, b), bc = m(b, c), ca = m(c, a); fs.push([a, ab, ca], [b, bc, ab], [c, ca, bc], [ab, bc, ca]); }
219
+ LP_GEM = { v: vs, f: fs };
220
+ }
221
+ const pal = [[255, 128, 112], [110, 200, 210], [255, 200, 120], [150, 124, 240], [236, 140, 200]];
222
+ const vs = LP_GEM.v.map((v) => { const x = v[0] * Math.cos(spin) - v[2] * Math.sin(spin), z = v[0] * Math.sin(spin) + v[2] * Math.cos(spin); return [CRY[0] + x * r, CRY[1] + v[1] * r * 1.25, CRY[2] + z * r]; });
223
+ LP_GEM.f.forEach((f) => {
224
+ const raw = cr.pick(pal);
225
+ pushTri(vs[f[0]], vs[f[1]], vs[f[2]], raw, { center: CRY, crystal: true });
226
+ });
227
+ prism(0, 3.4, 88, 4.2, 1.2, 7, [190, 180, 220], 0.3);
228
+ }
229
+ const SIGN = [17, 13, 86];
230
+ const wrong = t > 7.05 && t < 9.5, right = t >= 9.5;
231
+ const shake = t > 7.45 && t < 7.85 ? Math.sin(t * 80) * 0.25 : 0;
232
+ if (t > 6.6 && t < 11.0) {
233
+ const sk = H.ease.back(ph(6.6, 7.0)) * (1 - H.ease.inOut(ph(10.4, 11.0)));
234
+ const sx = SIGN[0] + shake, w = 6 * sk, h = 3.4 * sk;
235
+ const v = [[sx - w, SIGN[1] - h, SIGN[2]], [sx + w, SIGN[1] - h, SIGN[2]], [sx + w, SIGN[1] + h, SIGN[2]], [sx - w, SIGN[1] + h, SIGN[2]]];
236
+ const scr = wrong && t > 7.45 ? [255, 214, 206] : right ? [206, 244, 226] : [246, 240, 250];
237
+ pushTri(v[0], v[1], v[2], scr, { twoSided: true, sign: true, emissive: true });
238
+ pushTri(v[0], v[2], v[3], H.mix(scr, [255, 255, 255], 0.3), { twoSided: true, sign: true, emissive: true });
239
+ prism(sx, 3, SIGN[2] + 0.6, 0.5, SIGN[1] - h - 3, 5, [120, 110, 150]);
240
+ prism(sx, SIGN[1] - h - 0.6, SIGN[2] + 0.7, w + 0.6, 0.6, 4, [90, 80, 130], Math.PI / 4);
241
+ }
242
+ // ---------- beat 4: accuracy pillars (one per training round) ----------
243
+ const ACCS = [61, 72, 80, 86, 90, 93, 95, 97];
244
+ const roundT = (i) => 11.0 + i * 0.2;
245
+ ACCS.forEach((a, i) => {
246
+ const g = EO(roundT(i), roundT(i) + 0.4); if (g <= 0) return;
247
+ const x = 22 + i * 3.6, z = 112 + i * 1.0;
248
+ const n0 = tris.length;
249
+ prism(x, 4.4, z, 1.4, (a - 50) * 0.35 * g, 5, i === 7 ? [255, 120, 100] : H.mix([150, 170, 250], [110, 225, 190], i / 7), 0.2);
250
+ for (let q = n0; q < tris.length; q++) tris[q].pillar = true;
251
+ });
252
+
253
+ // ---------- shade, cull, project, sort ----------
254
+ const out = [];
255
+ for (const tri of tris) {
256
+ const [a, b, c] = tri.p;
257
+ let n = norm(cross(sub(b, a), sub(c, a)));
258
+ const cen = scl(add3(add3(a, b), c), 1 / 3);
259
+ if (tri.terrain || tri.water) { if (n[1] < 0) n = scl(n, -1); }
260
+ else if (tri.center) { if (dot(n, sub(cen, tri.center)) < 0) n = scl(n, -1); }
261
+ const toCam = sub(cam.pos, cen);
262
+ if (tri.twoSided) { if (dot(n, toCam) < 0) n = scl(n, -1); }
263
+ else if (dot(n, toCam) <= 0) continue;
264
+ const pa = cam.proj(a), pb = cam.proj(b), pc = cam.proj(c);
265
+ if (pa[2] < 0.5 || pb[2] < 0.5 || pc[2] < 0.5) continue;
266
+ const mnx = Math.min(pa[0], pb[0], pc[0]), mxx = Math.max(pa[0], pb[0], pc[0]), mny = Math.min(pa[1], pb[1], pc[1]), mxy = Math.max(pa[1], pb[1], pc[1]);
267
+ if (mxx < -20 || mnx > W + 20 || mxy < -20 || mny > H_ + 20) continue;
268
+ const depth = (pa[2] + pb[2] + pc[2]) / 3;
269
+ let col;
270
+ if (tri.emissive) col = tri.col;
271
+ else if (tri.crystal) {
272
+ // cut-glass shading: coherent violet->rose ramp by facet normal (trained), lifted from a jumbled palette (untrained),
273
+ // key + cool fill light with a hard specular glint so neighbouring facets always separate in value
274
+ const ramp = H.mix(H.mix([92, 74, 214], [255, 128, 186], H.clamp(0.45 + 0.7 * n[1])), [96, 206, 230], H.clamp(-n[0] * 0.9) * 0.5);
275
+ let base = H.mix(H.mix(tri.col, ramp, 0.35), ramp, adj);
276
+ base = H.mix(base, CORAL, errFlash * 0.8);
277
+ const lam = Math.max(0, dot(n, SUN_DIR));
278
+ const v = norm(toCam), fill = Math.max(0, dot(n, norm([-0.55, 0.6, -0.6])));
279
+ const rl = sub(scl(n, 2 * dot(n, SUN_DIR)), SUN_DIR), spec = Math.pow(Math.max(0, dot(rl, v)), 20) * 0.6;
280
+ const fl2 = sub(scl(n, 2 * dot(n, norm([-0.55, 0.6, -0.6]))), norm([-0.55, 0.6, -0.6])), spec2 = Math.pow(Math.max(0, dot(fl2, v)), 24) * 0.45;
281
+ const rim = Math.pow(1 - Math.max(0, dot(n, v)), 3) * 0.28 * (0.4 + lam);
282
+ const kk = 0.25 + 1.0 * lam, jit = 0.92 + 0.16 * (0.5 + 0.5 * Math.sin(cen[0] * 7.1 + cen[1] * 3.7 + cen[2] * 5.3 - spin * 9));
283
+ col = [0, 1, 2].map(i => base[i] * jit * (AMB[i] / 255 * 0.5 + SUN_COL[i] / 255 * kk * 0.75 + [176, 186, 255][i] / 255 * fill * 0.55));
284
+ col = H.mix(col, [255, 244, 236], H.clamp(spec + spec2 + rim));
285
+ }
286
+ else {
287
+ const lam = Math.max(0, dot(n, SUN_DIR));
288
+ let kk = tri.card ? 0.6 + 0.5 * lam : tri.pillar ? 0.3 + 0.85 * lam : lam;
289
+ if (tri.terrain && lam > 0) {
290
+ // near-camera sliver faces (thin and long on screen) catching sun read as white streaks: damp their key light
291
+ const e2 = Math.max((pa[0] - pb[0]) ** 2 + (pa[1] - pb[1]) ** 2, (pb[0] - pc[0]) ** 2 + (pb[1] - pc[1]) ** 2, (pc[0] - pa[0]) ** 2 + (pc[1] - pa[1]) ** 2);
292
+ const area2 = Math.abs((pb[0] - pa[0]) * (pc[1] - pa[1]) - (pc[0] - pa[0]) * (pb[1] - pa[1]));
293
+ if (e2 > 3600) kk *= H.lerp(0.15, 1, H.smooth(0.06, 0.2, area2 / e2));
294
+ }
295
+ const fillP = tri.pillar ? Math.max(0, dot(n, norm([-0.55, 0.6, -0.6]))) * 0.45 : 0;
296
+ col = [0, 1, 2].map(i => tri.col[i] * (AMB[i] / 255 * (tri.pillar ? 0.6 : 0.85) + SUN_COL[i] / 255 * kk * 0.95 + [176, 186, 255][i] / 255 * fillP));
297
+ if (tri.water) {
298
+ const v = norm(toCam), rf = sub(scl(n, 2 * dot(n, v)), v);
299
+ const spec = Math.pow(Math.max(0, dot(rf, norm([0.5, 0.2, 1]))), 12);
300
+ col = H.mix(H.mix([120, 110, 190], [250, 170, 165], H.clamp(0.45 + n[0] * 4 + n[2] * 2)), [255, 236, 200], spec);
301
+ }
302
+ }
303
+ const fogK = H.clamp(Math.pow(H.smooth(40, 260, depth), 1.15) * 0.9) * (tri.crystal || tri.sign ? 0.3 : 1);
304
+ col = H.mix(col, H.mix(FOG, FOG_HI, H.clamp(cen[1] / 30)), fogK);
305
+ out.push({ pa, pb, pc, depth, col, cry: tri.crystal });
306
+ }
307
+ out.sort((p, q) => q.depth - p.depth);
308
+ ctx.lineJoin = 'round';
309
+ for (const o of out) {
310
+ const fs = `rgb(${o.col[0] | 0},${o.col[1] | 0},${o.col[2] | 0})`;
311
+ ctx.fillStyle = fs; ctx.lineWidth = 0.9;
312
+ ctx.strokeStyle = o.cry ? `rgb(${Math.min(255, o.col[0] * 1.18 + 14) | 0},${Math.min(255, o.col[1] * 1.18 + 14) | 0},${Math.min(255, o.col[2] * 1.18 + 14) | 0})` : fs;
313
+ if (o.cry) ctx.lineWidth = Math.max(1, Math.min(2, 1400 / o.depth / 20));
314
+ ctx.beginPath(); ctx.moveTo(o.pa[0], o.pa[1]); ctx.lineTo(o.pb[0], o.pb[1]); ctx.lineTo(o.pc[0], o.pc[1]); ctx.closePath(); ctx.fill(); ctx.stroke();
315
+ }
316
+ // crystal glow
317
+ { const p = cam.proj(CRY); if (p[2] > 1) { const r = 9 * 760 / p[2]; const g = ctx.createRadialGradient(p[0], p[1], r * 0.4, p[0], p[1], r * 1.6); g.addColorStop(0, `rgba(255,200,230,${0.25 + 0.3 * errFlash})`); g.addColorStop(1, 'rgba(255,200,230,0)'); ctx.globalCompositeOperation = 'lighter'; ctx.fillStyle = g; ctx.fillRect(p[0] - r * 2, p[1] - r * 2, r * 4, r * 4); ctx.globalCompositeOperation = 'source-over'; } }
318
+
319
+ // ---------- overlays that land on the 3D objects ----------
320
+ const sz = (p, wu) => wu * 760 / p[2];
321
+ for (const cd of cards) {
322
+ const p = cam.proj([cd.x, cd.y + 2.4, cd.z]); if (p[2] < 1) continue;
323
+ const r = sz(p, 1.3);
324
+ if (r > 1.5) lpPetFace(ctx, cd.kind, p[0], p[1], r, cd.kind === 'cat' ? [170, 160, 230] : [242, 180, 130], '#2a1f4f');
325
+ const pt = cam.proj([cd.x, cd.y + 5.6, cd.z]);
326
+ const kk = H.clamp(sz(p, 1) / 30) * (cd.test ? 1 : H.clamp((84 - cd.z) / 6));
327
+ if (cd.test) lpTag(ctx, pt[0], pt[1], '?', { k: Math.max(0.5, kk) * EO(5.9, 6.2), bg: '#ff7060', col: '#fff' });
328
+ else if (kk > 0.25) lpTag(ctx, pt[0], pt[1], cd.kind, { k: Math.min(1, kk) * EO(2.4, 2.8), font: '700 28px "Space Grotesk"' });
329
+ }
330
+ // counter tag on the totem
331
+ if (t > 2.6 && t < 7.0) {
332
+ const p = cam.proj([-12, 3 + stackH + 1.5, 40]);
333
+ { const kk2 = H.ease.back(ph(2.7, 3.1)) * (1 - ph(6.6, 7.0)); lpTag(ctx, p[0], p[1] - 70, cnt.toLocaleString('en-US'), { k: kk2, font: '700 66px "Space Grotesk"', h: 96 }); lpTag(ctx, p[0], p[1] - 4, 'examples', { k: kk2, bg: '#2a1f4f', col: '#fff' }); }
334
+ }
335
+ // flow arrow: river of data -> crystal
336
+ if (t > 3.2 && t < 6.6) {
337
+ const a = cam.proj([2, 6, 30]), b = cam.proj([0, 8, 80]);
338
+ const mid = [(a[0] + b[0]) / 2 + 60, Math.min(a[1], b[1]) - 30];
339
+ lpArrow(ctx, a, mid, b, E(3.2, 4.2) * (1 - ph(6.2, 6.6)), [255, 246, 240], 9);
340
+ if (t > 4.0) { const m = cam.proj([0, 14, 84]); lpTag(ctx, m[0] + 150, m[1] - 10, 'the model', { k: H.ease.back(ph(4.0, 4.3)) * (1 - ph(6.3, 6.6)), bg: '#2a1f4f', col: '#fff' }); }
341
+ }
342
+ // loop
343
+ if (t > 6.7 && t < 10.7) {
344
+ const fade = 1 - ph(10.3, 10.7);
345
+ ctx.save(); ctx.globalAlpha = fade;
346
+ const cp = cam.proj(CRY), sp = cam.proj(SIGN), sTop = cam.proj([SIGN[0], SIGN[1] + 3.6, SIGN[2]]);
347
+ const crR = sz(cp, 7);
348
+ // 1 Guess: crystal -> sign
349
+ const ga = [cp[0] + crR * 0.8, cp[1] - crR * 0.2], gb = [sp[0] - sz(sp, 6.4), sp[1]];
350
+ lpArrow(ctx, ga, [(ga[0] + gb[0]) / 2, Math.min(ga[1], gb[1]) - 40], gb, E(6.8, 7.15), [255, 246, 240], 10);
351
+ if (t > 6.9) lpTag(ctx, (ga[0] + gb[0]) / 2, Math.min(ga[1], gb[1]) - 52, '1 Guess', { k: H.ease.back(ph(6.9, 7.2)) });
352
+ // sign text + verdict
353
+ const sw = sz(sp, 6), fs2 = Math.max(10, sz(sp, 2.2));
354
+ if (wrong || right) {
355
+ ctx.save(); ctx.translate(shake * 6, 0);
356
+ lpPetFace(ctx, right ? 'cat' : 'dog', sp[0] - sw * 0.55, sp[1], sz(sp, 1.7), right ? [170, 160, 230] : [242, 180, 130], INK);
357
+ ctx.font = `700 ${fs2}px "Space Grotesk"`; ctx.fillStyle = INK; ctx.textBaseline = 'middle'; ctx.fillText(right ? 'cat' : 'dog?', sp[0] - sw * 0.2, sp[1] + 2);
358
+ ctx.restore();
359
+ }
360
+ if (t > 7.45) {
361
+ lpTag(ctx, sTop[0], sTop[1] - 26, '2 Check', { k: H.ease.back(ph(7.45, 7.75)) });
362
+ const bk = right ? H.ease.back(ph(9.55, 9.85)) : H.ease.back(ph(7.45, 7.7));
363
+ const bx = sp[0] + sw * 0.82, by = sp[1] - sz(sp, 2.6);
364
+ ctx.save(); ctx.translate(bx, by); ctx.scale(bk, bk); ctx.rotate(0.12);
365
+ const hexR = 24; ctx.fillStyle = right ? '#3ccf9a' : '#ff5a4a';
366
+ ctx.beginPath(); for (let i = 0; i < 6; i++) { const a = i / 6 * Math.PI * 2; ctx.lineTo(Math.cos(a) * hexR, Math.sin(a) * hexR); } ctx.closePath(); ctx.fill();
367
+ ctx.fillStyle = 'rgba(255,255,255,0.25)'; ctx.beginPath(); ctx.moveTo(0, 0); for (let i = 3; i <= 6; i++) { const a = i / 6 * Math.PI * 2; ctx.lineTo(Math.cos(a) * hexR, Math.sin(a) * hexR); } ctx.closePath(); ctx.fill();
368
+ ctx.strokeStyle = '#fff'; ctx.lineWidth = 5; ctx.lineJoin = 'miter'; ctx.beginPath();
369
+ if (right) { ctx.moveTo(-10, 0); ctx.lineTo(-3, 8); ctx.lineTo(11, -9); } else { ctx.moveTo(-8, -8); ctx.lineTo(8, 8); ctx.moveTo(8, -8); ctx.lineTo(-8, 8); }
370
+ ctx.stroke(); ctx.restore();
371
+ if (!right) {
372
+ // emphasis: faceted burst ring around the wrong answer
373
+ const pr = EO(7.45, 7.9);
374
+ ctx.save(); ctx.globalAlpha = fade * (0.55 + 0.45 * Math.sin(t * 12));
375
+ ctx.strokeStyle = '#ff5a4a'; ctx.lineWidth = 4; ctx.beginPath();
376
+ const rr = sw * 1.25;
377
+ for (let i = 0; i <= 10 * pr; i++) { const a = i / 10 * Math.PI * 2; ctx.lineTo(sp[0] + Math.cos(a) * rr, sp[1] + Math.sin(a) * rr * 0.62); }
378
+ ctx.stroke(); ctx.restore();
379
+ lpTag(ctx, sp[0], sp[1] + sz(sp, 4.4), 'answer: cat', { k: H.ease.back(ph(7.65, 7.95)), bg: '#2a1f4f', col: '#fff', font: '700 28px "Space Grotesk"' });
380
+ }
381
+ }
382
+ // 3 Adjust: error shard flies back, crystal facets realign
383
+ if (t > 8.0) {
384
+ const a = [sTop[0] - 10, sTop[1] - 8], b = [cp[0] + crR * 0.2, cp[1] - crR * 0.9];
385
+ const q = lpArrow(ctx, a, [(a[0] + b[0]) / 2, Math.min(a[1], b[1]) - 90], b, E(8.0, 8.6), [255, 90, 74], 10);
386
+ if (q && t < 8.8) { const p = q(E(8.0, 8.6)); ctx.fillStyle = 'rgba(255,90,74,0.35)'; ctx.beginPath(); ctx.arc(p[0], p[1], 16, 0, 7); ctx.fill(); }
387
+ lpTag(ctx, cp[0], cp[1] + crR * 1.5, '3 Adjust', { k: H.ease.back(ph(8.5, 8.8)), bg: '#ff7060', col: '#fff' });
388
+ if (t < 9.3) lpTag(ctx, (a[0] + b[0]) / 2, Math.min(a[1], b[1]) - 64, 'error', { k: H.ease.back(ph(8.1, 8.35)) * (1 - ph(9.0, 9.3)), bg: '#ffe0da', col: '#c2382a', font: '700 28px "Space Grotesk"' });
389
+ }
390
+ if (right) lpTag(ctx, sTop[0] + 20, sTop[1] - 26, 'Guess again ✓', { k: H.ease.back(ph(9.55, 9.85)), bg: '#3ccf9a', col: '#fff' });
391
+ ctx.restore();
392
+ }
393
+ // accuracy tag riding the newest pillar
394
+ if (t > 10.9) {
395
+ const i = Math.min(7, Math.max(0, Math.floor((t - 11.0) / 0.2)));
396
+ const cur = Math.round(H.lerp(61, 97, H.ease.inOut(ph(11.0, 12.6))));
397
+ const x = 22 + i * 3.6, z = 112 + i * 1.0, h = (ACCS[i] - 50) * 0.35 * EO(roundT(i), roundT(i) + 0.4);
398
+ const p = cam.proj([x, 4.4 + h + 1.5, z]);
399
+ const pop = t > 12.6 ? 1 + 0.2 * Math.sin(Math.min(1, (t - 12.6) / 0.35) * Math.PI) : 1;
400
+ { const kk2 = H.ease.back(ph(10.9, 11.2)) * pop; lpTag(ctx, p[0], p[1] - 66, `${cur}%`, { k: kk2, font: '700 70px "Space Grotesk"', h: 100, bg: cur >= 97 ? '#ff7060' : '#fff6f0', col: cur >= 97 ? '#fff' : INK }); lpTag(ctx, p[0], p[1] - 148, 'Accuracy', { k: kk2, bg: '#2a1f4f', col: '#fff' }); }
401
+ const p0 = cam.proj([22, 4.4 + 11 * 0.35 + 1, 112]);
402
+ if (t > 11.2 && t < 13.3) lpTag(ctx, p0[0], p0[1] - 24, 'round 1: 61%', { k: EO(11.2, 11.5) * (1 - ph(13.0, 13.3)), font: '700 28px "Space Grotesk"' });
403
+ if (t > 12.6) { ctx.save(); ctx.globalAlpha = 1 - ph(12.6, 13.3); ctx.strokeStyle = '#fff'; ctx.lineWidth = 3; const rr = 110 + 70 * EO(12.6, 13.3); ctx.beginPath(); for (let k2 = 0; k2 <= 6; k2++) { const a = k2 / 6 * Math.PI * 2; ctx.lineTo(p[0] + Math.cos(a) * rr, p[1] - 80 + Math.sin(a) * rr * 0.7); } ctx.stroke(); ctx.restore(); }
404
+ const ax = cam.proj([20, 4.6, 106]), bx = cam.proj([50, 4.6, 120]);
405
+ if (t < 13.3) { ctx.save(); ctx.globalAlpha = EO(11.0, 11.5) * (1 - ph(13.0, 13.3)); ctx.font = '700 28px "Space Grotesk"'; ctx.fillStyle = '#fff6f0'; ctx.fillText('training rounds →', Math.min(ax[0], bx[0]) + 10, Math.max(ax[1], bx[1]) + 30); ctx.restore(); }
406
+ }
407
+ // ---------- hook → header ----------
408
+ {
409
+ const sh = E(1.4, 2.4), a = EO(0.1, 0.6);
410
+ const size = H.lerp(66, 28, sh);
411
+ ctx.save(); ctx.globalAlpha = a; ctx.font = `700 ${size}px "Space Grotesk"`;
412
+ const w = ctx.measureText('How does AI learn?').width;
413
+ const x = H.lerp(640 - w / 2, 48, sh), y = H.lerp(300, 62, sh) + (1 - a) * 24;
414
+ if (sh > 0) { ctx.save(); ctx.globalAlpha = a * sh; ctx.translate(x - 16, y - size * 1.05); const pw = w + 32, phh = size * 1.75, c2 = 12; ctx.fillStyle = 'rgba(42,31,79,0.82)'; ctx.beginPath(); ctx.moveTo(c2, 0); ctx.lineTo(pw, 0); ctx.lineTo(pw, phh - c2); ctx.lineTo(pw - c2, phh); ctx.lineTo(0, phh); ctx.lineTo(0, c2); ctx.closePath(); ctx.fill(); ctx.restore(); }
415
+ ctx.fillStyle = 'rgba(30,20,60,0.35)'; ctx.fillText('How does AI learn?', x + 3, y + 3);
416
+ ctx.fillStyle = '#ffffff'; ctx.fillText('How does AI learn?', x, y);
417
+ const uw = H.lerp(260, 120, sh), uy = y + size * 0.3;
418
+ ctx.fillStyle = '#ff7060'; ctx.beginPath(); ctx.moveTo(x + 2, uy); ctx.lineTo(x + 2 + uw * 0.78, uy); ctx.lineTo(x + uw * 0.72, uy + size * 0.12); ctx.lineTo(x + 2, uy + size * 0.12); ctx.fill();
419
+ ctx.fillStyle = '#ffb08a'; ctx.beginPath(); ctx.moveTo(x + 2 + uw * 0.78, uy); ctx.lineTo(x + uw, uy); ctx.lineTo(x + uw * 0.94, uy + size * 0.12); ctx.lineTo(x + uw * 0.72, uy + size * 0.12); ctx.fill();
420
+ ctx.restore();
421
+ }
422
+ // ---------- takeaway ----------
423
+ if (t > 13.0) {
424
+ const kk = H.ease.back(ph(13.0, 13.45));
425
+ ctx.save(); ctx.translate(640, 600); ctx.scale(kk, kk);
426
+ lpTag(ctx, 0, 0, 'More examples → better guesses', { font: '700 46px "Space Grotesk"', h: 84 });
427
+ ctx.restore();
428
+ }
429
+ }
430
+
431
+ // ---------- sound: dusk valley flight (soft wind, river, faceted gusts, a glassy crystal model) ----------
432
+ function lpSound(k) {
433
+ const D = 14.5;
434
+ const ph = (t, a, b) => H.clamp((t - a) / (b - a));
435
+ const inv = (u) => (u < 0.5 ? Math.cbrt(u / 4) : 1 - Math.cbrt((1 - u) * 2) / 2); // inverse of H.ease.inOut
436
+ // crystal: a struck glass facet (body + one inharmonic partial, kept below ~2.4 kHz), with room
437
+ const glass = (t, f, g, p = 0, dur = 0.9, minor) => { const F = k.hz(f); k.tone(t, { f: F, type: 'triangle', dur, gain: 0.09 * g, a: 0.003, pan: p, verb: 0.35, minor }); k.tone(t, { f: F * 2.32, dur: dur * 0.5, gain: 0.03 * g, a: 0.002, pan: p, verb: 0.35, minor }); };
438
+ // faceted tag: a cut-corner tag snapping on (short dry knock with a hard edge, low-mid)
439
+ const facet = (t, f, g, p = 0, minor) => { k.play('tock', t, { f, gain: 0.45 * g, pan: p, minor }); k.noise(t, { dur: 0.02, filter: 'bandpass', f: f * 2.6, q: 3, gain: 0.18 * g, a: 0.001, pan: p, minor }); };
440
+ // camera flight: a soft gust of air, broken into a few angled filter steps (faceted), swelling with camera speed
441
+ const gust = (t0, t1, g = 1) => {
442
+ const d = t1 - t0, steps = [260, 420, 610, 470, 300];
443
+ steps.forEach((f, i) => { const s = t0 + (d * i) / steps.length, dd = (d / steps.length) * 1.9; k.noise(s, { dur: dd, color: 'pink', filter: 'bandpass', f: [[0, f], [dd, f * 1.25]], q: 1.4, gain: 0.04 * g * Math.sin(((i + 0.5) / steps.length) * Math.PI), a: dd * 0.45, verb: 0.15 }); });
444
+ };
445
+ const counter = (a, b, val, f, g, p, minGap, avoid = []) => {
446
+ let last = -1, lastV = val(a);
447
+ const top = Math.abs(val(b) - val(a)) / (b - a) * 2.2 * 0.1;
448
+ for (let t = a; t <= b + 1e-6; t += 1 / 120) {
449
+ const v = val(t); if (v === lastV) continue;
450
+ const speed = Math.abs(val(Math.min(b, t + 0.05)) - val(Math.max(a, t - 0.05)));
451
+ const gap = H.clamp(minGap / Math.max(0.2, Math.min(1, speed / top)), minGap, 0.4);
452
+ if (t - last >= gap && !avoid.some((x) => t > x - 0.03 && t < x + 0.12)) { k.play('tick', t, { f, gain: g, pan: p, minor: true }); k.tone(t, { f: f / 9, dur: 0.03, gain: 0.05 * g, pan: p, minor: true }); last = t; }
453
+ lastV = v;
454
+ }
455
+ };
456
+
457
+ k.bed('room', 0, D, { gain: 0.2 });
458
+ k.noise(0, { dur: D, color: 'pink', filter: 'lowpass', f: [[0, 380], [D * 0.5, 520], [D, 360]], gain: 0.03, a: 0.8, hold: D - 1.6, bus: 'amb', minor: true }); // high valley air
459
+ k.music('pad', 0, D, { bpm: 96, gain: 0.25, chords: [['D4', 'F#4', 'A4', 'C#5'], ['B3', 'D4', 'F#4', 'A4'], ['G3', 'B3', 'D4', 'F#4'], ['A3', 'C#4', 'E4', 'G4'], ['D4', 'F#4', 'A4', 'D5']] });
460
+
461
+ // ---- hook: question fades up (EO 0.1-0.6), shrinks into the header (1.4-2.4)
462
+ glass(0.12, 'A4', 1.1, 0, 1.4); glass(0.12, 'D4', 0.8, 0, 1.4);
463
+ k.noise(1.4, { dur: 1.0, color: 'pink', filter: 'lowpass', f: [[0, 650], [1.0, 280]], gain: 0.05, a: 0.4, minor: true });
464
+ gust(1.5, 2.9); // dive down into the valley
465
+
466
+ // ---- beat 2: river of example cards
467
+ k.noise(2.2, { dur: 4.5, color: 'pink', filter: 'bandpass', f: 1100, q: 0.6, gain: 0.02, a: 0.5, hold: 3.4, bus: 'amb', minor: true }); // the river under the camera
468
+ const busy = []; // card plops + totem rings, kept clear of counter ticks
469
+ for (let j = 0; j < 13; j++) { const t = Math.max(2.3, 2.3 + (j * 4.6 - 2) / 12); if (t > 6.55) break; busy.push(t); const f = 330 + ((j * 37) % 5) * 22; k.tone(t, { f: [[0, f], [0.07, f * 0.55]], dur: 0.11, gain: 0.09, pan: (Math.sin(j * 2.7) * 3) / 12, minor: true }); k.noise(t, { dur: 0.04, filter: 'bandpass', f: 1500, q: 1.5, gain: 0.07, pan: 0, minor: true }); } // a card settles on the water
470
+ k.play('pop', 2.44, { f: 520, gain: 0.5, minor: true }); // cat/dog tags appear on the cards
471
+ facet(2.75, 520, 1, -0.45); // counter tag snaps onto the totem
472
+ // totem grows one faceted stone ring at a time (ceil(stackH/1.2), stackH = 1 + 9 * EO(2.8,5.8)^1.2)
473
+ for (let n = 2; n <= 9; n++) { const t = 2.8 + 3.0 * (1 - Math.cbrt(1 - Math.pow(((n - 1) * 1.2 - 1) / 9 + 1e-4, 1 / 1.2))); if (t < 5.8) { busy.push(t); k.play('tock', t, { f: 210 + n * 8, gain: 0.5, pan: -0.45, minor: true }); k.noise(t, { dur: 0.06, color: 'brown', filter: 'lowpass', f: 600, gain: 0.25, pan: -0.45, minor: true }); } }
474
+ counter(2.95, 5.66, (t) => Math.floor(1e6 * Math.pow(H.ease.out(ph(t, 2.9, 5.7)), 1.6)), 3000, 1.1, -0.45, 1 / 8, busy);
475
+ // two-tone ribbon arrow unfurls toward the crystal (E 3.2-4.2), then "the model" tag
476
+ k.noise(3.2, { dur: 1.0, color: 'pink', filter: 'bandpass', f: [[0, 500], [1.0, 1400]], q: 1.2, gain: 0.06, a: 0.5, pan: 0.2, minor: true });
477
+ facet(4.04, 470, 0.9, 0.35);
478
+ // 1,000,000 lands
479
+ facet(5.7, 600, 1.1, -0.45); glass(5.7, 'A4', 1, -0.4); glass(5.7, 'E5', 0.6, -0.4);
480
+
481
+ // ---- beat 3: test card, the crystal guesses
482
+ facet(5.93, 420, 0.9); // coral "?" on the test card
483
+ gust(5.7, 6.9);
484
+ k.play('thud', 6.62, { f: 110, gain: 0.35, pan: 0.5 }); k.noise(6.62, { dur: 0.3, color: 'brown', filter: 'lowpass', f: 500, gain: 0.12, pan: 0.5 }); // answer sign rises out of the plateau
485
+ k.noise(6.8, { dur: 0.35, color: 'pink', filter: 'bandpass', f: [[0, 600], [0.35, 1500]], q: 1.2, gain: 0.07, a: 0.15, pan: 0.2, minor: true }); // Guess ribbon
486
+ facet(6.93, 560, 0.9, 0.1); // "1 Guess"
487
+ glass(7.05, 'F#4', 0.9, 0.5); // "dog?" appears on the sign
488
+ // CHECK: wrong. sign shakes, hex X badge stamps, burst ring
489
+ k.play('thud', 7.45, { f: 120, gain: 0.7, pan: 0.5 });
490
+ k.play('error', 7.47, { f: 'G3', gain: 0.85, pan: 0.5 });
491
+ // ADJUST: the error shard flies back to the crystal (E 8.0-8.6), crystal flushes coral
492
+ k.noise(8.0, { dur: 0.6, color: 'pink', filter: 'bandpass', f: [[0, 1300], [0.6, 450]], q: 1.4, gain: 0.08, a: 0.3, pan: 0.2 });
493
+ glass(8.6, 'C#4', 0.9, 0); k.tone(8.6, { f: 'C4', type: 'triangle', dur: 0.5, gain: 0.05, verb: 0.3 }); // shard hits: a slightly sour facet ring
494
+ facet(8.15, 640, 0.9, 0.2, true); // "error"
495
+ facet(8.55, 500, 0.9, 0); // "3 Adjust"
496
+ // facets realign (E 8.6-9.4): one glassy clink per facet group turning, climbing into tune
497
+ ['D4', 'F#4', 'A4', 'B4', 'D5', 'F#5'].forEach((n, i) => glass(8.6 + 0.8 * inv((i + 0.5) / 6), n, 0.75, (i - 2.5) * 0.15, 0.7, true));
498
+ // CORRECT: sign reads cat (9.5), check badge + "Guess again" (9.55)
499
+ glass(9.5, 'D5', 0.5, 0.5);
500
+ k.play('success', 9.56, { f: 'D5', gain: 0.45, pan: 0.5 });
501
+ k.noise(10.4, { dur: 0.6, color: 'pink', filter: 'lowpass', f: [[0, 600], [0.6, 250]], gain: 0.05, a: 0.2, pan: 0.5, minor: true }); // sign sinks away
502
+
503
+ // ---- beat 4: pillars rise on the plateau, one per training round
504
+ gust(10.2, 11.2);
505
+ facet(10.93, 560, 0.8); // Accuracy tag
506
+ ['D3', 'E3', 'F#3', 'A3', 'B3', 'D4', 'E4', 'F#4'].forEach((n, i) => {
507
+ const t = 11.0 + i * 0.2 + 0.02, F = k.hz(n);
508
+ k.noise(t, { dur: 0.22, color: 'brown', filter: 'bandpass', f: [[0, 250], [0.2, 600]], q: 1, gain: 0.2, a: 0.03, pan: -0.2 + i * 0.08, minor: i < 7 }); // stone grinding up
509
+ k.tone(t, { f: [[0, F * 0.8], [0.1, F]], type: 'triangle', dur: 0.25, gain: 0.12, pan: -0.2 + i * 0.08, minor: i < 7 });
510
+ });
511
+ counter(11.03, 12.56, (t) => Math.round(H.lerp(61, 97, H.ease.inOut(ph(t, 11.0, 12.6)))), 2600, 0.9, 0.2, 1 / 12, [0, 1, 2, 3, 4, 5, 6, 7].map((i) => 11.02 + i * 0.2));
512
+ // 97%: the big hit. coral tag swells, hexagonal ring expands: a full crystal chord
513
+ k.play('impact', 12.6, { gain: 1.1 });
514
+ ['D4', 'A4', 'D5', 'F#5'].forEach((n, i) => glass(12.6 + i * 0.03, n, 1.7 - i * 0.25, (i - 1.5) * 0.25, 1.6));
515
+ gust(12.8, 13.9, 0.9); // pull back over the valley
516
+ // takeaway lands (back 13.0-13.45): resolve
517
+ facet(13.08, 470, 0.9);
518
+ ['A4', 'D5'].forEach((n, i) => glass(13.3 + i * 0.09, n, 1, (i - 0.5) * 0.3, 1.4)); k.tone(13.3, { f: 'D3', type: 'triangle', dur: 1.2, gain: 0.12, a: 0.02 });
519
+ }
520
+
521
+ registerStyle({
522
+ id: 'low-poly',
523
+ name: 'Low-Poly Faceted',
524
+ category: 'Dimensional',
525
+ description: 'Faceted low-poly 3D: a triangulated noise terrain with flat per-face Lambert shading, atmospheric depth fog, cone trees and a faceted rocket lifting off into a dawn gradient sky.',
526
+ motion: 'Terrain facets flip into place from the camera out to the horizon, trees and the launch pad pop up, then the rocket ignites and lifts off on a faceted flame and smoke column while the camera dollies forward.',
527
+ duration: 5,
528
+ fonts: ['700 54px "Space Grotesk"', '400 16px "Space Grotesk"', '700 24px "Space Grotesk"'],
529
+ frameT: 4.5,
530
+ readsPixels: false,
531
+ explainerDuration: 14.5,
532
+ explainerNote: 'A continuous camera flight through one faceted valley (overview → river of labelled example cards → floating crystal model whose facets realign → pillar chart on a plateau → pull back), with angular two-tone ribbon arrows, cut-corner tags pinned to objects and Space Grotesk counters.',
533
+ explainer: lpExplainer,
534
+ explainerSound: lpSound,
535
+ draw(ctx, W, H_, t) {
536
+ const nz = H.makeNoise(31);
537
+ const R = H.rng(77);
538
+ const SUN_DIR = norm([0.75, 0.55, 0.45]);
539
+ const SUN_COL = [255, 226, 190], AMB = [104, 98, 150];
540
+ const FOG = [236, 160, 150], FOG_HI = [180, 140, 190];
541
+ const cam = makeCamera([0, 22, -18.4 + t * 0.9], 0.13, 780, W, H_);
542
+ const ph = (a, b) => H.clamp((t - a) / (b - a));
543
+
544
+ // ---------- sky ----------
545
+ const sky = ctx.createLinearGradient(0, 0, 0, 300);
546
+ sky.addColorStop(0, '#1b2350'); sky.addColorStop(0.38, '#4d3f84'); sky.addColorStop(0.7, '#c06a93'); sky.addColorStop(1, '#ffb08a');
547
+ ctx.fillStyle = sky; ctx.fillRect(0, 0, W, H_);
548
+ // stars
549
+ for (let i = 0; i < 90; i++) {
550
+ const x = R() * W, y = R() * 160, a = (1 - y / 160) * R() * 0.8;
551
+ ctx.fillStyle = `rgba(255,240,255,${a})`; ctx.fillRect(x, y, R() < 0.1 ? 2 : 1, R() < 0.1 ? 2 : 1);
552
+ }
553
+ // low-poly sun (faceted disc) with halo
554
+ const sunC = [560, 232 + (1 - H.ease.out(H.clamp(t / 4.5))) * 34];
555
+ {
556
+ const g = ctx.createRadialGradient(sunC[0], sunC[1], 30, sunC[0], sunC[1], 330);
557
+ g.addColorStop(0, 'rgba(255,214,160,0.55)'); g.addColorStop(1, 'rgba(255,214,160,0)');
558
+ ctx.fillStyle = g; ctx.fillRect(0, 0, W, H_);
559
+ const n = 14, r = 62;
560
+ for (let i = 0; i < n; i++) {
561
+ const a0 = (i / n) * Math.PI * 2, a1 = ((i + 1) / n) * Math.PI * 2;
562
+ const k = 0.5 + 0.5 * Math.cos(a0 - 2.3);
563
+ ctx.fillStyle = H.rgba(H.mix('#ffd49a', '#fff4d8', k));
564
+ ctx.beginPath(); ctx.moveTo(sunC[0], sunC[1]); ctx.lineTo(sunC[0] + Math.cos(a0) * r, sunC[1] + Math.sin(a0) * r); ctx.lineTo(sunC[0] + Math.cos(a1) * r, sunC[1] + Math.sin(a1) * r); ctx.closePath(); ctx.fill(); ctx.strokeStyle = ctx.fillStyle; ctx.lineWidth = 0.8; ctx.stroke();
565
+ }
566
+ }
567
+ // faceted clouds (2D low-poly)
568
+ const cloud = (cx, cy, s, a, seed) => {
569
+ const cr = H.rng(seed);
570
+ const bumps = [[-0.75, 0.05, 0.38], [-0.3, -0.18, 0.5], [0.22, -0.28, 0.58], [0.72, -0.02, 0.4]];
571
+ ctx.save(); ctx.beginPath(); ctx.rect(cx - s * 2, cy - s * 2, s * 4, s * 2 + s * 0.18); ctx.clip();
572
+ for (const [bx, by, br] of bumps) {
573
+ const ox = cx + bx * s, oy = cy + by * s, rr = br * s, n = 7, rot = cr() * 3;
574
+ for (let i = 0; i < n; i++) {
575
+ const a0 = rot + (i / n) * Math.PI * 2, a1 = rot + ((i + 1) / n) * Math.PI * 2;
576
+ const lit = 0.5 - 0.5 * Math.sin((a0 + a1) / 2) ; // top facets lighter
577
+ const c = H.mix([150, 108, 168], [255, 206, 200], H.clamp(lit * 0.9 + cr() * 0.15));
578
+ ctx.fillStyle = H.rgba(c, a); ctx.strokeStyle = H.rgba(c, a); ctx.lineWidth = 0.6;
579
+ ctx.beginPath(); ctx.moveTo(ox, oy + rr * 0.15); ctx.lineTo(ox + Math.cos(a0) * rr, oy + Math.sin(a0) * rr); ctx.lineTo(ox + Math.cos(a1) * rr, oy + Math.sin(a1) * rr); ctx.closePath(); ctx.fill(); ctx.stroke();
580
+ }
581
+ }
582
+ ctx.restore();
583
+ };
584
+ ctx.globalAlpha = 1;
585
+ cloud(300 + t * 6, 268, 80, 0.9, 1); cloud(1080 - t * 4, 120, 75, 0.8, 2); cloud(900 + t * 3, 240, 48, 0.7, 3);
586
+
587
+ // ---------- build triangle list ----------
588
+ const tris = [];
589
+ const pushTri = (a, b, c, col, opt = {}) => tris.push({ p: [a, b, c], col, ...opt });
590
+
591
+ // terrain heightfield
592
+ const PAD = [12, 58];
593
+ const height = (x, z) => {
594
+ const valley = Math.pow(Math.abs(x - 6 * Math.sin(z * 0.03)) / 60, 1.8) * 17;
595
+ const far = H.smooth(90, 168, z) * 14 + Math.max(0, nz.n2(x * 0.035, 3.3)) * 26 * H.smooth(110, 168, z);
596
+ let h = nz.fbm2(x * 0.045, z * 0.045, 4) * 9 + nz.fbm2(x * 0.11 + 10, z * 0.11, 2) * 2.5 + valley + far - 3;
597
+ // plateau for launch pad
598
+ const dp = Math.hypot(x - PAD[0], z - PAD[1]);
599
+ h = H.lerp(2.2, h, H.smooth(5, 11, dp));
600
+ return h;
601
+ };
602
+ const WATER = -0.6;
603
+ const CELL = 3.6, X0 = -78, X1 = 78, Z0 = 2, Z1 = 170;
604
+ const nx = Math.round((X1 - X0) / CELL), nzc = Math.round((Z1 - Z0) / CELL);
605
+ const jr = H.rng(5);
606
+ const V = [];
607
+ for (let j = 0; j <= nzc; j++) {
608
+ const row = [];
609
+ for (let i = 0; i <= nx; i++) {
610
+ const cellScale = 1 + j * 0.035; // larger cells far away
611
+ let x = X0 + i * CELL + (i > 0 && i < nx ? jr.range(-0.38, 0.38) * CELL : 0);
612
+ let z = Z0 + j * CELL + (j > 0 ? jr.range(-0.38, 0.38) * CELL : 0);
613
+ void cellScale;
614
+ row.push([x, height(x, z), z]);
615
+ }
616
+ V.push(row);
617
+ }
618
+ const terrainColor = (y, slope, z) => {
619
+ let c;
620
+ if (y < WATER + 0.6) c = [214, 196, 150]; // sand
621
+ else if (y < 6) c = H.mix([86, 160, 112], [60, 128, 96], H.clamp(y / 6));
622
+ else if (y < 14) c = H.mix([60, 128, 96], [110, 112, 120], H.smooth(9, 14, y));
623
+ else if (y < 22) c = [118, 110, 128];
624
+ else c = [244, 238, 248];
625
+ if (slope > 0.55 && y > 3 && y < 22) c = H.mix(c, [124, 112, 124], 0.6);
626
+ return c;
627
+ };
628
+ for (let j = 0; j < nzc; j++) for (let i = 0; i < nx; i++) {
629
+ const a = V[j][i], b = V[j][i + 1], c = V[j + 1][i], d = V[j + 1][i + 1];
630
+ const flip = (i + j) % 2 === 0;
631
+ const faces = flip ? [[a, c, b], [b, c, d]] : [[a, c, d], [a, d, b]];
632
+ for (const f of faces) {
633
+ const my = (f[0][1] + f[1][1] + f[2][1]) / 3;
634
+ if (Math.max(f[0][1], f[1][1], f[2][1]) < WATER) {
635
+ const w = f.map(p => [p[0], WATER + nz.n2(p[0] * 0.4, p[2] * 0.4) * 0.35, p[2]]);
636
+ pushTri(w[0], w[1], w[2], [96, 120, 190], { water: true });
637
+ continue;
638
+ }
639
+ const n = norm(cross(sub(f[1], f[0]), sub(f[2], f[0])));
640
+ const slope = 1 - Math.abs(n[1]);
641
+ pushTri(f[0], f[1], f[2], terrainColor(my, slope, f[0][2]), { terrain: true });
642
+ }
643
+ }
644
+
645
+ // trees: low-poly conifers (two stacked 5-sided cones)
646
+ const meshTris = (verts, faces, col, center, opt) => {
647
+ for (const [i, j, k] of faces) pushTri(verts[i], verts[j], verts[k], col, { center, ...opt });
648
+ };
649
+ const cone = (base, r, h, sides, col, rot = 0) => {
650
+ const vs = [add3(base, [0, h, 0])];
651
+ for (let i = 0; i < sides; i++) { const a = rot + (i / sides) * Math.PI * 2; vs.push(add3(base, [Math.cos(a) * r, 0, Math.sin(a) * r])); }
652
+ const fs = []; for (let i = 0; i < sides; i++) fs.push([0, 1 + i, 1 + ((i + 1) % sides)]);
653
+ meshTris(vs, fs, col, add3(base, [0, h * 0.3, 0]), { tree: true });
654
+ };
655
+ const tr = H.rng(9);
656
+ let placed = 0;
657
+ for (let k = 0; k < 900 && placed < 150; k++) {
658
+ const x = tr.range(-60, 60), z = tr.range(10, 110);
659
+ const y = height(x, z);
660
+ if (y < 0.4 || y > 11) continue;
661
+ if (Math.hypot(x - PAD[0], z - PAD[1]) < 9) continue;
662
+ if (nz.fbm2(x * 0.05 + 40, z * 0.05, 2) < -0.05) continue; // clustered forests
663
+ const s = tr.range(1.3, 2.1) * (1 + z / 160);
664
+ const green = H.mix([40, 110, 90], [70, 140, 100], tr());
665
+ const rot = tr() * 6;
666
+ cone([x, y - 0.2, z], s * 0.75, s * 1.6, 5, green, rot);
667
+ cone([x, y + s * 0.85, z], s * 0.55, s * 1.4, 5, H.mix(green, [120, 180, 120], 0.25), rot + 0.6);
668
+ placed++;
669
+ }
670
+ // rocks
671
+ for (let k = 0; k < 18; k++) {
672
+ const x = tr.range(-30, 40), z = tr.range(14, 60), y = height(x, z);
673
+ if (y < WATER + 0.2) continue;
674
+ const r = tr.range(0.6, 1.4);
675
+ const vs = ICO.v.map(v => [x + v[0] * r * tr.range(0.8, 1.2), y + v[1] * r * 0.6, z + v[2] * r * tr.range(0.8, 1.2)]);
676
+ meshTris(vs, ICO.f, [140, 128, 150], [x, y, z], { tree: true });
677
+ }
678
+
679
+ // launch pad + tower
680
+ const padY = 2.2;
681
+ const boxMesh = (x0, y0, z0, x1, y1, z1, col) => {
682
+ const v = [[x0, y0, z0], [x1, y0, z0], [x1, y0, z1], [x0, y0, z1], [x0, y1, z0], [x1, y1, z0], [x1, y1, z1], [x0, y1, z1]];
683
+ const f = [[4, 5, 6], [4, 6, 7], [0, 1, 5], [0, 5, 4], [1, 2, 6], [1, 6, 5], [2, 3, 7], [2, 7, 6], [3, 0, 4], [3, 4, 7]];
684
+ meshTris(v, f, col, [(x0 + x1) / 2, (y0 + y1) / 2, (z0 + z1) / 2], { build: 1.25 });
685
+ };
686
+ boxMesh(PAD[0] - 4, padY - 1, PAD[1] - 4, PAD[0] + 4, padY + 0.5, PAD[1] + 4, [180, 176, 196]);
687
+ boxMesh(PAD[0] - 4.2, padY + 0.5, PAD[1] + 0.6, PAD[0] - 3, padY + 16, PAD[1] + 1.8, [200, 90, 80]);
688
+ boxMesh(PAD[0] - 4.2, padY + 13, PAD[1] + 0.6, PAD[0] - 0.8, padY + 13.8, PAD[1] + 1.8, [200, 90, 80]);
689
+
690
+ // rocket (8-sided body + nose + fins), climbing
691
+ const tt = Math.max(0, t - 2.3);
692
+ const climb = -3.6 + 4.0 * tt * tt;
693
+ const ign = H.ease.out(ph(1.85, 2.3));
694
+ const rb = [PAD[0] + climb * 0.08, padY + 4 + climb, PAD[1]];
695
+ {
696
+ const sides = 8, r = 1.35, hb = 8.5;
697
+ const body = (y0, y1, rr0, rr1, col) => {
698
+ const vs = [];
699
+ for (let i = 0; i < sides; i++) { const a = (i / sides) * Math.PI * 2 + 0.2; vs.push(add3(rb, [Math.cos(a) * rr0, y0, Math.sin(a) * rr0])); }
700
+ for (let i = 0; i < sides; i++) { const a = (i / sides) * Math.PI * 2 + 0.2; vs.push(add3(rb, [Math.cos(a) * rr1, y1, Math.sin(a) * rr1])); }
701
+ const fs = []; for (let i = 0; i < sides; i++) { const j = (i + 1) % sides; fs.push([i, j, sides + j], [i, sides + j, sides + i]); }
702
+ meshTris(vs, fs, col, add3(rb, [0, (y0 + y1) / 2, 0]), { rocket: true });
703
+ };
704
+ body(0, 1.6, r * 1.05, r, [255, 112, 96]);
705
+ body(1.6, hb, r, r, [244, 240, 250]);
706
+ body(hb, hb + 1.1, r, r * 0.92, [255, 112, 96]);
707
+ // nose cone
708
+ const vs = [add3(rb, [0, hb + 4.4, 0])];
709
+ for (let i = 0; i < sides; i++) { const a = (i / sides) * Math.PI * 2 + 0.2; vs.push(add3(rb, [Math.cos(a) * r * 0.92, hb + 1.1, Math.sin(a) * r * 0.92])); }
710
+ const fs = []; for (let i = 0; i < sides; i++) fs.push([0, 1 + i, 1 + ((i + 1) % sides)]);
711
+ meshTris(vs, fs, [244, 240, 250], add3(rb, [0, hb + 2, 0]), { rocket: true });
712
+ // window (small octagon facing camera) handled as two tris
713
+ // fins (double-sided)
714
+ for (let k = 0; k < 4; k++) {
715
+ const a = (k / 4) * Math.PI * 2 + Math.PI / 4 + 0.2;
716
+ const o = [Math.cos(a), 0, Math.sin(a)];
717
+ const p0 = add3(rb, add3(scl(o, r * 0.95), [0, 3.4, 0])), p1 = add3(rb, add3(scl(o, r * 0.95), [0, -0.2, 0])), p2 = add3(rb, add3(scl(o, r + 2.2), [0, -1.4, 0]));
718
+ pushTri(p0, p1, p2, [235, 92, 84], { twoSided: true, rocket: true });
719
+ }
720
+ // flame: emissive faceted cones
721
+ const fl = (1 + Math.sin(t * 30) * 0.08) * ign * (1 + Math.sin(t * 47) * 0.05);
722
+ const flame = (len, rr, col) => {
723
+ const v = [add3(rb, [0, -len * fl, 0])];
724
+ for (let i = 0; i < 7; i++) { const a = (i / 7) * Math.PI * 2; v.push(add3(rb, [Math.cos(a) * rr, -0.2, Math.sin(a) * rr])); }
725
+ for (let i = 0; i < 7; i++) pushTri(v[0], v[1 + i], v[1 + ((i + 1) % 7)], H.mix(col, [255, 255, 230], (i % 3) * 0.18), { emissive: true, center: add3(rb, [0, -len * 0.3, 0]), bias: -0.5 });
726
+ };
727
+ if (ign > 0.01) { flame(9, 1.25, [255, 140, 60]); flame(5.5, 0.9, [255, 220, 120]); }
728
+ }
729
+ // smoke trail: faceted puffs from pad up to rocket
730
+ const pr = H.rng(21);
731
+ const trailTop = rb[1] - 7;
732
+ for (let k = 0; k < 26 && trailTop > padY + 2.5; k++) {
733
+ const u = k / 25;
734
+ const y = H.lerp(padY + 1, trailTop, u);
735
+ const spread = (1 - u) * 4 + 0.8;
736
+ const x = H.lerp(PAD[0], rb[0], u) + pr.range(-1, 1) * spread * 0.6;
737
+ const z = PAD[1] + pr.range(-1, 1) * spread * 0.6 - (1 - u) * 2;
738
+ const r = (1 - u) * 2.6 + 0.9 + pr() * 0.8 + Math.sin(t + k) * 0.12;
739
+ const vs = ICO.v.map(v => [x + v[0] * r * pr.range(0.85, 1.15), y + v[1] * r * 0.85, z + v[2] * r * pr.range(0.85, 1.15)]);
740
+ meshTris(vs, ICO.f, H.mix([250, 236, 240], [220, 205, 225], pr()), [x, y, z], { smoke: true });
741
+ }
742
+ // ground smoke billow around pad
743
+ for (let k = 0; k < 14; k++) {
744
+ const a = (k / 14) * Math.PI * 2 + pr() * 0.3, d = pr.range(5, 9);
745
+ const x = PAD[0] + Math.cos(a) * d, z = PAD[1] + Math.sin(a) * d * 0.7;
746
+ const y = Math.max(height(x, z), padY) + 1;
747
+ const r = pr.range(1.8, 3.0) * H.ease.out(ph(1.95 + k * 0.03, 2.8 + k * 0.03));
748
+ if (r < 0.05) continue;
749
+ const vs = ICO.v.map(v => [x + v[0] * r, y + v[1] * r * 0.7, z + v[2] * r]);
750
+ meshTris(vs, ICO.f, [246, 232, 238], [x, y, z], { smoke: true });
751
+ }
752
+
753
+ // ---------- shade, cull, project, sort ----------
754
+ const out = [];
755
+ for (const tri of tris) {
756
+ const [a, b, c] = tri.p;
757
+ let n = norm(cross(sub(b, a), sub(c, a)));
758
+ const cen = scl(add3(add3(a, b), c), 1 / 3);
759
+ if (tri.terrain || tri.water) { if (n[1] < 0) n = scl(n, -1); }
760
+ else if (tri.center) { if (dot(n, sub(cen, tri.center)) < 0) n = scl(n, -1); }
761
+ const toCam = sub(cam.pos, cen);
762
+ if (tri.twoSided) { if (dot(n, toCam) < 0) n = scl(n, -1); }
763
+ else if (dot(n, toCam) <= 0) continue; // back-face cull
764
+ let pa = cam.proj(a), pb = cam.proj(b), pc = cam.proj(c);
765
+ if (pa[2] < 0.5 || pb[2] < 0.5 || pc[2] < 0.5) continue;
766
+ const depth = (pa[2] + pb[2] + pc[2]) / 3 + (tri.bias || 0);
767
+ // build: facets flip in from the camera out to the horizon (scale up about their screen centroid)
768
+ let flash = 0;
769
+ if (!tri.smoke && !tri.emissive) {
770
+ const jit = (Math.sin(cen[0] * 12.9898 + cen[2] * 78.233) * 43758.5453) % 1;
771
+ let at = tri.rocket ? 1.55 : tri.build ? tri.build : 0.05 + H.clamp(depth / 175) * 1.3 + Math.abs(jit) * 0.22 + (tri.tree ? 0.35 : 0);
772
+ const pr2 = H.ease.out(ph(at, at + 0.38));
773
+ if (pr2 <= 0) continue;
774
+ if (pr2 < 1) {
775
+ const mx = (pa[0] + pb[0] + pc[0]) / 3, my = (pa[1] + pb[1] + pc[1]) / 3;
776
+ const sq = (p) => [mx + (p[0] - mx) * pr2, my + (p[1] - my) * pr2, p[2]];
777
+ pa = sq(pa); pb = sq(pb); pc = sq(pc); flash = (1 - pr2) * 0.7;
778
+ }
779
+ }
780
+ let col;
781
+ if (tri.emissive) col = tri.col;
782
+ else {
783
+ const lam = Math.max(0, dot(n, SUN_DIR));
784
+ const k = tri.smoke ? 0.55 + 0.45 * lam : tri.rocket ? 0.3 + 0.8 * lam : lam;
785
+ col = [0, 1, 2].map(i => tri.col[i] * (AMB[i] / 255 * 0.85 + SUN_COL[i] / 255 * k * 0.95));
786
+ if (tri.water) {
787
+ // facet glints of sky + sun
788
+ const v = norm(toCam), rf = sub(scl(n, 2 * dot(n, v)), v);
789
+ const spec = Math.pow(Math.max(0, dot(rf, norm([0.5, 0.2, 1]))), 12);
790
+ col = H.mix(H.mix([120, 110, 190], [250, 170, 165], H.clamp(0.45 + n[0] * 4 + n[2] * 2)), [255, 236, 200], spec);
791
+ }
792
+ if (tri.smoke) col = H.mix(col, [255, 210, 200], 0.15);
793
+ }
794
+ // atmospheric fog by depth (warmer near horizon, cooler on high peaks)
795
+ const fogK = tri.emissive ? 0 : H.clamp(Math.pow(H.smooth(30, 185, depth), 1.15) * 0.9);
796
+ const fc = H.mix(FOG, FOG_HI, H.clamp(cen[1] / 30));
797
+ col = H.mix(col, fc, fogK);
798
+ if (flash) col = H.mix(col, [255, 236, 226], flash);
799
+ out.push({ pa, pb, pc, depth, col });
800
+ }
801
+ out.sort((u, v) => v.depth - u.depth);
802
+ ctx.lineJoin = 'round';
803
+ for (const o of out) {
804
+ const fs = `rgb(${o.col[0] | 0},${o.col[1] | 0},${o.col[2] | 0})`;
805
+ ctx.fillStyle = fs; ctx.strokeStyle = fs; ctx.lineWidth = 0.9;
806
+ ctx.beginPath(); ctx.moveTo(o.pa[0], o.pa[1]); ctx.lineTo(o.pb[0], o.pb[1]); ctx.lineTo(o.pc[0], o.pc[1]); ctx.closePath();
807
+ ctx.fill(); ctx.stroke();
808
+ }
809
+ // flame glow
810
+ {
811
+ const p = cam.proj(add3(rb, [0, -2, 0]));
812
+ const g = ctx.createRadialGradient(p[0], p[1], 2, p[0], p[1], 120);
813
+ g.addColorStop(0, `rgba(255,200,120,${0.55 * ign})`); g.addColorStop(1, 'rgba(255,160,100,0)');
814
+ ctx.globalCompositeOperation = 'lighter'; ctx.fillStyle = g; ctx.fillRect(p[0] - 130, p[1] - 130, 260, 260); ctx.globalCompositeOperation = 'source-over';
815
+ }
816
+
817
+ // ---------- type ----------
818
+ const kick = 'EPISODE 07 — ROCKET SCIENCE';
819
+ ctx.fillStyle = 'rgba(255,255,255,0.75)'; ctx.font = '400 16px "Space Grotesk"';
820
+ ctx.fillText(kick.slice(0, Math.floor(kick.length * ph(1.3, 1.8))), 72, 96);
821
+ const tp = H.ease.out(ph(1.6, 2.15));
822
+ ctx.save(); ctx.beginPath(); ctx.rect(60, 100, 700, 64); ctx.clip();
823
+ ctx.fillStyle = '#ffffff'; ctx.font = '700 54px "Space Grotesk"';
824
+ ctx.fillText('Next stop: orbit', 70, 152 + (1 - tp) * 62); ctx.restore();
825
+ const ul = H.ease.out(ph(2.0, 2.4));
826
+ ctx.save(); ctx.beginPath(); ctx.rect(60, 165, 10 + 180 * ul, 20); ctx.clip();
827
+ // faceted underline
828
+ ctx.fillStyle = '#ff7060'; ctx.beginPath(); ctx.moveTo(72, 170); ctx.lineTo(200, 170); ctx.lineTo(188, 178); ctx.lineTo(72, 178); ctx.fill();
829
+ ctx.fillStyle = '#ffb08a'; ctx.beginPath(); ctx.moveTo(200, 170); ctx.lineTo(236, 170); ctx.lineTo(224, 178); ctx.lineTo(188, 178); ctx.fill();
830
+ ctx.restore();
831
+ },
832
+ });
833
+ }