@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,1124 @@
1
+ {
2
+ // ================= BIOLUMINESCENT DEEP SEA =================
3
+ // The midnight zone: near-black water, drifting marine snow in parallax, and living light
4
+ // (jellyfish, siphonophores, comb jellies, an anglerfish lure). All light is additive.
5
+ const TAU = Math.PI * 2;
6
+ const cl = (v, a = 0, b = 1) => Math.max(a, Math.min(b, v));
7
+ const sm = (a, b, x) => H.smooth(a, b, x);
8
+ const E = H.ease;
9
+ const lerp = H.lerp;
10
+ const WH = [255, 255, 255];
11
+ const C = {
12
+ cyan: [80, 232, 255], teal: [40, 230, 195], blue: [70, 140, 255], violet: [150, 120, 255],
13
+ mag: [255, 80, 205], amber: [255, 172, 70], red: [255, 74, 60], snow: [178, 206, 228], green: [110, 255, 190],
14
+ ice: [190, 250, 255],
15
+ };
16
+ const F = {
17
+ title: (px) => `600 ${px}px "Fraunces"`,
18
+ titleI: (px) => `italic 600 ${px}px "Fraunces"`,
19
+ num: (px) => `700 ${px}px "Fraunces"`,
20
+ label: (px) => `700 ${px}px "Space Grotesk"`,
21
+ hud: (px) => `400 ${px}px "IBM Plex Mono"`,
22
+ };
23
+ const hash = (n) => { const s = Math.sin(n * 127.1 + 311.7) * 43758.5453; return s - Math.floor(s); };
24
+ const hsl = (h, s, l) => {
25
+ h = (((h % 360) + 360) % 360) / 360;
26
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s, p = 2 * l - q;
27
+ const f = (t) => { t = (t + 1) % 1; return t < 1 / 6 ? p + (q - p) * 6 * t : t < 0.5 ? q : t < 2 / 3 ? p + (q - p) * (2 / 3 - t) * 6 : p; };
28
+ return [f(h + 1 / 3) * 255, f(h) * 255, f(h - 1 / 3) * 255];
29
+ };
30
+
31
+ // ---------- glow sprites ----------
32
+ const SPR = {};
33
+ function spr(rgb, kind) {
34
+ const key = kind + rgb.map((v) => v | 0).join(',');
35
+ if (SPR[key]) return SPR[key];
36
+ const S = 64, c = H.layer(S, S), x = c.getContext('2d'), g = x.createRadialGradient(32, 32, 0, 32, 32, 32);
37
+ const hot = H.mix(rgb, WH, 0.6);
38
+ if (kind === 'core') {
39
+ g.addColorStop(0, H.rgba(WH, 1)); g.addColorStop(0.1, H.rgba(hot, 0.9)); g.addColorStop(0.3, H.rgba(rgb, 0.35));
40
+ g.addColorStop(0.6, H.rgba(rgb, 0.08)); g.addColorStop(1, H.rgba(rgb, 0));
41
+ } else if (kind === 'bokeh') {
42
+ g.addColorStop(0, H.rgba(rgb, 0.45)); g.addColorStop(0.7, H.rgba(rgb, 0.55)); g.addColorStop(0.88, H.rgba(rgb, 0.8)); g.addColorStop(1, H.rgba(rgb, 0));
43
+ } else { // soft gaussian-ish glow
44
+ g.addColorStop(0, H.rgba(hot, 1)); g.addColorStop(0.12, H.rgba(rgb, 0.75)); g.addColorStop(0.35, H.rgba(rgb, 0.22));
45
+ g.addColorStop(0.65, H.rgba(rgb, 0.05)); g.addColorStop(1, H.rgba(rgb, 0));
46
+ }
47
+ x.fillStyle = g; x.fillRect(0, 0, S, S);
48
+ return (SPR[key] = c);
49
+ }
50
+ function dot(ctx, x, y, r, rgb, a, kind) {
51
+ if (a <= 0.004 || r <= 0.2) return;
52
+ const ga = ctx.globalAlpha;
53
+ ctx.globalAlpha = Math.min(1, a);
54
+ ctx.drawImage(spr(rgb, kind || 'soft'), x - r, y - r, 2 * r, 2 * r);
55
+ ctx.globalAlpha = ga;
56
+ }
57
+
58
+ // ---------- far, out-of-focus layer: drawn at 1/3 size, blurred once, scaled up (cheap depth of field) ----------
59
+ let FAR = null;
60
+ function far(ctx, W, Hh, fn, a, blur) {
61
+ if (a <= 0.004) return;
62
+ const fw = Math.ceil(W / 3), fh = Math.ceil(Hh / 3);
63
+ if (!FAR || FAR.w !== fw) { FAR = { w: fw, a: H.layer(fw, fh), b: H.layer(fw, fh) }; }
64
+ const xa = FAR.a.getContext('2d'), xb = FAR.b.getContext('2d');
65
+ xa.setTransform(1, 0, 0, 1, 0, 0); xa.globalAlpha = 1; xa.globalCompositeOperation = 'source-over'; xa.clearRect(0, 0, fw, fh);
66
+ xa.setTransform(1 / 3, 0, 0, 1 / 3, 0, 0); fn(xa); xa.setTransform(1, 0, 0, 1, 0, 0);
67
+ xb.setTransform(1, 0, 0, 1, 0, 0); xb.globalCompositeOperation = 'source-over'; xb.clearRect(0, 0, fw, fh);
68
+ xb.filter = `blur(${blur == null ? 1 : blur}px)`; xb.drawImage(FAR.a, 0, 0); xb.filter = 'none';
69
+ ctx.save(); ctx.globalCompositeOperation = 'lighter'; ctx.globalAlpha = Math.min(1, a); ctx.imageSmoothingQuality = 'high';
70
+ ctx.drawImage(FAR.b, 0, 0, fw * 3, fh * 3); ctx.restore();
71
+ }
72
+
73
+ // explainer's far animals: pre-blurred sprites (rendered once at half size)
74
+ const FARJ = [
75
+ { x: 1170, y: 660, s: 30, ph: 0.3, on: 0.42, col: C.blue, tent: 7, tl: 80, dr: 0.21, sw: 18, v: 3 },
76
+ { x: 96, y: 470, s: 22, ph: 0.7, on: 0.38, col: C.teal, tent: 6, tl: 58, tilt: 0.3, dr: 0.17, sw: 14, v: 2 },
77
+ { x: 760, y: 620, s: 26, ph: 0.5, on: 0.35, col: C.violet, tent: 6, tl: 64, tilt: -0.2, dr: 0.13, sw: 30, v: 4 },
78
+ ];
79
+ const FSPR = {};
80
+ function blurSprite(w, h, sc, blur, fn) {
81
+ const cw = Math.ceil(w * sc), ch = Math.ceil(h * sc), a = H.layer(cw, ch), b = H.layer(cw, ch);
82
+ const xa = a.getContext('2d'); xa.setTransform(sc, 0, 0, sc, 0, 0); fn(xa);
83
+ const xb = b.getContext('2d'); xb.filter = `blur(${blur}px)`; xb.drawImage(a, 0, 0); xb.filter = 'none';
84
+ return b;
85
+ }
86
+ function farJelly(i, J) {
87
+ if (FSPR['j' + i]) return FSPR['j' + i];
88
+ const w = J.s * 5, h = J.s * 2.6 + J.tl + 30, ox = w / 2, oy = J.s * 2.3;
89
+ const cv = blurSprite(w, h, 0.5, 1.4, (x) => { jelly(x, { x: ox, y: oy, s: J.s, t: 1.3 + i, ph: J.ph, on: 1, col: J.col, tent: J.tent, tl: J.tl }); });
90
+ return (FSPR['j' + i] = { cv, w, h, ox, oy });
91
+ }
92
+ function farStrand() {
93
+ if (FSPR.strand) return FSPR.strand;
94
+ const w = 1280, h = 1100, ch = [];
95
+ for (let i = 0; i < 16; i++) { const f = i / 15; ch.push([1240 - f * 230 + Math.sin(f * 3) * 22, f * 1000]); }
96
+ const cv = blurSprite(w, h, 1 / 3, 1.1, (x) => siph(x, ch, 0.7, (i) => 0.3 + 0.3 * Math.sin(-i * 0.5), 0.8, 0.36, C.violet, C.blue));
97
+ return (FSPR.strand = { cv, w, h });
98
+ }
99
+
100
+ // ---------- water ----------
101
+ let HAZE = null;
102
+ function haze() {
103
+ if (HAZE) return HAZE;
104
+ const w = 160, h = 90, c = H.layer(w, h), x = c.getContext('2d'), nz = H.makeNoise(5150), img = x.createImageData(w, h);
105
+ for (let j = 0; j < h; j++) for (let i = 0; i < w; i++) {
106
+ const v = cl(nz.fbm2(i * 0.025, j * 0.04, 4) * 0.7 + 0.45), k = (j * w + i) * 4;
107
+ img.data[k] = 20; img.data[k + 1] = 70; img.data[k + 2] = 105; img.data[k + 3] = 255 * v * v;
108
+ }
109
+ x.putImageData(img, 0, 0);
110
+ return (HAZE = c);
111
+ }
112
+ function water(ctx, W, Hh, t, depth, rays) {
113
+ const top = H.mix([12, 44, 74], [3, 12, 26], depth), mid = H.mix([4, 20, 40], [1, 6, 15], depth);
114
+ const g = ctx.createLinearGradient(0, 0, 0, Hh);
115
+ g.addColorStop(0, H.rgba(top)); g.addColorStop(0.5, H.rgba(mid)); g.addColorStop(1, 'rgb(0,2,6)');
116
+ ctx.globalCompositeOperation = 'source-over'; ctx.globalAlpha = 1; ctx.fillStyle = g; ctx.fillRect(0, 0, W, Hh);
117
+ ctx.globalCompositeOperation = 'lighter';
118
+ ctx.globalAlpha = Math.max(0.11, 0.16 * (1 - depth * 0.55));
119
+ ctx.drawImage(haze(), -60 + Math.sin(t * 0.13) * 40, -30 + Math.cos(t * 0.1) * 20, W + 120, Hh + 60);
120
+ // the last of the daylight scattering down from above: gives the midnight zone volume instead of flat black
121
+ ctx.globalAlpha = 1;
122
+ const vf = ctx.createLinearGradient(0, 0, 0, Hh * 0.55);
123
+ vf.addColorStop(0, 'rgba(14,52,84,0.2)'); vf.addColorStop(0.45, 'rgba(10,40,70,0.07)'); vf.addColorStop(1, 'rgba(10,40,70,0)');
124
+ ctx.fillStyle = vf; ctx.fillRect(0, 0, W, Hh * 0.55);
125
+ if (rays > 0.01) {
126
+ for (let i = 0; i < 7; i++) {
127
+ const xc = 90 + i * 190 + Math.sin(t * 0.35 + i * 2.1) * 35, wt = 18 + (i % 3) * 16, len = 360 + (i % 2) * 120;
128
+ const fl = 0.55 + 0.45 * Math.sin(t * 0.9 + i * 1.7);
129
+ const gr = ctx.createLinearGradient(0, 0, 0, len);
130
+ gr.addColorStop(0, `rgba(110,195,225,${0.075 * rays * fl})`); gr.addColorStop(1, 'rgba(110,195,225,0)');
131
+ ctx.globalAlpha = 1; ctx.fillStyle = gr; ctx.beginPath();
132
+ ctx.moveTo(xc - wt, -5); ctx.lineTo(xc + wt, -5); ctx.lineTo(xc + wt * 2.6 + len * 0.22, len); ctx.lineTo(xc - wt * 1.4 + len * 0.22, len); ctx.fill();
133
+ }
134
+ // surface shimmer far above
135
+ ctx.lineWidth = 1.2;
136
+ for (let k = 0; k < 4; k++) {
137
+ ctx.strokeStyle = `rgba(140,215,240,${0.05 * rays})`; ctx.beginPath();
138
+ for (let x = 0; x <= W; x += 16) ctx.lineTo(x, 8 + k * 7 + Math.sin(x * 0.02 + t * 1.3 + k * 2) * 3 + Math.sin(x * 0.051 - t * 0.9) * 2);
139
+ ctx.stroke();
140
+ }
141
+ }
142
+ ctx.globalAlpha = 1; ctx.globalCompositeOperation = 'source-over';
143
+ }
144
+
145
+ // ---------- marine snow (3 parallax layers, near layer out of focus) ----------
146
+ let SNOW = null;
147
+ function snowData() {
148
+ if (SNOW) return SNOW;
149
+ const R = H.rng(4242);
150
+ const spec = [
151
+ { n: 260, z: 0.3, r: [0.5, 1.1], a: [0.14, 0.38], v: [3, 8] },
152
+ { n: 110, z: 0.65, r: [0.9, 1.9], a: [0.28, 0.58], v: [6, 13] },
153
+ { n: 16, z: 1.6, r: [7, 22], a: [0.035, 0.09], v: [10, 22], bokeh: true },
154
+ ];
155
+ SNOW = spec.map((L) => ({ ...L, ps: Array.from({ length: L.n }, () => ({
156
+ x: R() * 1400, y: R() * 840, r: R.range(L.r[0], L.r[1]), a: R.range(L.a[0], L.a[1]), v: R.range(L.v[0], L.v[1]),
157
+ ph: R() * TAU, f: R.range(0.2, 0.7), sw: R.range(2, 9),
158
+ })) }));
159
+ return SNOW;
160
+ }
161
+ function snow(ctx, W, Hh, t, camY, camX, vel, lights, amt) {
162
+ ctx.save(); ctx.globalCompositeOperation = 'lighter'; ctx.lineCap = 'round';
163
+ const spanY = Hh + 120, spanX = W + 120;
164
+ for (const L of snowData()) for (const p of L.ps) {
165
+ const y = (((p.y + t * p.v - camY * L.z) % spanY) + spanY) % spanY - 60;
166
+ const x = (((p.x + Math.sin(t * p.f + p.ph) * p.sw - camX * L.z) % spanX) + spanX) % spanX - 60;
167
+ const a = p.a * amt;
168
+ let lit = 0, lc = null;
169
+ if (lights) for (const l of lights) { const d = Math.hypot(x - l.x, y - l.y); if (d < l.r) { const v = l.k * (1 - d / l.r) ** 2; if (v > lit) { lit = v; lc = l.col; } } }
170
+ const st = vel * L.z * 0.045;
171
+ if (L.bokeh) { dot(ctx, x, y, p.r * (1 + Math.min(2, Math.abs(st) * 0.01)), lc && lit > 0.05 ? lc : C.snow, a + lit * 0.12, 'bokeh'); continue; }
172
+ if (Math.abs(st) > 2.5) {
173
+ ctx.globalAlpha = cl((a + lit) * 1.4 / (1 + Math.abs(st) * 0.03));
174
+ ctx.strokeStyle = 'rgb(178,206,228)'; ctx.lineWidth = p.r * 1.3;
175
+ ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x, y + st); ctx.stroke();
176
+ } else {
177
+ dot(ctx, x, y, p.r * 2.8, C.snow, a);
178
+ if (lit > 0.02) dot(ctx, x, y, p.r * 3.5, lc, lit);
179
+ }
180
+ }
181
+ ctx.restore();
182
+ }
183
+
184
+ // ---------- generic plankton sparkle (twinkles where something moves) ----------
185
+ function sparkles(ctx, cx, cy, rx, ry, t, seed, n, a, col, rate) {
186
+ if (a <= 0.01) return;
187
+ const R = H.rng(seed);
188
+ for (let i = 0; i < n; i++) {
189
+ const ang = R() * TAU, rr = Math.sqrt(R()), ph = R() * TAU, sp = (rate || 3) * (0.6 + R()), sz = R.range(3, 7);
190
+ const fl = Math.pow(Math.max(0, Math.sin(t * sp + ph)), 6);
191
+ if (fl < 0.02) continue;
192
+ dot(ctx, cx + Math.cos(ang) * rr * rx, cy + Math.sin(ang) * rr * ry, sz, col || C.cyan, a * fl, 'core');
193
+ }
194
+ }
195
+
196
+ // ---------- jellyfish ----------
197
+ const NET = (() => {
198
+ const R = H.rng(919), nodes = [], edges = [];
199
+ [[0.3, 3], [0.56, 5], [0.8, 7]].forEach(([rr, n], li) => {
200
+ for (let i = 0; i < n; i++) {
201
+ const a = lerp(0.3, Math.PI - 0.3, i / (n - 1)) + R.range(-0.06, 0.06);
202
+ nodes.push({ u: Math.cos(a) * rr, v: Math.sin(a) * rr * 0.98 + 0.04, L: li });
203
+ }
204
+ });
205
+ nodes.push({ u: 0, v: 0.12, L: -1 }); // hub just above the rim centre
206
+ const hub = nodes.length - 1;
207
+ nodes.forEach((n, i) => {
208
+ if (n.L < 0) return;
209
+ if (n.L === 0) edges.push({ a: hub, b: i });
210
+ const next = nodes.map((m, j) => ({ j, m })).filter((o) => o.m.L === n.L + 1)
211
+ .sort((p, q) => Math.hypot(p.m.u - n.u, p.m.v - n.v) - Math.hypot(q.m.u - n.u, q.m.v - n.v)).slice(0, 2);
212
+ next.forEach((o) => edges.push({ a: i, b: o.j }));
213
+ // a few lateral links within the ring
214
+ const same = nodes.map((m, j) => ({ j, m })).filter((o) => o.m.L === n.L && o.j > i).sort((p, q) => Math.abs(p.m.u - n.u) - Math.abs(q.m.u - n.u));
215
+ if (same.length && R() < 0.5) edges.push({ a: i, b: same[0].j });
216
+ });
217
+ edges.forEach((e) => { e.w0 = R.range(0.15, 1); e.w1 = cl(e.w0 + R.range(-0.7, 0.7), 0.12, 1); });
218
+ return { nodes, edges, hub };
219
+ })();
220
+
221
+ function jelly(ctx, J) {
222
+ const on = J.on == null ? 1 : J.on;
223
+ if (on <= 0.003) return null;
224
+ const { x, s, t } = J, col = J.col || C.cyan, acc = J.acc || C.mag, hot = H.mix(col, WH, 0.45);
225
+ const c = Math.pow(0.5 + 0.5 * Math.sin(TAU * (t * (J.rate || 0.45) + (J.ph || 0))), 2);
226
+ const w = s * (1 - 0.12 * c), h = s * 0.8 * (1 + 0.08 * c), y = J.y - c * s * 0.04;
227
+ const rimY = (u) => y + h * 0.12 * Math.sqrt(Math.max(0, 1 - u * u));
228
+ ctx.save();
229
+ ctx.translate(x, y); ctx.rotate(J.tilt || 0); ctx.translate(-x, -y);
230
+ ctx.globalCompositeOperation = 'lighter'; ctx.lineCap = 'round'; ctx.lineJoin = 'round';
231
+
232
+ // --- tentacles (behind the bell)
233
+ const n = J.tent || 14, TL = J.tl || s * 2;
234
+ for (let i = 0; i < n; i++) {
235
+ const u = -0.92 + 1.84 * i / (n - 1), bx = x + u * w, by = rimY(u), L = TL * (0.6 + 0.4 * hash(i + 3.3));
236
+ const pts = [];
237
+ for (let j = 0; j <= 24; j++) {
238
+ const f = j / 24;
239
+ pts.push([bx + u * w * 0.22 * f + Math.sin(t * 1.6 - f * 6.5 + i * 1.9) * s * 0.11 * f + (J.sway || 0) * f * f * L, by + f * L * (1 - 0.1 * c)]);
240
+ }
241
+ const tg = ctx.createLinearGradient(0, by, 0, by + L);
242
+ tg.addColorStop(0, H.rgba(col, 0.5 * on)); tg.addColorStop(0.5, H.rgba(col, 0.22 * on)); tg.addColorStop(1, H.rgba(col, 0));
243
+ ctx.globalAlpha = 1; ctx.strokeStyle = tg;
244
+ ctx.lineWidth = 5; ctx.globalAlpha = 0.18; ctx.beginPath(); pts.forEach((p, k) => (k ? ctx.lineTo(p[0], p[1]) : ctx.moveTo(p[0], p[1]))); ctx.stroke();
245
+ ctx.lineWidth = 1.1; ctx.globalAlpha = 1; ctx.stroke();
246
+ // light beads travelling down the tentacle
247
+ const fb = (t * 0.42 + hash(i) ) % 1, pb = pts[Math.min(24, Math.round(fb * 24))];
248
+ dot(ctx, pb[0], pb[1], 8, col, 0.75 * on * (1 - fb));
249
+ }
250
+ // --- oral arms: frilly translucent ribbons
251
+ for (let k = 0; k < 4; k++) {
252
+ const ox = x + (k - 1.5) * w * 0.12, L = TL * 0.42, oc = H.mix(col, acc, 0.35);
253
+ ctx.beginPath();
254
+ for (let j = 0; j <= 20; j++) { const f = j / 20; ctx.lineTo(ox + Math.sin(t * 1.2 - f * 4 + k * 1.3) * s * 0.07 * f + (k - 1.5) * s * 0.05 * f + (J.sway || 0) * f * f * L * 0.6, y + h * 0.08 + f * L); }
255
+ ctx.globalAlpha = 1; ctx.strokeStyle = H.rgba(oc, 0.06 * on); ctx.lineWidth = s * 0.09; ctx.stroke();
256
+ ctx.strokeStyle = H.rgba(oc, 0.2 * on); ctx.lineWidth = 1.4; ctx.stroke();
257
+ }
258
+
259
+ // --- bell
260
+ const bellPath = (k, dy) => {
261
+ ctx.beginPath(); ctx.moveTo(x - w * k, y + dy);
262
+ ctx.bezierCurveTo(x - w * k * 1.03, y - h * k * 0.72 + dy, x - w * k * 0.62, y - h * k * 1.02 + dy, x, y - h * k * 1.02 + dy);
263
+ ctx.bezierCurveTo(x + w * k * 0.62, y - h * k * 1.02 + dy, x + w * k * 1.03, y - h * k * 0.72 + dy, x + w * k, y + dy);
264
+ };
265
+ bellPath(1, 0);
266
+ const N = 16;
267
+ for (let i = 1; i <= N; i++) { const u1 = 1 - 2 * i / N, um = 1 - (2 * i - 1) / N; ctx.quadraticCurveTo(x + um * w, rimY(um) + h * 0.07, x + u1 * w, rimY(u1)); }
268
+ ctx.closePath();
269
+ const bg = ctx.createRadialGradient(x, y - h * 0.42, 0, x, y - h * 0.42, w * 1.08);
270
+ bg.addColorStop(0, H.rgba(col, 0.07 * on)); bg.addColorStop(0.6, H.rgba(col, 0.1 * on)); bg.addColorStop(0.86, H.rgba(col, 0.24 * on)); bg.addColorStop(1, H.rgba(col, 0));
271
+ ctx.globalAlpha = 1; ctx.fillStyle = bg; ctx.fill();
272
+ // subumbrella (inner dome) + radial canals
273
+ ctx.strokeStyle = H.rgba(col, 0.16 * on); ctx.lineWidth = 1.2; bellPath(0.7, h * 0.06); ctx.stroke();
274
+ for (let i = 0; i < 9; i++) {
275
+ const u = -0.88 + 1.76 * i / 8;
276
+ ctx.beginPath(); ctx.moveTo(x + u * w * 0.1, y - h * 0.97); ctx.quadraticCurveTo(x + u * w * 0.82, y - h * 0.85 * Math.sqrt(1 - u * u * 0.6), x + u * w * 0.98, rimY(u));
277
+ ctx.strokeStyle = H.rgba(col, 0.1 * on); ctx.lineWidth = 1; ctx.stroke();
278
+ }
279
+ // gonads: glowing horseshoes (magenta accent)
280
+ if (J.gon) for (let k = -1; k <= 1; k++) {
281
+ const gx = x + k * w * 0.36, gy = y - h * (0.42 - Math.abs(k) * 0.06), gr = w * 0.11;
282
+ ctx.beginPath(); ctx.ellipse(gx, gy, gr, gr * 0.75, 0, 0, TAU);
283
+ ctx.strokeStyle = H.rgba(acc, 0.12 * on * J.gon); ctx.lineWidth = 9; ctx.stroke();
284
+ ctx.strokeStyle = H.rgba(H.mix(acc, WH, 0.3), 0.4 * on * J.gon); ctx.lineWidth = 2; ctx.stroke();
285
+ }
286
+ // rim: bright margin + back rim ellipse
287
+ bellPath(1, 0);
288
+ ctx.strokeStyle = H.rgba(col, 0.1 * on); ctx.lineWidth = 10; ctx.stroke();
289
+ ctx.strokeStyle = H.rgba(hot, 0.6 * on); ctx.lineWidth = 1.8; ctx.stroke();
290
+ ctx.beginPath(); ctx.ellipse(x, y, w, h * 0.12, 0, Math.PI, TAU); ctx.strokeStyle = H.rgba(col, 0.18 * on); ctx.lineWidth = 1.2; ctx.stroke();
291
+ ctx.beginPath(); ctx.ellipse(x, y, w, h * 0.12, 0, 0, Math.PI); ctx.strokeStyle = H.rgba(hot, 0.5 * on); ctx.lineWidth = 2; ctx.stroke();
292
+ // marginal light organs with a chasing pulse
293
+ for (let i = 0; i <= 26; i++) {
294
+ const u = -1 + 2 * i / 26, pul = Math.pow(Math.max(0, Math.sin(u * 5 - t * 4 + (J.ph || 0) * 9)), 6);
295
+ dot(ctx, x + u * w, rimY(u), 5 + pul * 8, i % 5 === 2 ? acc : col, (0.35 + 0.65 * pul) * on);
296
+ }
297
+
298
+ // --- nerve net (the model's "weights")
299
+ let pos = null;
300
+ if (J.net) {
301
+ const Nn = J.net, na = Nn.a == null ? 1 : Nn.a;
302
+ pos = NET.nodes.map((nd) => [x + nd.u * w, y - nd.v * h * 0.98]);
303
+ NET.edges.forEach((e, i) => {
304
+ const p = pos[e.a], q = pos[e.b], wg = Nn.ew ? Nn.ew(e, i) : e.w0, ec = Nn.ec ? Nn.ec(e, i) : col;
305
+ const a = (0.2 + 0.6 * wg) * on * na;
306
+ ctx.globalAlpha = 1;
307
+ ctx.strokeStyle = H.rgba(ec, a * 0.22); ctx.lineWidth = 3 + wg * 6; ctx.beginPath(); ctx.moveTo(p[0], p[1]); ctx.lineTo(q[0], q[1]); ctx.stroke();
308
+ ctx.strokeStyle = H.rgba(H.mix(ec, WH, 0.35), a); ctx.lineWidth = 0.6 + wg * 2.2; ctx.stroke();
309
+ const pu = Nn.pulse ? Nn.pulse(e, i) : -1;
310
+ if (pu >= 0 && pu <= 1) dot(ctx, lerp(p[0], q[0], pu), lerp(p[1], q[1], pu), 14, Nn.pc || ec, on * na, 'core');
311
+ });
312
+ pos.forEach((p, i) => {
313
+ const act = Nn.act ? Nn.act(i) : 0.5, nc = Nn.nc ? Nn.nc(i) : col;
314
+ dot(ctx, p[0], p[1], 14 + act * 26, nc, (0.3 + 0.7 * act) * on * na);
315
+ dot(ctx, p[0], p[1], 5 + act * 4, nc, (0.55 + 0.45 * act) * on * na, 'core');
316
+ });
317
+ }
318
+ // halo around the whole animal
319
+ dot(ctx, x, y - h * 0.4, w * 2.1, col, 0.09 * on);
320
+ ctx.restore();
321
+ return { x, y, w, h, pos };
322
+ }
323
+
324
+ // ---------- siphonophore chain ----------
325
+ function siph(ctx, pts, t, lit, sc, a, colDim, colLit) {
326
+ ctx.save(); ctx.globalCompositeOperation = 'lighter'; ctx.lineCap = 'round';
327
+ colDim = colDim || C.violet; colLit = colLit || C.cyan;
328
+ // stem
329
+ ctx.beginPath(); pts.forEach((p, i) => (i ? ctx.lineTo(p[0], p[1]) : ctx.moveTo(p[0], p[1])));
330
+ ctx.globalAlpha = 1; ctx.strokeStyle = H.rgba(colDim, 0.12 * a); ctx.lineWidth = 6 * sc; ctx.stroke();
331
+ ctx.strokeStyle = H.rgba(H.mix(colDim, WH, 0.3), 0.4 * a); ctx.lineWidth = 1.2; ctx.stroke();
332
+ pts.forEach((p, i) => {
333
+ const q = pts[Math.max(0, i - 1)], r = pts[Math.min(pts.length - 1, i + 1)], ang = Math.atan2(r[1] - q[1], r[0] - q[0]);
334
+ const L = cl(lit(i)), col = H.mix(colDim, colLit, L), al = a * (0.35 + 0.65 * L);
335
+ const wob = Math.sin(t * 2.2 - i * 0.7) * 0.12;
336
+ // dangling filaments
337
+ ctx.globalAlpha = 1; ctx.strokeStyle = H.rgba(col, 0.22 * al); ctx.lineWidth = 0.9;
338
+ for (const sd of [-1, 1]) {
339
+ ctx.beginPath(); ctx.moveTo(p[0], p[1]);
340
+ for (let j = 1; j <= 8; j++) ctx.lineTo(p[0] + sd * j * 1.5 * sc + Math.sin(t * 1.8 + j * 0.8 + i) * 3 * sc, p[1] + j * 5 * sc);
341
+ ctx.stroke();
342
+ }
343
+ ctx.save(); ctx.translate(p[0], p[1]); ctx.rotate(ang + wob);
344
+ const rx = 15 * sc, ry = 10 * sc;
345
+ const g = ctx.createRadialGradient(-rx * 0.2, 0, 0, 0, 0, rx);
346
+ g.addColorStop(0, H.rgba(col, 0.32 * al)); g.addColorStop(0.75, H.rgba(col, 0.1 * al)); g.addColorStop(1, H.rgba(col, 0));
347
+ ctx.fillStyle = g; ctx.beginPath(); ctx.ellipse(0, 0, rx, ry, 0, 0, TAU); ctx.fill();
348
+ ctx.strokeStyle = H.rgba(H.mix(col, WH, 0.4), 0.65 * al); ctx.lineWidth = 1.3;
349
+ ctx.beginPath(); ctx.ellipse(0, 0, rx, ry, 0, -Math.PI * 0.85, Math.PI * 0.85); ctx.stroke();
350
+ ctx.beginPath(); ctx.ellipse(rx * 0.15, 0, rx * 0.55, ry * 0.55, 0, 0, TAU); ctx.strokeStyle = H.rgba(col, 0.35 * al); ctx.stroke();
351
+ ctx.restore();
352
+ dot(ctx, p[0], p[1], 26 * sc * (1 + L * 0.8), col, al * 0.55);
353
+ dot(ctx, p[0], p[1], 7 * sc, col, al * (0.25 + 0.75 * L), 'core');
354
+ });
355
+ ctx.restore();
356
+ }
357
+
358
+ // ---------- comb jelly (ctenophore) with rainbow cilia ripples ----------
359
+ function comb(ctx, x, y, s, t, a, tilt) {
360
+ if (a <= 0.01) return;
361
+ ctx.save(); ctx.translate(x, y); ctx.rotate(tilt || 0); ctx.globalCompositeOperation = 'lighter';
362
+ const rx = s * 0.62, ry = s;
363
+ const g = ctx.createRadialGradient(0, -ry * 0.2, 0, 0, 0, ry);
364
+ g.addColorStop(0, `rgba(150,200,255,${0.05 * a})`); g.addColorStop(0.8, `rgba(150,200,255,${0.08 * a})`); g.addColorStop(1, 'rgba(150,200,255,0)');
365
+ ctx.fillStyle = g; ctx.beginPath(); ctx.ellipse(0, 0, rx, ry, 0, 0, TAU); ctx.fill();
366
+ ctx.strokeStyle = `rgba(170,215,255,${0.25 * a})`; ctx.lineWidth = 1.2; ctx.stroke();
367
+ // trailing tentacles
368
+ for (const sd of [-1, 1]) {
369
+ ctx.beginPath(); ctx.moveTo(sd * rx * 0.3, ry * 0.2);
370
+ for (let j = 1; j <= 20; j++) ctx.lineTo(sd * (rx * 0.3 + j * 2.5) + Math.sin(t * 1.5 - j * 0.4) * 6, ry * 0.2 + j * s * 0.09);
371
+ ctx.strokeStyle = `rgba(170,215,255,${0.16 * a})`; ctx.lineWidth = 1; ctx.stroke();
372
+ }
373
+ [-0.92, -0.62, -0.25, 0.25, 0.62, 0.92].forEach((u, row) => {
374
+ for (let j = 0; j < 15; j++) {
375
+ const th = lerp(0.35, 2.75, j / 14), px = u * rx * Math.sin(th), py = -ry * Math.cos(th);
376
+ const wave = Math.pow(0.5 + 0.5 * Math.sin(th * 7 - t * 8 + row * 0.9), 3);
377
+ const col = hsl(th * 110 - t * 260 + row * 45, 1, 0.62);
378
+ dot(ctx, px, py, 3 + wave * 6, col, a * (0.2 + 0.8 * wave) * (1 - Math.abs(u) * 0.35), 'core');
379
+ }
380
+ });
381
+ ctx.restore();
382
+ }
383
+
384
+ // ---------- anglerfish (dark silhouette lit only by its own lure) ----------
385
+ function angler(ctx, x, y, s, t, lure, a, flip) {
386
+ const k = s / 100, dir = flip ? -1 : 1;
387
+ const lx = 98, ly = -100 + Math.sin(t * 1.4) * 5 + Math.sin(t * 0.7) * 3;
388
+ const wl = [x + lx * k * dir, y + ly * k];
389
+ ctx.save(); ctx.globalAlpha = a;
390
+ ctx.translate(x, y); ctx.scale(k * dir, k);
391
+ // lure light falling on the water around it
392
+ ctx.globalCompositeOperation = 'lighter';
393
+ dot(ctx, lx, ly, 330, C.amber, 0.16 * lure * a);
394
+ ctx.globalCompositeOperation = 'source-over';
395
+ const body = () => {
396
+ ctx.beginPath(); ctx.moveTo(-118, -6);
397
+ ctx.lineTo(-168, -46); ctx.quadraticCurveTo(-160, 0, -168, 44); ctx.lineTo(-118, 8);
398
+ ctx.bezierCurveTo(-90, 48, -10, 74, 62, 58);
399
+ ctx.quadraticCurveTo(92, 48, 102, 16); // lower jaw tip
400
+ ctx.quadraticCurveTo(60, 20, 42, 8); // inside of mouth
401
+ ctx.quadraticCurveTo(64, -6, 90, -14); // upper jaw tip
402
+ ctx.bezierCurveTo(78, -62, -20, -78, -118, -6);
403
+ ctx.closePath();
404
+ };
405
+ // dorsal fin (behind the body): a dim, ragged membrane catching a little lure light
406
+ ctx.beginPath(); ctx.moveTo(-40, -58); ctx.quadraticCurveTo(-64, -84, -96, -70); ctx.quadraticCurveTo(-92, -48, -108, -22); ctx.lineTo(-64, -42); ctx.closePath();
407
+ ctx.fillStyle = 'rgba(9,9,12,0.92)'; ctx.fill();
408
+ ctx.strokeStyle = `rgba(190,140,96,${0.05 + 0.12 * lure})`; ctx.lineWidth = 1; ctx.stroke();
409
+ ctx.strokeStyle = `rgba(190,140,96,${0.06 * lure})`; ctx.lineWidth = 0.8;
410
+ for (let i = 0; i < 5; i++) { const f = i / 4; ctx.beginPath(); ctx.moveTo(lerp(-46, -98, f), lerp(-54, -34, f)); ctx.lineTo(lerp(-58, -98, f), lerp(-78, -64, f)); ctx.stroke(); }
411
+ // flesh lit by its own esca: warm near the lure, falling off to black at the tail
412
+ const lg = ctx.createRadialGradient(lx, ly, 10, lx, ly, 270);
413
+ lg.addColorStop(0, H.rgba(H.mix([8, 10, 14], [140, 96, 60], lure))); lg.addColorStop(0.2, H.rgba(H.mix([8, 10, 14], [92, 64, 44], lure)));
414
+ lg.addColorStop(0.35, H.rgba(H.mix([7, 9, 13], [44, 32, 27], lure))); lg.addColorStop(0.55, H.rgba(H.mix([5, 7, 11], [16, 14, 16], lure)));
415
+ lg.addColorStop(1, 'rgb(3,5,9)');
416
+ body(); ctx.fillStyle = lg; ctx.fill();
417
+ ctx.save(); body(); ctx.clip();
418
+ // form shading: belly and lower jaw turn away from the light
419
+ const sh = ctx.createLinearGradient(0, -40, 0, 70);
420
+ sh.addColorStop(0, 'rgba(0,0,0,0)'); sh.addColorStop(0.5, 'rgba(2,3,6,0.45)'); sh.addColorStop(1, 'rgba(2,3,6,0.85)');
421
+ ctx.fillStyle = sh; ctx.fillRect(-180, -90, 300, 170);
422
+ // warm bounce on the head and jaw facing the lure, plus a wet specular sheen
423
+ ctx.globalCompositeOperation = 'lighter';
424
+ const hl = ctx.createRadialGradient(lx - 30, ly + 52, 0, lx - 30, ly + 52, 150);
425
+ hl.addColorStop(0, `rgba(255,168,92,${0.22 * lure})`); hl.addColorStop(0.5, `rgba(255,150,80,${0.07 * lure})`); hl.addColorStop(1, 'rgba(255,150,80,0)');
426
+ ctx.fillStyle = hl; ctx.fillRect(-180, -90, 300, 170);
427
+ // wet sheen: a soft band just inside the lit upper contour
428
+ const sg = ctx.createRadialGradient(lx - 40, ly + 30, 0, lx - 40, ly + 30, 170);
429
+ sg.addColorStop(0, `rgba(255,214,160,${0.07 * lure})`); sg.addColorStop(1, 'rgba(255,214,160,0)');
430
+ ctx.save(); ctx.translate(0, 6); body(); ctx.restore(); ctx.strokeStyle = sg;
431
+ for (let i = 0; i < 6; i++) { ctx.lineWidth = 26 - i * 4; ctx.stroke(); }
432
+ // skin pores along the flank, catching pin-points of light
433
+ for (let i = 0; i < 8; i++) {
434
+ const f = i / 7, px = lerp(-96, 36, f), py = lerp(-2, -24, f) + Math.sin(f * 7) * 3, d = Math.hypot(px - lx, py - ly);
435
+ dot(ctx, px, py, 3.2, [255, 196, 140], 0.85 * lure * cl(1.25 - d / 240), 'core');
436
+ }
437
+ ctx.globalCompositeOperation = 'source-over';
438
+ ctx.restore();
439
+ // rim light on the upper edge from the lure
440
+ const rg = ctx.createRadialGradient(lx, ly, 0, lx, ly, 230);
441
+ rg.addColorStop(0, `rgba(255,198,120,${0.85 * lure})`); rg.addColorStop(1, 'rgba(255,190,110,0)');
442
+ body(); ctx.strokeStyle = rg; ctx.lineWidth = 2.2; ctx.stroke();
443
+ // skin bumps / lateral line
444
+ ctx.strokeStyle = `rgba(170,120,84,${0.28 * lure})`; ctx.lineWidth = 1;
445
+ ctx.beginPath(); ctx.moveTo(-100, 0); ctx.quadraticCurveTo(-30, -14, 40, -30); ctx.stroke();
446
+ // caudal fin rays
447
+ ctx.strokeStyle = `rgba(170,120,84,${0.1 * lure})`; ctx.lineWidth = 0.8;
448
+ for (let i = 0; i < 5; i++) { const f = (i - 2) / 2; ctx.beginPath(); ctx.moveTo(-122, f * 4); ctx.lineTo(-164, f * 38); ctx.stroke(); }
449
+ // pectoral fin
450
+ ctx.beginPath(); ctx.moveTo(-20, 22); ctx.quadraticCurveTo(-52, 40, -44, 64); ctx.quadraticCurveTo(-26, 46, -6, 34); ctx.closePath();
451
+ ctx.fillStyle = 'rgba(16,14,16,0.9)'; ctx.fill(); ctx.strokeStyle = `rgba(200,150,100,${0.22 * lure})`; ctx.stroke();
452
+ // teeth: needles, lit by the lure
453
+ ctx.fillStyle = `rgba(235,225,205,${0.12 + 0.6 * lure})`;
454
+ for (let i = 0; i < 8; i++) { const f = i / 7, tx = lerp(88, 50, f), ty = lerp(-12, 4, f), tl = 13 - Math.abs(f - 0.4) * 10;
455
+ ctx.beginPath(); ctx.moveTo(tx - 2, ty); ctx.lineTo(tx + 2, ty); ctx.lineTo(tx + 1, ty + tl); ctx.fill(); }
456
+ for (let i = 0; i < 7; i++) { const f = i / 6, tx = lerp(98, 54, f), ty = lerp(14, 14, f) + Math.sin(f * 3) * 3, tl = 15 - Math.abs(f - 0.3) * 12;
457
+ ctx.beginPath(); ctx.moveTo(tx - 2, ty); ctx.lineTo(tx + 2, ty); ctx.lineTo(tx - 1, ty - tl); ctx.fill(); }
458
+ // eye
459
+ ctx.beginPath(); ctx.arc(30, -32, 7, 0, TAU); ctx.fillStyle = '#020305'; ctx.fill();
460
+ ctx.strokeStyle = `rgba(200,220,210,${0.15 + 0.4 * lure})`; ctx.lineWidth = 1.5; ctx.stroke();
461
+ ctx.globalCompositeOperation = 'lighter'; dot(ctx, 27, -35, 3, C.ice, 0.5 * lure, 'core');
462
+ // illicium (fishing rod) and esca (the lure)
463
+ ctx.globalCompositeOperation = 'source-over';
464
+ ctx.beginPath(); ctx.moveTo(18, -56); ctx.quadraticCurveTo(46, -150, lx, ly);
465
+ ctx.strokeStyle = `rgba(${lerp(30, 120, lure) | 0},${lerp(28, 90, lure) | 0},${lerp(30, 70, lure) | 0},1)`; ctx.lineWidth = 2.6; ctx.stroke();
466
+ ctx.globalCompositeOperation = 'lighter';
467
+ dot(ctx, lx, ly, 120, C.amber, 0.55 * lure * a);
468
+ dot(ctx, lx, ly, 34, C.amber, lure * a, 'core');
469
+ dot(ctx, lx, ly, 12, [255, 240, 200], lure * a, 'core');
470
+ ctx.restore();
471
+ return wl;
472
+ }
473
+
474
+ // ---------- point sampling (text and silhouettes become plankton swarms) ----------
475
+ const PTS = {};
476
+ function samplePts(key, w, h, step, drawFn) {
477
+ if (PTS[key]) return PTS[key];
478
+ const c = H.layer(w, h), x = c.getContext('2d');
479
+ x.fillStyle = '#fff'; x.strokeStyle = '#fff'; drawFn(x);
480
+ const d = x.getImageData(0, 0, w, h).data, R = H.rng(key), out = [];
481
+ const on = (i, j) => i >= 0 && j >= 0 && i < w && j < h && d[(j * w + i) * 4 + 3] > 120;
482
+ for (let j = 0; j < h; j += step) for (let i = 0; i < w; i += step) {
483
+ if (!on(i, j)) continue;
484
+ const edge = !on(i - step, j) || !on(i + step, j) || !on(i, j - step) || !on(i, j + step);
485
+ out.push({ x: i - w / 2 + R.range(-0.4, 0.4) * step, y: j - h / 2 + R.range(-0.4, 0.4) * step, e: edge, r: R(), a: R() * TAU, d: R(), q: R() });
486
+ }
487
+ return (PTS[key] = out);
488
+ }
489
+ function textPts(str, font, step) {
490
+ const key = 'B' + str + font + step;
491
+ if (PTS[key]) return PTS[key];
492
+ const raw = samplePts('T' + str + font + step, 1280, 200, step, (x) => { x.font = font; x.textAlign = 'center'; x.textBaseline = 'alphabetic'; x.fillText(str, 640, 130); });
493
+ return (PTS[key] = raw.map((p) => ({ ...p, y: p.y - 30 }))); // y relative to the baseline
494
+ }
495
+ const catPts = () => samplePts('cat', 160, 150, 4, (x) => {
496
+ x.beginPath(); x.ellipse(78, 104, 38, 40, 0, 0, TAU); x.fill();
497
+ x.beginPath(); x.arc(78, 52, 28, 0, TAU); x.fill();
498
+ x.beginPath(); x.moveTo(52, 44); x.lineTo(54, 10); x.lineTo(74, 28); x.fill();
499
+ x.beginPath(); x.moveTo(104, 44); x.lineTo(102, 10); x.lineTo(82, 28); x.fill();
500
+ x.lineWidth = 10; x.lineCap = 'round'; x.beginPath(); x.moveTo(108, 132); x.quadraticCurveTo(150, 130, 142, 84); x.stroke();
501
+ x.globalCompositeOperation = 'destination-out';
502
+ x.beginPath(); x.ellipse(67, 50, 4, 6, 0, 0, TAU); x.ellipse(89, 50, 4, 6, 0, 0, TAU); x.fill();
503
+ });
504
+ const dogPts = () => samplePts('dog', 190, 150, 4, (x) => {
505
+ x.beginPath(); x.ellipse(82, 84, 52, 27, 0, 0, TAU); x.fill();
506
+ x.beginPath(); x.moveTo(112, 70); x.lineTo(128, 36); x.lineTo(150, 50); x.lineTo(132, 92); x.fill(); // neck
507
+ x.beginPath(); x.arc(140, 44, 22, 0, TAU); x.fill();
508
+ x.beginPath(); x.ellipse(164, 52, 17, 11, 0.1, 0, TAU); x.fill();
509
+ x.beginPath(); x.ellipse(126, 54, 9, 20, 0.35, 0, TAU); x.fill(); // floppy ear
510
+ [[38, 96, 12, 44], [58, 100, 12, 40], [104, 100, 12, 40], [122, 96, 12, 44]].forEach(([a, b, c, d]) => x.fillRect(a, b, c, d));
511
+ x.lineWidth = 9; x.lineCap = 'round'; x.beginPath(); x.moveTo(34, 74); x.quadraticCurveTo(14, 60, 18, 30); x.stroke();
512
+ x.globalCompositeOperation = 'destination-out';
513
+ x.beginPath(); x.arc(146, 38, 3.5, 0, TAU); x.fill();
514
+ x.lineWidth = 3; x.beginPath(); x.ellipse(126, 54, 9, 20, 0.35, -1.2, 1.9); x.stroke();
515
+ });
516
+
517
+ // a plankton swarm holding a shape; form 0 = scattered cloud, 1 = crisp silhouette
518
+ function swarm(ctx, pts, cx, cy, sc, form, t, col, a, sink) {
519
+ if (a <= 0.01) return;
520
+ ctx.save(); ctx.globalCompositeOperation = 'lighter';
521
+ const sp = 1 - form;
522
+ for (const p of pts) {
523
+ let px = cx + p.x * sc + Math.cos(p.a + t * 0.9) * sp * (30 + p.d * 160) + Math.sin(t * 2.1 + p.r * 9) * 1.4;
524
+ let py = cy + p.y * sc + Math.sin(p.a + t * 0.9) * sp * (24 + p.d * 120) + Math.cos(t * 1.7 + p.q * 9) * 1.4;
525
+ if (sink) { const k = Math.pow(cl(sink.k * (1.2 - p.d * 0.4)), 1.6); px = lerp(px, sink.x + (p.q - 0.5) * 20, k); py = lerp(py, sink.y + (p.r - 0.5) * 30, k); }
526
+ const tw = 0.55 + 0.45 * Math.sin(t * (3 + p.r * 5) + p.a * 7);
527
+ dot(ctx, px, py, p.e ? 6 : 5, col, a * (p.e ? 0.95 : 0.4) * tw * (0.35 + 0.65 * form), p.e ? 'core' : 'soft');
528
+ }
529
+ ctx.restore();
530
+ }
531
+
532
+ // plankton gathering into text (p 0..1); from = optional origin cloud
533
+ function gather(ctx, pts, cx, cy, p, t, col, a, from) {
534
+ if (a <= 0.01 || p <= 0) return;
535
+ ctx.save(); ctx.globalCompositeOperation = 'lighter';
536
+ for (const pt of pts) {
537
+ const q = E.inOut(cl((p - pt.r * 0.42) / 0.58));
538
+ const tx = cx + pt.x, ty = cy + pt.y;
539
+ const sx = from ? from.x + Math.cos(pt.a) * from.r * (0.2 + pt.d) : tx + Math.cos(pt.a) * (150 + pt.d * 520);
540
+ const sy = from ? from.y + Math.sin(pt.a) * from.r * 0.7 * (0.2 + pt.d) : ty + Math.sin(pt.a) * (110 + pt.d * 260);
541
+ const sw = Math.sin(q * Math.PI) * 70 * (pt.q - 0.5);
542
+ const dx = tx - sx, dy = ty - sy, dl = Math.hypot(dx, dy) || 1;
543
+ const px = lerp(sx, tx, q) - dy / dl * sw, py = lerp(sy, ty, q) + dx / dl * sw;
544
+ const tw = 0.6 + 0.4 * Math.sin(t * (4 + pt.d * 6) + pt.a * 5);
545
+ dot(ctx, px, py, q > 0.97 ? 4.5 : 5.5, col, a * (0.25 + 0.75 * q) * tw, 'core');
546
+ }
547
+ ctx.restore();
548
+ }
549
+
550
+ // bioluminescent type: wide soft halo + bright core
551
+ function gtext(ctx, s, x, y, font, rgb, a, align, blur) {
552
+ if (a <= 0.01) return;
553
+ ctx.save(); ctx.globalAlpha = 1; ctx.font = font; ctx.textAlign = align || 'center'; ctx.textBaseline = 'alphabetic';
554
+ const b = blur || 16;
555
+ ctx.globalCompositeOperation = 'lighter';
556
+ ctx.shadowColor = H.rgba(rgb, a); ctx.shadowBlur = b * 2.6; ctx.fillStyle = H.rgba(rgb, 0.55 * a); ctx.fillText(s, x, y);
557
+ ctx.shadowBlur = b * 1.1; ctx.fillStyle = H.rgba(rgb, 0.6 * a); ctx.fillText(s, x, y);
558
+ ctx.shadowBlur = 0; ctx.globalCompositeOperation = 'source-over';
559
+ ctx.fillStyle = H.rgba(H.mix(rgb, WH, 0.62), a); ctx.fillText(s, x, y);
560
+ ctx.restore();
561
+ }
562
+ function tw(ctx, s, font) { ctx.save(); ctx.font = font; const w = ctx.measureText(s).width; ctx.restore(); return w; }
563
+
564
+ // glowing stroke (for ✗ / ✓ / rings)
565
+ function gstroke(ctx, path, rgb, a, lw) {
566
+ if (a <= 0.01) return;
567
+ ctx.save(); ctx.globalAlpha = 1; ctx.globalCompositeOperation = 'lighter'; ctx.lineCap = 'round'; ctx.lineJoin = 'round';
568
+ path(); ctx.strokeStyle = H.rgba(rgb, 0.16 * a); ctx.lineWidth = lw * 4.5; ctx.stroke();
569
+ ctx.strokeStyle = H.rgba(rgb, 0.4 * a); ctx.lineWidth = lw * 2; ctx.stroke();
570
+ ctx.strokeStyle = H.rgba(H.mix(rgb, WH, 0.6), a); ctx.lineWidth = lw; ctx.stroke();
571
+ ctx.restore();
572
+ }
573
+ function ring(ctx, x, y, r, rgb, a, lw) { gstroke(ctx, () => { ctx.beginPath(); ctx.arc(x, y, r, 0, TAU); }, rgb, a, lw || 2.5); }
574
+
575
+ // ---------- luminous current: a dotted plankton stream with an arrowhead ----------
576
+ function bez(P, u) {
577
+ const v = 1 - u;
578
+ return [v * v * v * P[0][0] + 3 * v * v * u * P[1][0] + 3 * v * u * u * P[2][0] + u * u * u * P[3][0],
579
+ v * v * v * P[0][1] + 3 * v * v * u * P[1][1] + 3 * v * u * u * P[2][1] + u * u * u * P[3][1]];
580
+ }
581
+ function curPts(P) {
582
+ const pts = [bez(P, 0)], len = [0];
583
+ for (let i = 1; i <= 80; i++) { const p = bez(P, i / 80); len.push(len[i - 1] + Math.hypot(p[0] - pts[i - 1][0], p[1] - pts[i - 1][1])); pts.push(p); }
584
+ const at = (s) => { let i = 1; while (i < 80 && len[i] < s) i++; const f = (s - len[i - 1]) / Math.max(1e-6, len[i] - len[i - 1]); return [lerp(pts[i - 1][0], pts[i][0], f), lerp(pts[i - 1][1], pts[i][1], f)]; };
585
+ return { at, L: len[80], pts };
586
+ }
587
+ function current(ctx, P, prog, t, col, a, sig, sigCol) {
588
+ if (prog <= 0 || a <= 0.01) return;
589
+ const c = curPts(P), Lp = c.L * cl(prog);
590
+ ctx.save(); ctx.globalAlpha = 1; ctx.globalCompositeOperation = 'lighter'; ctx.lineCap = 'round';
591
+ ctx.beginPath(); for (let s = 0; s <= Lp; s += 6) { const p = c.at(s); s ? ctx.lineTo(p[0], p[1]) : ctx.moveTo(p[0], p[1]); }
592
+ ctx.strokeStyle = H.rgba(col, 0.2 * a); ctx.lineWidth = 2; ctx.stroke();
593
+ for (let s = 0; s <= Lp; s += 12) {
594
+ const p = c.at(s), pul = Math.pow(0.5 + 0.5 * Math.sin(s * 0.045 - t * 8), 4);
595
+ dot(ctx, p[0], p[1], 6.5, col, a * (0.4 + 0.6 * pul), 'core');
596
+ }
597
+ const end = c.at(Lp);
598
+ if (prog < 1) dot(ctx, end[0], end[1], 22, col, a, 'core');
599
+ const hp = cl((prog - 0.85) / 0.15);
600
+ if (hp > 0) {
601
+ const e0 = c.at(c.L - 8), ang = Math.atan2(end[1] - e0[1], end[0] - e0[0]);
602
+ for (const sd of [-1, 1]) for (let k = 1; k <= 3; k++) {
603
+ const aa = ang + Math.PI + sd * 0.6;
604
+ dot(ctx, end[0] + Math.cos(aa) * k * 9 * hp, end[1] + Math.sin(aa) * k * 9 * hp, 7, col, a * hp, 'core');
605
+ }
606
+ dot(ctx, end[0], end[1], 9, col, a * hp, 'core');
607
+ }
608
+ if (sig != null && sig >= 0 && sig <= 1) {
609
+ for (let k = 0; k < 6; k++) { const s = c.L * cl(sig - k * 0.025), p = c.at(s); dot(ctx, p[0], p[1], 26 - k * 3, sigCol || col, a * (1 - k * 0.15), 'core'); }
610
+ }
611
+ ctx.restore();
612
+ }
613
+
614
+ // ---------- minimal submersible HUD ----------
615
+ function hud(ctx, W, depth, temp, t, a, left) {
616
+ if (a <= 0.01) return;
617
+ ctx.save(); ctx.globalAlpha = a; ctx.font = F.hud(15); ctx.textAlign = left ? 'left' : 'right';
618
+ const x = left ? 34 : W - 34;
619
+ ctx.fillStyle = 'rgba(150,220,235,0.72)';
620
+ ctx.fillText('DEPTH ' + String(Math.round(depth)).padStart(4, '0') + ' m', x, 40);
621
+ ctx.fillStyle = 'rgba(150,220,235,0.45)';
622
+ ctx.fillText('TEMP ' + temp.toFixed(1) + ' °C', x, 60);
623
+ // tiny scrolling depth ladder
624
+ const lx = left ? x : x - 150;
625
+ ctx.strokeStyle = 'rgba(150,220,235,0.4)'; ctx.lineWidth = 1;
626
+ ctx.beginPath(); ctx.moveTo(lx, 72); ctx.lineTo(lx + 150, 72); ctx.stroke();
627
+ for (let i = -1; i < 12; i++) { const off = ((depth * 0.6) % 15), tx = lx + i * 15 - off; if (tx < lx || tx > lx + 150) continue; ctx.beginPath(); ctx.moveTo(tx, 72); ctx.lineTo(tx, i % 5 === 0 ? 64 : 68); ctx.stroke(); }
628
+ ctx.fillStyle = 'rgba(255,90,80,' + (0.5 + 0.5 * (Math.sin(t * 4) > 0 ? 1 : 0)) + ')';
629
+ ctx.beginPath(); ctx.arc(left ? x + 200 : x - 196, 35, 4, 0, TAU); ctx.fill();
630
+ ctx.restore();
631
+ }
632
+
633
+ function finish(ctx, W, Hh, t, v) {
634
+ H.vignette(ctx, W, Hh, v == null ? 0.6 : v, '0,0,4');
635
+ H.grain(ctx, W, Hh, 0.035, 1 + Math.floor(t * 24), true);
636
+ }
637
+
638
+ // ======================= HERO STILL / CLIP =======================
639
+ const flick = (t, t0, t1, seed) => {
640
+ if (t <= t0) return 0; if (t >= t1) return 1;
641
+ const p = (t - t0) / (t1 - t0), r = hash(Math.floor(t * 24) + seed * 13.7);
642
+ return r < 0.35 + p * 0.6 ? p * (0.6 + 0.4 * r) + 0.1 : 0.06;
643
+ };
644
+ function hero(ctx, W, Hh, t) {
645
+ const dP = E.out(cl(t / 2.4));
646
+ const camY = 900 * dP + t * 6, vel = 900 * 3 * Math.pow(1 - cl(t / 2.4), 2) / 2.4 + 6;
647
+ water(ctx, W, Hh, t, 0.35 + 0.3 * dP, 0.9 - 0.45 * dP);
648
+ const MJ = { x: 690, y: 300 };
649
+ const jOn = sm(0.4, 1.5, t), lure = flick(t, 2.5, 3.0, 3);
650
+ snow(ctx, W, Hh, t, camY, 0, vel, [{ x: MJ.x, y: MJ.y - 80, r: 330, k: 0.45 * jOn, col: C.cyan }, { x: 268, y: 520, r: 220, k: 0.7 * lure, col: C.amber }], 1);
651
+
652
+ // distant, out-of-focus jellies (rendered small and blurred once, instead of a per-stroke blur filter)
653
+ far(ctx, W, Hh, (x) => {
654
+ jelly(x, { x: 1120, y: 150 - (1 - dP) * 140, s: 34, t: t + 3, ph: 0.3, on: 0.45 * sm(0.6, 1.4, t), col: C.blue, tent: 7, tl: 90 });
655
+ jelly(x, { x: 120, y: 330 - (1 - dP) * 200, s: 24, t: t + 7, ph: 0.7, on: 0.4 * sm(0.8, 1.6, t), col: C.teal, tent: 6, tl: 60, tilt: 0.3 });
656
+ }, 1, 1);
657
+
658
+ // siphonophore: a long living chain down the right edge
659
+ const chain = [];
660
+ for (let i = 0; i < 24; i++) { const f = i / 23; chain.push([1050 + Math.sin(f * 3.2) * 140 + Math.sin(t * 0.6 + f * 4) * 8, -20 + f * 790 - (1 - dP) * 260]); }
661
+ siph(ctx, chain, t, (i) => flick(t, 1.6 + i * 0.07, 1.9 + i * 0.07, i) * (0.75 + 0.25 * Math.sin(t * 3 - i * 0.6)), 0.95, sm(0.8, 1.6, t), C.violet, C.cyan);
662
+
663
+ // comb jelly upper left
664
+ comb(ctx, 250, 160 - (1 - dP) * 220, 62, t, sm(1.7, 2.4, t), -0.35);
665
+
666
+ // main jellyfish with its nerve net glowing like a thinking brain
667
+ const nodeOn = (i) => { const nd = NET.nodes[i], t0 = 1.15 + (nd.L + 1) * 0.28 + hash(i) * 0.25; return flick(t, t0, t0 + 0.3, i); };
668
+ jelly(ctx, {
669
+ x: MJ.x, y: MJ.y - (1 - dP) * 320, s: 205, t, ph: 0.1, on: jOn, col: C.cyan, acc: C.mag, gon: sm(1.5, 2.2, t), tent: 16, tl: 420, sway: -0.12,
670
+ net: {
671
+ a: 1, act: (i) => nodeOn(i) * (0.45 + 0.55 * Math.pow(0.5 + 0.5 * Math.sin(t * 3.2 - NET.nodes[i].u * 3 - NET.nodes[i].v * 4), 3)),
672
+ ew: (e) => e.w0 * Math.min(nodeOn(e.a), nodeOn(e.b)),
673
+ nc: (i) => (i % 6 === 4 ? C.mag : C.cyan),
674
+ pulse: (e, i) => (Math.min(nodeOn(e.a), nodeOn(e.b)) > 0.95 ? (t * 0.9 + hash(i * 3.1)) % 1.6 : -1),
675
+ },
676
+ });
677
+ sparkles(ctx, MJ.x - 40, MJ.y + 220, 220, 150, t, 77, 70, sm(1.2, 2, t), C.cyan, 2.6);
678
+
679
+ // anglerfish, lower left, its lure lighting the water
680
+ angler(ctx, 150, 640, 120, t, lure, 1, false);
681
+ sparkles(ctx, 270, 520, 140, 90, t, 91, 26, lure * 0.8, C.amber, 2);
682
+
683
+ // title: plankton gathers into the words, then they glow
684
+ const tp = sm(3.0, 4.4, t), ta = sm(4.0, 4.6, t);
685
+ const l1 = 'Thinking', l2 = 'in the dark';
686
+ const f1 = F.titleI(84), f2 = F.titleI(84);
687
+ gather(ctx, textPts(l1, f1, 3), 330, 330, tp, t, C.cyan, 1 - ta * 0.85);
688
+ gather(ctx, textPts(l2, f2, 3), 330, 422, tp, t + 0.5, C.cyan, 1 - ta * 0.85);
689
+ gtext(ctx, l1, 330, 330, f1, C.cyan, ta, 'center', 18);
690
+ gtext(ctx, l2, 330, 422, f2, C.cyan, ta, 'center', 18);
691
+
692
+ hud(ctx, W, 180 + camY * 0.95, 4.6 - dP * 0.8, t, sm(0.2, 0.7, t), false);
693
+ finish(ctx, W, Hh, t);
694
+ }
695
+
696
+ // ======================= EXPLAINER =======================
697
+ // timings (seconds) shared by explainer() and explainerSound()
698
+ const T = {
699
+ D: 15,
700
+ g0: 0.15, g1: 1.25, crisp: [1.0, 1.35],
701
+ desc: [1.95, 2.95], head: [2.0, 2.65],
702
+ s2in: [2.2, 3.0], modelLbl: 3.05, arr2: [2.85, 3.45],
703
+ sw0: 3.0, swGap: 0.42, swDur: 1.6, cnt: [3.0, 5.7],
704
+ bloom: [6.0, 6.65],
705
+ cat3: [6.45, 7.1], guessArc: [6.95, 7.4], guessLbl: 7.25, dogQ: 7.5, check: 8.0,
706
+ adjArc: [8.4, 8.9], adjLbl: 8.65, ripple: [8.9, 9.6], again: [9.45, 9.85], catOk: 9.85,
707
+ dark: [10.2, 10.5], fish: [10.25, 11.05], reveal: [10.5, 11.2], acc: [10.95, 12.25], burst: 12.25,
708
+ out4: [12.95, 13.35], take: [13.0, 13.85], takeCrisp: [13.55, 13.95],
709
+ };
710
+ const LBL = H.mix(C.ice, C.cyan, 0.45); // secondary labels: icy cyan, so they glow like the others instead of reading grey
711
+ const SWK = ['cat', 'dog', 'dog', 'cat', 'cat', 'dog'];
712
+ const swTimes = SWK.map((_, i) => T.sw0 + i * T.swGap);
713
+ const swArrive = swTimes.map((s) => s + T.swDur * 0.9);
714
+
715
+ let LAY = [];
716
+ function layer(i, W, Hh) { if (!LAY[i]) LAY[i] = H.layer(W, Hh); return LAY[i]; }
717
+ function comp(ctx, W, Hh, i, fn, o) {
718
+ o = o || {};
719
+ if ((o.alpha == null ? 1 : o.alpha) <= 0.003) return;
720
+ const L = layer(i, W, Hh), x = L.getContext('2d');
721
+ x.setTransform(1, 0, 0, 1, 0, 0); x.globalCompositeOperation = 'source-over'; x.globalAlpha = 1; x.filter = 'none'; x.clearRect(0, 0, W, Hh);
722
+ fn(x);
723
+ x.setTransform(1, 0, 0, 1, 0, 0); x.globalAlpha = 1;
724
+ if (o.mask) { x.globalCompositeOperation = 'destination-in'; x.fillStyle = o.mask(x); x.fillRect(0, 0, W, Hh); x.globalCompositeOperation = 'source-over'; }
725
+ ctx.save();
726
+ if (o.clip) { ctx.beginPath(); o.clip(ctx); ctx.clip(); }
727
+ ctx.globalCompositeOperation = 'lighter'; ctx.globalAlpha = o.alpha == null ? 1 : o.alpha;
728
+ ctx.drawImage(L, 0, 0, W, Hh); ctx.restore();
729
+ }
730
+ const fmt = (n) => Math.round(n).toLocaleString('en-US');
731
+ const camYOf = (t) => E.inOut(sm(T.desc[0], T.desc[1], t)) * 1100 + t * 7;
732
+ const land = (t, t0, d) => { const p = sm(t0, t0 + (d || 0.3), t); return { a: p, dy: (1 - E.out(p)) * -16 }; };
733
+
734
+ // ---- beat 2: data swarms stream into the model ----
735
+ function scene2(x, W, Hh, t) {
736
+ const dy = (1 - E.out(sm(T.s2in[0], T.s2in[1], t))) * 560;
737
+ const MX = 930, MY = 300 + dy;
738
+ const act = (i) => {
739
+ const nd = NET.nodes[i]; let v = 0.3;
740
+ swArrive.forEach((ta) => { const d = t - ta - (nd.L + 1) * 0.07; if (d > 0) v += Math.exp(-d * 5) * 0.9; });
741
+ return cl(v);
742
+ };
743
+ jelly(x, { x: MX, y: MY, s: 150, t, ph: 0.2, col: C.cyan, gon: 0.6, tent: 14, tl: 340, sway: -0.05, net: { act, ew: (e) => e.w0 * 0.8 + 0.2 * Math.max(act(e.a), act(e.b)) } });
744
+ // label lands on the model
745
+ const ml = land(t, T.modelLbl);
746
+ gtext(x, 'AI model', MX, MY - 152 + ml.dy, F.label(32), LBL, ml.a, 'center', 14);
747
+ // the current carrying examples into the model
748
+ const P = [[70, 345 + dy * 0.3], [300, 300 + dy * 0.3], [560, 380 + dy * 0.3], [770, 318 + dy]];
749
+ current(x, P, E.inOut(sm(T.arr2[0], T.arr2[1], t)), t, C.teal, 0.85);
750
+ // swarms
751
+ SWK.forEach((k, i) => {
752
+ const p = (t - swTimes[i]) / T.swDur;
753
+ if (p < 0 || p > 1.02) return;
754
+ const lane = i % 2 ? 448 : 222;
755
+ const px = lerp(-110, 760, p * 0.75 + 0.25 * E.inOut(p)), py = lerp(lane, 320, sm(0.6, 1, p)) + Math.sin(p * 6 + i) * 12 + dy * 0.3;
756
+ const pts = k === 'cat' ? catPts() : dogPts(), col = k === 'cat' ? C.cyan : C.violet;
757
+ const form = sm(0.0, 0.32, p), ab = sm(0.8, 1.0, p);
758
+ swarm(x, pts, px, py, 0.82, form, t + i, col, 1 - sm(0.93, 1.02, p), { x: MX - 150, y: MY + 10, k: ab });
759
+ sparkles(x, px - 70, py, 90, 50, t, 300 + i, 18, (1 - ab) * 0.8, col, 3.5);
760
+ const la = sm(0.1, 0.2, p) * (1 - sm(0.76, 0.84, p)), ldy = (1 - E.out(sm(0.1, 0.24, p))) * -14;
761
+ gtext(x, k, px, py - 76 + ldy, F.label(34), col, la, 'center', 12);
762
+ });
763
+ // counter: hero number of the beat
764
+ const cp = sm(T.cnt[0], T.cnt[1], t), val = cp >= 1 ? 1e6 : Math.round(Math.pow(10, 6 * E.inOut(cp)) - 1);
765
+ const ca = sm(2.9, 3.2, t);
766
+ const nr = 64 + tw(x, '1,000,000', F.num(80));
767
+ gtext(x, fmt(val), nr, 652 + dy * 0.5, F.num(80), C.cyan, ca, 'right', 16);
768
+ gtext(x, 'examples', nr + 22, 652 + dy * 0.5, F.label(34), C.teal, ca, 'left', 10);
769
+ return { MX, MY };
770
+ }
771
+
772
+ // ---- beat 3: guess -> check -> adjust ----
773
+ function scene3(x, W, Hh, t) {
774
+ const JX = 420, JY = 345;
775
+ const flk = t > T.dogQ && t < T.check + 0.25 ? (0.55 + 0.45 * hash(Math.floor(t * 18))) * sm(T.dogQ, T.dogQ + 0.1, t) * (1 - sm(T.check + 0.1, T.check + 0.25, t)) : 0;
776
+ const bellCol = H.mix(C.cyan, C.amber, flk * 0.85);
777
+ const rp = (t - T.ripple[0]) / (T.ripple[1] - T.ripple[0]);
778
+ const delay = (u) => (1 - (u + 1) / 2) * 0.75; // ripple enters from the right side of the bell
779
+ const nodeR = (i) => rp - delay(NET.nodes[i].u);
780
+ const ag = (t - T.again[0]) / (T.again[1] - T.again[0]);
781
+ const net = {
782
+ act: (i) => {
783
+ const r = nodeR(i), nd = NET.nodes[i];
784
+ let v = 0.35 + 0.25 * Math.sin(t * 3 + i);
785
+ if (r > 0 && r < 0.6) v += Math.exp(-r * 6) * 1.5;
786
+ if (ag > 0 && ag < 1.4) v += Math.exp(-Math.abs(ag - (nd.L + 1) * 0.25) * 9) * 0.9;
787
+ return cl(v + flk * 0.4);
788
+ },
789
+ nc: (i) => { const r = nodeR(i); const m = r > 0 && r < 0.5 ? Math.exp(-r * 5) : 0; return H.mix(H.mix(C.cyan, C.amber, flk * (hash(i + Math.floor(t * 18)) > 0.4 ? 1 : 0.3)), C.mag, m); },
790
+ ew: (e) => { const r = Math.min(nodeR(e.a), nodeR(e.b)); return lerp(e.w0, e.w1, E.inOut(cl(r * 2.5))); },
791
+ ec: (e) => { const r = Math.min(nodeR(e.a), nodeR(e.b)); const m = r > 0 && r < 0.6 ? Math.exp(-r * 5) : 0; return H.mix(bellCol, C.mag, m); },
792
+ pulse: (e) => (ag > 0 && ag < 1.5 ? ag * 1.6 - (NET.nodes[e.a].L + 1) * 0.35 : -1),
793
+ };
794
+ jelly(x, { x: JX, y: JY, s: 178, t, ph: 0.55, col: bellCol, gon: 0.7, tent: 15, tl: 330, sway: 0.04, net });
795
+
796
+ // the new example: a cat-shaped swarm, no label yet
797
+ const cf = E.out(sm(T.cat3[0], T.cat3[1], t));
798
+ swarm(x, catPts(), 1010, 365, 0.95, cf, t, C.cyan, sm(T.cat3[0] - 0.1, T.cat3[0] + 0.2, t));
799
+ sparkles(x, 1010, 365, 120, 100, t, 512, 22, 0.6 * sm(T.cat3[0], T.cat3[1], t), C.cyan, 3);
800
+
801
+ // GUESS: top arc, example -> model
802
+ const gArc = [[930, 270], [860, 110], [680, 100], [600, 222]];
803
+ const gsig = ag > 0 && ag < 1 ? ag : (t > T.guessArc[0] && t < T.guessArc[1] + 0.3 ? -1 : -1);
804
+ current(x, gArc, E.inOut(sm(T.guessArc[0], T.guessArc[1], t)), t, C.cyan, 0.9, gsig, C.ice);
805
+ const gl = land(t, T.guessLbl);
806
+ gtext(x, 'Guess', 770, 92 + gl.dy, F.label(34), C.cyan, gl.a, 'center', 12);
807
+
808
+ // the model's answer above its bell: "dog?" (wrong) then "cat" (right)
809
+ const dq = sm(T.dogQ, T.dogQ + 0.25, t) * (1 - sm(T.catOk - 0.25, T.catOk - 0.05, t));
810
+ const shake = t > T.check && t < T.check + 0.35 ? Math.sin(t * 70) * 6 * (1 - (t - T.check) / 0.35) : 0;
811
+ gtext(x, 'dog?', JX - 20 + shake, 148, F.titleI(64), C.amber, dq, 'center', 18);
812
+ // CHECK: truth tag lands on the example, wrong answer gets crossed out
813
+ const ck = land(t, T.check, 0.25);
814
+ gtext(x, 'cat', 1010, 262 + ck.dy, F.label(38), C.cyan, ck.a, 'center', 12);
815
+ const cl2 = land(t, T.check + 0.12, 0.3);
816
+ gtext(x, 'Check', 1010, 492 + cl2.dy, F.label(34), LBL, cl2.a, 'center', 14);
817
+ const xm = sm(T.check, T.check + 0.18, t), xm2 = sm(T.check + 0.12, T.check + 0.3, t), xa = 1 - sm(T.catOk - 0.25, T.catOk - 0.05, t);
818
+ gstroke(x, () => { x.beginPath(); x.moveTo(530, 98); x.lineTo(530 + 44 * xm, 98 + 44 * xm); }, C.red, xm * xa, 5);
819
+ gstroke(x, () => { x.beginPath(); x.moveTo(574, 98); x.lineTo(574 - 44 * xm2, 98 + 44 * xm2); }, C.red, xm2 * xa, 5);
820
+ // emphasis: red pulse ring around the wrong guess
821
+ const er = (t - T.check) / 0.6;
822
+ if (er > 0 && er < 1) { ring(x, JX + 20, 128, 90 + er * 70, C.red, (1 - er) * 0.9, 3); ring(x, JX + 20, 128, 70 + er * 30, C.red, (1 - er) * 0.5, 2); }
823
+
824
+ // ADJUST: bottom arc, the error flows back into the model
825
+ const aArc = [[960, 448], [880, 640], [650, 640], [585, 380]];
826
+ const asg = (t - T.adjArc[0]) / (T.adjArc[1] - T.adjArc[0]);
827
+ current(x, aArc, E.inOut(sm(T.adjArc[0], T.adjArc[1], t)), t, C.mag, 0.9, asg > 0 && asg < 1.15 ? asg : null, C.mag);
828
+ const al = land(t, T.adjLbl);
829
+ gtext(x, 'Adjust', 770, 632 + al.dy, F.label(34), C.mag, al.a, 'center', 12);
830
+ // ripple of light across the bell as the weights change
831
+ if (rp > 0 && rp < 1.2) ring(x, JX + 120, JY - 40, 30 + rp * 260, C.mag, (1 - rp / 1.2) * 0.55, 2);
832
+
833
+ // right answer
834
+ const ok = sm(T.catOk, T.catOk + 0.25, t);
835
+ gtext(x, 'cat', JX - 30, 148 + (1 - E.out(ok)) * -14, F.titleI(64), C.green, ok, 'center', 18);
836
+ const okm = sm(T.catOk + 0.1, T.catOk + 0.35, t);
837
+ gstroke(x, () => { x.beginPath(); x.moveTo(498, 122); x.lineTo(498 + 14 * Math.min(1, okm * 2), 122 + 16 * Math.min(1, okm * 2)); if (okm > 0.5) x.lineTo(512 + 30 * (okm - 0.5) * 2, 138 - 40 * (okm - 0.5) * 2); }, C.green, okm, 5);
838
+ const okr = (t - T.catOk - 0.1) / 0.7;
839
+ if (okr > 0 && okr < 1) ring(x, JX + 10, 128, 70 + okr * 80, C.green, (1 - okr) * 0.7, 2.5);
840
+ }
841
+
842
+ // ---- beat 4: accuracy climbs along a siphonophore chain ----
843
+ function chainPts() {
844
+ const out = [];
845
+ for (let i = 0; i < 15; i++) { const f = i / 14, cv = (1 - Math.exp(-3.2 * f)) / (1 - Math.exp(-3.2)); out.push([620 + f * 580, 610 - cv * 440]); }
846
+ return out;
847
+ }
848
+ function scene4(x, W, Hh, t) {
849
+ const ap = E.out(sm(T.acc[0], T.acc[1], t)), val = Math.round(61 + 36 * ap);
850
+ const pts = chainPts().map((p, i) => [p[0] + Math.sin(t * 0.8 + i * 0.5) * 4, p[1] + Math.cos(t * 0.7 + i * 0.4) * 4]);
851
+ const shown = sm(10.6, 11.0, t);
852
+ const burst = (t - T.burst);
853
+ // axis: a faint dotted sea-floor line + rounds label
854
+ x.save(); x.globalCompositeOperation = 'lighter';
855
+ for (let sx = 600; sx <= 1220; sx += 14) dot(x, sx, 650, 4, C.teal, 0.45 * shown, 'core');
856
+ x.restore();
857
+ gtext(x, 'training rounds →', 910, 694, F.label(30), C.teal, shown, 'center', 10);
858
+ siph(x, pts, t, (i) => {
859
+ const th = i / 14; let v = ap >= th - 0.001 ? 1 : cl((ap - th + 0.07) / 0.07) * 0.6;
860
+ if (burst > 0 && burst < 0.8) v += Math.exp(-Math.abs(burst * 2 - (14 - i) * 0.08) * 6);
861
+ return cl(v);
862
+ }, 1.25, shown, C.violet, C.cyan);
863
+ // chain head lights the current value
864
+ const hi = Math.min(14, Math.floor(ap * 14 + 0.001)), hp = pts[hi];
865
+ dot(x, hp[0], hp[1], 70, C.cyan, 0.5 * shown);
866
+ // the number
867
+ const la = land(t, 10.75, 0.3);
868
+ gtext(x, 'Accuracy', 330, 188 + la.dy, F.label(40), LBL, la.a, 'center', 14);
869
+ const pop = burst > 0 ? 1 + 0.16 * Math.exp(-burst * 5) * Math.sin(Math.min(Math.PI, burst * 14)) : 1;
870
+ const flash = burst > 0 ? Math.exp(-burst * 3) : 0;
871
+ x.save(); x.translate(330, 290); x.scale(pop, pop);
872
+ gtext(x, val + '%', 0, 46, F.num(132), H.mix(C.cyan, WH, flash * 0.6), sm(10.7, 11.0, t), 'center', 20 + flash * 20);
873
+ x.restore();
874
+ // 97% emphasis: rings + plankton bloom burst
875
+ if (burst > 0 && burst < 1.4) {
876
+ const b = burst / 1.4;
877
+ ring(x, 330, 290, 120 + b * 360, C.cyan, (1 - b) * 0.8, 3);
878
+ ring(x, 330, 290, 100 + E.out(b) * 220, C.mag, (1 - b) * 0.5, 2);
879
+ x.save(); x.globalCompositeOperation = 'lighter';
880
+ const R = H.rng(1297);
881
+ for (let i = 0; i < 260; i++) {
882
+ const ang = R() * TAU, sp = R.range(120, 620), r0 = R.range(40, 110), dd = r0 + sp * E.out(cl(burst / 1.1));
883
+ const col = R() < 0.12 ? C.mag : R() < 0.1 ? C.amber : C.cyan, fl = 0.6 + 0.4 * Math.sin(t * 14 + i);
884
+ dot(x, 330 + Math.cos(ang) * dd, 290 + Math.sin(ang) * dd * 0.75, R.range(4, 9), col, (1 - b) * fl, 'core');
885
+ }
886
+ x.restore();
887
+ }
888
+ }
889
+
890
+ // ---- beat 5: takeaway forms out of gathering light ----
891
+ const TK1 = 'More examples', TK2 = 'better guesses';
892
+ function scene5(x, W, Hh, t) {
893
+ const f = F.title(80), p = sm(T.take[0], T.take[1], t), ca = sm(T.takeCrisp[0], T.takeCrisp[1], t);
894
+ const w1 = tw(x, TK1, f), c1x = 570, c2x = 700, y1 = 262, y2 = 376;
895
+ const from = { x: 330, y: 300, r: 520 };
896
+ gather(x, textPts(TK1, f, 3), c1x, y1 + 22, p, t, C.cyan, 1 - ca * 0.8, from);
897
+ gather(x, textPts(TK2, f, 3), c2x, y2 + 22, p, t + 0.3, C.cyan, 1 - ca * 0.8, from);
898
+ const g1 = F.title(80);
899
+ gtext(x, TK1, c1x, y1 + 22, g1, C.cyan, ca, 'center', 18);
900
+ gtext(x, TK2, c2x, y2 + 22, g1, C.cyan, ca, 'center', 18);
901
+ // arrow made of plankton
902
+ const ax = c1x + w1 / 2 + 24;
903
+ const arp = E.out(sm(T.take[1] - 0.2, T.take[1] + 0.25, t)), ay = y1 - 4;
904
+ gstroke(x, () => { x.beginPath(); x.moveTo(ax, ay); x.lineTo(ax + 100 * arp, ay); if (arp > 0.8) { const hk = (arp - 0.8) / 0.2 * 18; x.moveTo(ax + 100 - hk, ay - hk); x.lineTo(ax + 100, ay); x.lineTo(ax + 100 - hk, ay + hk); } }, C.teal, arp, 4);
905
+ current(x, [[ax, ay], [ax + 33, ay], [ax + 66, ay], [ax + 100, ay]], arp, t, C.cyan, 0.8);
906
+ // the model, calm and bright, rising below
907
+ const ry = E.out(sm(T.take[0], 14.6, t));
908
+ jelly(x, { x: 640, y: lerp(900, 562, ry), s: 105, t, ph: 0.3, col: C.cyan, gon: 0.8, tent: 12, tl: 190, net: { act: (i) => 0.6 + 0.4 * Math.sin(t * 3 - i), ew: (e) => e.w1 } });
909
+ sparkles(x, 640, 330, 420, 140, t, 777, 40, ca * 0.7, C.cyan, 2.2);
910
+ }
911
+
912
+ function explainer(ctx, W, Hh, t) {
913
+ const camY = camYOf(t), vel = (camYOf(t + 0.02) - camYOf(t - 0.02)) / 0.04;
914
+ const dP = E.inOut(sm(T.desc[0], T.desc[1], t));
915
+ water(ctx, W, Hh, t, 0.25 + 0.7 * dP, 1 - dP);
916
+ const fishOn = sm(T.fish[0], T.fish[0] + 0.1, t) * (1 - sm(T.out4[0], T.out4[1], t));
917
+ const fx = lerp(-300, 150, E.out(sm(T.fish[0], T.fish[1], t))), fy = 590;
918
+ const lureW = [fx + 98 * 1.15, fy - 100 * 1.15];
919
+ const lights = [];
920
+ if (t > T.s2in[0] && t < T.bloom[1]) lights.push({ x: 930, y: 260, r: 300, k: 0.4, col: C.cyan });
921
+ if (t > T.bloom[0] && t < T.dark[1]) lights.push({ x: 420, y: 300, r: 320, k: 0.4, col: C.cyan });
922
+ if (fishOn > 0) lights.push({ x: lureW[0], y: lureW[1], r: 260, k: 0.8 * fishOn, col: C.amber });
923
+ snow(ctx, W, Hh, t, camY, 0, vel, lights, 1 - 0.3 * sm(T.dark[0], T.dark[1], t) * (1 - sm(T.reveal[0], T.reveal[1], t)));
924
+
925
+ // persistent far layer, as in the still: small out-of-focus jellies and a dim siphonophore strand drifting in the
926
+ // distance (slow parallax with the descent), dimmed while the lights go out before the anglerfish reveal.
927
+ // Each far animal is a cached, pre-blurred sprite that only drifts and breathes, so the layer costs ~nothing.
928
+ {
929
+ const dk = sm(T.dark[0], T.dark[1], t) * (1 - sm(T.reveal[0], T.reveal[1], t));
930
+ const fa = sm(0.2, 1.2, t) * (1 - 0.75 * dk), py = camY * 0.14;
931
+ if (fa > 0.004) {
932
+ ctx.save(); ctx.globalCompositeOperation = 'lighter';
933
+ FARJ.forEach((J, i) => {
934
+ const sp = farJelly(i, J), c = Math.pow(0.5 + 0.5 * Math.sin(TAU * (t * 0.45 + J.ph)), 2);
935
+ const x = J.x + Math.sin(t * J.dr + i * 1.3) * J.sw, y = J.y - py - t * J.v;
936
+ ctx.globalAlpha = fa * J.on;
937
+ ctx.save(); ctx.translate(x, y); ctx.rotate(J.tilt || 0); ctx.scale(1 - 0.1 * c, 1 + 0.06 * c);
938
+ ctx.drawImage(sp.cv, -sp.ox, -sp.oy, sp.w, sp.h); ctx.restore();
939
+ });
940
+ const st = farStrand();
941
+ ctx.globalAlpha = fa * (0.8 + 0.2 * Math.sin(t * 0.9));
942
+ ctx.drawImage(st.cv, Math.sin(t * 0.4) * 14, -py * 1.4 - 60, st.w, st.h);
943
+ ctx.restore();
944
+ }
945
+ }
946
+
947
+ // ---- beat 1: hook (plankton gathers into the question), a comb jelly drifts by
948
+ if (t < 3.2) {
949
+ comb(ctx, 1040, 230 - camY * 0.8 + Math.sin(t) * 8, 60, t, sm(0.2, 0.9, t), -0.4);
950
+ jelly(ctx, { x: 230, y: 560 - camY * 0.6, s: 46, t: t + 2, ph: 0.6, on: 0.5 * sm(0.3, 1.2, t), col: C.blue, tent: 8, tl: 110, tilt: 0.25 });
951
+ }
952
+ const hk = E.inOut(sm(T.head[0], T.head[1], t));
953
+ const hookFont0 = F.title(66);
954
+ if (t < T.crisp[1] + 0.6) gather(ctx, textPts('How does AI learn?', hookFont0, 3), 640, 352, sm(T.g0, T.g1, t), t, C.cyan, 1 - sm(T.crisp[0], T.crisp[1] + 0.5, t));
955
+
956
+ // ---- beat 2 (rises in during the descent) until the plankton bloom sweeps it away
957
+ const bf = lerp(-200, W + 200, E.inOut(sm(T.bloom[0], T.bloom[1], t)));
958
+ if (t > T.s2in[0] && t < T.bloom[1]) comp(ctx, W, Hh, 0, (x) => scene2(x, W, Hh, t), { clip: (c) => c.rect(bf, 0, W + 400, Hh) });
959
+ // ---- beat 3 behind the bloom front
960
+ if (t > T.bloom[0] && t < T.dark[1] + 0.05) comp(ctx, W, Hh, 1, (x) => scene3(x, W, Hh, t), { clip: (c) => c.rect(-10, 0, bf + 10, Hh), alpha: 1 - sm(T.dark[0], T.dark[1], t) });
961
+ // the bloom itself: a sweeping wall of sparkling plankton
962
+ if (t > T.bloom[0] && t < T.bloom[1]) {
963
+ ctx.save(); ctx.globalCompositeOperation = 'lighter';
964
+ const g = ctx.createLinearGradient(bf - 260, 0, bf + 40, 0);
965
+ g.addColorStop(0, 'rgba(40,200,220,0)'); g.addColorStop(0.75, 'rgba(60,220,240,0.22)'); g.addColorStop(1, 'rgba(60,220,240,0)');
966
+ ctx.fillStyle = g; ctx.fillRect(bf - 260, 0, 300, Hh);
967
+ const R = H.rng(606);
968
+ for (let i = 0; i < 340; i++) {
969
+ const off = Math.abs(R.gauss()) * 110, yy = R() * Hh, ph = R() * TAU, col = R() < 0.08 ? C.mag : R() < 0.5 ? C.cyan : C.teal;
970
+ const fl = 0.5 + 0.5 * Math.sin(t * 16 + ph);
971
+ dot(ctx, bf - off + Math.sin(yy * 0.03 + t * 3) * 20, yy, R.range(3, 8), col, fl * (1 - off / 360), 'core');
972
+ }
973
+ ctx.restore();
974
+ }
975
+
976
+ // ---- beat 4: the anglerfish lure lights up a new patch of water
977
+ if (t > T.fish[0] && t < T.out4[1] + 0.05) {
978
+ const rr = 1700 * E.in(sm(T.reveal[0], T.reveal[1], t));
979
+ comp(ctx, W, Hh, 0, (x) => scene4(x, W, Hh, t), {
980
+ alpha: 1 - sm(T.out4[0], T.out4[1], t),
981
+ mask: t < T.reveal[1] ? (x) => { const g = x.createRadialGradient(lureW[0], lureW[1], 0, lureW[0], lureW[1], Math.max(1, rr)); g.addColorStop(0, 'rgba(0,0,0,1)'); g.addColorStop(0.6, 'rgba(0,0,0,1)'); g.addColorStop(1, 'rgba(0,0,0,0)'); return g; } : null,
982
+ });
983
+ angler(ctx, fx, fy, 115, t, flick(t, T.fish[0] + 0.05, T.fish[0] + 0.35, 5), fishOn, false);
984
+ }
985
+ // ---- beat 5: takeaway
986
+ if (t > T.take[0]) comp(ctx, W, Hh, 1, (x) => scene5(x, W, Hh, t), {
987
+ // the rising jelly's tentacles fade into the dark instead of being cut by the frame edge
988
+ mask: (x) => { const g = x.createLinearGradient(0, 590, 0, Hh); g.addColorStop(0, 'rgba(0,0,0,1)'); g.addColorStop(1, 'rgba(0,0,0,0.08)'); return g; },
989
+ });
990
+
991
+ // vignette first, so the hook/header keeps its full glow in the corner
992
+ H.vignette(ctx, W, Hh, 0.6, '0,0,4');
993
+ {
994
+ const px = lerp(66, 44, hk), fnt = F.title(px), wq = tw(ctx, 'How does AI learn?', fnt);
995
+ const cx = lerp(640, 36 + wq / 2, hk), cy = lerp(352, 64, hk);
996
+ gtext(ctx, 'How does AI learn?', cx, cy, fnt, H.mix(C.cyan, C.ice, hk * 0.6), sm(T.crisp[0], T.crisp[1], t), 'center', lerp(18, 12, hk));
997
+ }
998
+ hud(ctx, W, 160 + camY * 0.78 + sm(T.fish[0], T.fish[1], t) * 40, 5.2 - dP * 1.4, t, 0.9, false);
999
+ H.grain(ctx, W, Hh, 0.035, 1 + Math.floor(t * 24), true);
1000
+ }
1001
+
1002
+
1003
+ // ======================= SOUND =======================
1004
+ function deepSound(k) {
1005
+ const D = T.D, R = H.rng(8080);
1006
+ const when = (f, v, a, b) => { for (let t = a; t <= b; t += 0.001) if (f(t) >= v) return t; return b; };
1007
+ // soft rising bubble "bloop" (all under ~1.5 kHz)
1008
+ const bubble = (t, f0, g, pan) => k.tone(t, { f: [[0, f0], [0.045, f0 * 2.1]], dur: 0.075, gain: 0.13 * (g || 1), a: 0.003, filter: 'lowpass', f2: 1500, pan: pan || 0, verb: 0.3 });
1009
+ const bubbles = (t, n, spread, g) => { for (let i = 0; i < n; i++) bubble(t + R() * spread, 220 + R() * 260, (g || 1) * (0.5 + R() * 0.5), R() * 1.2 - 0.6); };
1010
+ // sonar-like low ping with a faint echo
1011
+ const ping = (t, f, g, pan) => { k.tone(t, { f, dur: 1.5, gain: 0.1 * (g || 1), a: 0.006, verb: 0.55, pan: pan || 0 });
1012
+ k.tone(t + 0.38, { f, dur: 1.0, gain: 0.03 * (g || 1), a: 0.01, verb: 0.6, pan: -(pan || 0) * 0.5 }); };
1013
+ // muffled swell of moving water
1014
+ const swell = (t, d, g, top) => { k.noise(t, { dur: d, color: 'brown', filter: 'lowpass', f: [[0, 120], [d * 0.55, top || 700], [d, 160]], q: 0.7, gain: 0.5 * (g || 1), a: d * 0.5, verb: 0.3 });
1015
+ k.noise(t, { dur: d, color: 'pink', filter: 'bandpass', f: [[0, 200], [d * 0.55, (top || 700) * 1.3], [d, 250]], q: 1.2, gain: 0.07 * (g || 1), a: d * 0.55 }); };
1016
+ // plankton shimmer: soft, low-passed glints
1017
+ const shimmer = (t, d, g) => { const notes = [587, 698, 880, 988, 1175, 784];
1018
+ for (let x = 0; x < d; x += 0.06 + R() * 0.05) k.tone(t + x, { f: notes[Math.floor(R() * notes.length)], dur: 0.45, gain: 0.022 * (g || 1), a: 0.015, filter: 'lowpass', f2: 1300, verb: 0.45, pan: R() * 1.4 - 0.7 });
1019
+ k.noise(t, { dur: d, color: 'pink', filter: 'bandpass', f: 1100, q: 2, gain: 0.025 * (g || 1), a: d * 0.4 }); };
1020
+ // low murmur of the current drawing on
1021
+ const stream = (t, d, g, pan) => k.noise(t, { dur: d, color: 'pink', filter: 'bandpass', f: [[0, 260], [d, 620]], q: 1.6, gain: 0.1 * (g || 1), a: d * 0.3, pan: pan || 0 });
1022
+ const chord = (t, notes, d, g) => notes.forEach((n, i) => { k.tone(t, { f: n, type: i ? 'sine' : 'triangle', dur: d, gain: 0.06 * g, a: 0.08, hold: d * 0.35, verb: 0.5, pan: (i - (notes.length - 1) / 2) * 0.3, filter: 'lowpass', f2: 1400 }); });
1023
+ const odo = (val, a, b, gap, f) => { let last = -1, prev = val(a);
1024
+ for (let t = a; t <= b; t += 0.002) { const v = val(t); if (v !== prev && t - last >= gap) { k.play('tock', t, { f, gain: 0.55, pan: -0.3, minor: true }); last = t; } prev = v; } };
1025
+
1026
+ // ---- beds: deep rumble, slow current, a calm dark pad
1027
+ k.bed('room', 0, D, { gain: 1.6 });
1028
+ k.withMinor(() => { k.noise(0, { dur: D, color: 'brown', filter: 'lowpass', f: 90, gain: 0.16, a: 1.2, hold: D - 2.4, bus: 'amb' });
1029
+ for (let x = 0.5; x < D - 2; x += 3.2) k.noise(x, { dur: 3.4, color: 'pink', filter: 'bandpass', f: [[0, 180], [1.7, 360], [3.4, 200]], q: 0.9, gain: 0.04, a: 1.6, bus: 'amb', pan: Math.sin(x) * 0.5 }); });
1030
+ k.music('pad', 0, D, { bpm: 60, gain: 0.5, chords: [['D3', 'A3', 'C4', 'F4'], ['Bb2', 'F3', 'A3', 'D4'], ['G2', 'D3', 'F3', 'Bb3'], ['A2', 'E3', 'G3', 'C#4']] });
1031
+
1032
+ // ---- beat 1: plankton gathers into the question
1033
+ k.withMinor(() => shimmer(T.g0, T.g1 - T.g0, 1));
1034
+ ping(T.crisp[0] + 0.05, 'A4', 0.9);
1035
+ // header glides to the corner: a soft low slide
1036
+ k.noise(T.head[0], { dur: 0.6, color: 'pink', filter: 'bandpass', f: [[0, 500], [0.6, 250]], q: 1, gain: 0.06, a: 0.25, minor: true });
1037
+ // the descent: a muffled swell, bubbles streaming past
1038
+ swell(T.desc[0], 1.2, 1.1, 650);
1039
+ k.withMinor(() => bubbles(T.desc[0] + 0.2, 7, 0.8, 0.8));
1040
+
1041
+ // ---- beat 2: data swarms ride the current into the model
1042
+ k.withMinor(() => stream(T.arr2[0], T.arr2[1] - T.arr2[0] + 0.2, 1, -0.3));
1043
+ ping(T.modelLbl, 'D4', 0.6, 0.4); // "AI model" lands
1044
+ swTimes.forEach((st, i) => {
1045
+ const pan = -0.7 + i * 0.05;
1046
+ k.withMinor(() => k.noise(st, { dur: 0.5, color: 'pink', filter: 'bandpass', f: 900, q: 2, gain: 0.03, a: 0.3, pan })); // swarm gathers
1047
+ k.play('pop', st + 0.1 * T.swDur + 0.03, { f: 360, gain: 0.65, pan, minor: true }); // label lands (soft, low)
1048
+ const ta = st + 0.85 * T.swDur; // absorbed into the tentacles
1049
+ k.withMinor(() => { k.tone(ta, { f: [[0, 260], [0.18, 120]], dur: 0.25, gain: 0.12, a: 0.01, filter: 'lowpass', f2: 900, pan: 0.4, verb: 0.3 }); bubble(ta + 0.08, 300, 0.6, 0.45); });
1050
+ });
1051
+ // counter rolls to 1,000,000 (value = 10^(6*inOut(p)) - 1)
1052
+ odo((t) => { const p = sm(T.cnt[0], T.cnt[1], t); return p >= 1 ? 1e6 : Math.round(Math.pow(10, 6 * E.inOut(p)) - 1); }, T.cnt[0] + 0.02, T.cnt[1], 0.09, 620);
1053
+ ping(T.cnt[1], 'A3', 0.8, -0.4);
1054
+
1055
+ // ---- bloom sweeps across
1056
+ swell(T.bloom[0] - 0.05, 0.85, 1.0, 900);
1057
+ shimmer(T.bloom[0], T.bloom[1] - T.bloom[0], 1.5);
1058
+
1059
+ // ---- beat 3: guess -> check -> adjust
1060
+ k.withMinor(() => shimmer(T.cat3[0], T.cat3[1] - T.cat3[0], 0.7));
1061
+ k.withMinor(() => stream(T.guessArc[0], T.guessArc[1] - T.guessArc[0] + 0.15, 0.9, 0.2));
1062
+ k.play('pop', T.guessLbl + 0.03, { f: 340, gain: 0.65, pan: 0.2, minor: true });
1063
+ // "dog?" — an uncertain, wavering glow
1064
+ k.tone(T.dogQ, { f: [[0, 330], [0.25, 370], [0.5, 311]], type: 'triangle', dur: 0.7, gain: 0.09, a: 0.04, hold: 0.3, filter: 'lowpass', f2: 900, verb: 0.35, pan: -0.3 });
1065
+ k.tone(T.dogQ, { f: 311, type: 'sine', dur: 0.7, gain: 0.05, a: 0.05, hold: 0.3, verb: 0.35, pan: -0.3 });
1066
+ // check: wrong — a muffled low double tone
1067
+ k.tone(T.check, { f: [[0, 233], [0.14, 208]], type: 'triangle', dur: 0.2, gain: 0.2, a: 0.004, hold: 0.1, filter: 'lowpass', f2: 700, pan: -0.2 });
1068
+ k.tone(T.check + 0.18, { f: [[0, 185], [0.25, 150]], type: 'triangle', dur: 0.34, gain: 0.2, a: 0.004, hold: 0.16, filter: 'lowpass', f2: 600, pan: -0.2 });
1069
+ k.play('thud', T.check, { f: 90, gain: 0.35 });
1070
+ k.play('pop', T.check + 0.15, { f: 300, gain: 0.65, pan: 0.6, minor: true }); // "Check" lands
1071
+ // adjust: the error signal flows back along the lower arc
1072
+ k.noise(T.adjArc[0], { dur: 0.6, color: 'pink', filter: 'bandpass', f: [[0, 900], [0.5, 260]], q: 2.2, gain: 0.16, a: 0.25, pan: 0.3, verb: 0.3 });
1073
+ k.play('pop', T.adjLbl + 0.03, { f: 280, gain: 0.65, pan: 0.2, minor: true });
1074
+ // the ripple through the nerve net: a deep swell + droplets crossing the bell right to left
1075
+ swell(T.ripple[0], 0.9, 0.8, 500);
1076
+ [784, 698, 587, 523, 440, 392].forEach((f, i) => k.tone(T.ripple[0] + 0.05 + i * 0.1, { f, dur: 0.6, gain: 0.05, a: 0.006, verb: 0.5, filter: 'lowpass', f2: 1300, pan: 0.5 - i * 0.18, minor: i > 0 }));
1077
+ // guess again, pulse rides the top arc
1078
+ k.withMinor(() => stream(T.again[0], 0.4, 0.7, 0.2));
1079
+ // right answer: a warm, open interval
1080
+ ping(T.catOk, 'A4', 1.0, -0.3);
1081
+ k.tone(T.catOk + 0.09, { f: 'E5', dur: 1.3, gain: 0.08, a: 0.008, verb: 0.5, pan: -0.2 });
1082
+ k.tone(T.catOk, { f: 'A3', type: 'triangle', dur: 1.2, gain: 0.06, a: 0.02, filter: 'lowpass', f2: 900, verb: 0.4 });
1083
+
1084
+ // ---- darkness, then the anglerfish lure lights new water
1085
+ swell(T.dark[0] - 0.05, 0.9, 0.9, 380);
1086
+ const ft = T.fish[0];
1087
+ k.withMinor(() => { for (let i = 0; i < 5; i++) k.noise(ft + 0.06 + i * 0.055, { dur: 0.035, color: 'brown', filter: 'bandpass', f: 420, q: 2, gain: 0.14 }); }); // lure flickers on
1088
+ k.tone(ft + 0.3, { f: 'D3', type: 'triangle', dur: 1.4, gain: 0.07, a: 0.2, filter: 'lowpass', f2: 700, verb: 0.4, pan: -0.5 });
1089
+ swell(T.reveal[0], 0.9, 0.9, 800);
1090
+ ping(10.78, 'D4', 0.6, -0.3); // "Accuracy" lands
1091
+ odo((t) => Math.round(61 + 36 * E.out(sm(T.acc[0], T.acc[1], t))), T.acc[0] + 0.01, T.acc[1] - 0.02, 0.085, 560);
1092
+
1093
+ // ---- 97%: the bloom burst — deep warm swell, sub hit, chord and a plankton shimmer
1094
+ const B = T.burst;
1095
+ k.tone(B, { f: [[0, 98], [0.5, 55]], dur: 0.9, gain: 0.4, a: 0.005 });
1096
+ k.play('thud', B, { f: 80, gain: 0.6 });
1097
+ swell(B - 0.02, 1.4, 1.2, 1000);
1098
+ chord(B + 0.02, ['D3', 'A3', 'D4', 'F#4', 'A4'], 1.6, 1.1);
1099
+ shimmer(B + 0.05, 0.9, 1.6);
1100
+
1101
+ // ---- takeaway forms out of the light, resolving chord
1102
+ k.withMinor(() => shimmer(T.take[0], T.take[1] - T.take[0], 1));
1103
+ k.noise(T.take[1] - 0.2, { dur: 0.5, color: 'pink', filter: 'bandpass', f: [[0, 300], [0.4, 700]], q: 1.5, gain: 0.06, a: 0.2, pan: 0.3, minor: true }); // arrow streams on
1104
+ chord(T.takeCrisp[0] + 0.1, ['G2', 'D3', 'B3', 'D4', 'G4'], 1.4, 0.9);
1105
+ ping(T.takeCrisp[0] + 0.1, 'B4', 0.5, 0.2);
1106
+ }
1107
+
1108
+ registerStyle({
1109
+ id: 'deep-sea',
1110
+ name: 'Bioluminescent Deep Sea',
1111
+ category: 'Light & Imaging',
1112
+ description: 'The midnight zone: near-black water with parallax marine snow, and nothing lit but living light — a jellyfish whose nerve net glows like a neural network, a siphonophore chain, a rainbow-rippling comb jelly and an anglerfish lure. Additive cyan, teal and electric-blue glow with magenta and amber accents; type is bioluminescent.',
1113
+ motion: 'The camera sinks (marine snow streams upward) as animals switch on one by one: bell rims pulse, nerve-net nodes flicker alight, the siphonophore lights segment by segment, the lure blinks on, and the words form out of gathering plankton.',
1114
+ fonts: [F.title(66), F.title(38), F.title(80), F.label(30), F.titleI(84), F.titleI(64), F.num(132), F.label(34), F.hud(15)],
1115
+ frameT: 5.6,
1116
+ duration: 6,
1117
+ readsPixels: true,
1118
+ draw(ctx, W, Hh, t) { hero(ctx, W, Hh, t); },
1119
+ explainerDuration: T.D,
1120
+ explainerNote: 'A descent through the midnight zone: the question forms from gathering plankton, cat and dog swarms ride a glowing current into a jellyfish model whose nerve net is its weights, the error ripples back through the net in magenta, accuracy climbs a siphonophore chain to a plankton bloom-burst, and transitions are a descent, a sweeping plankton bloom and an anglerfish lure lighting new water.',
1121
+ explainer(ctx, W, Hh, t) { explainer(ctx, W, Hh, t); },
1122
+ explainerSound(k) { deepSound(k); },
1123
+ });
1124
+ }