@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,814 @@
1
+ {
2
+ // ---------- Psychedelic Poster: 1960s San Francisco concert-poster psychedelia ----------
3
+ // Flat full-strength litho inks in vibrating complementary pairs, liquid domain-warped ring bands,
4
+ // sunbursts, mirror-symmetric eye-flowers, and bulbous Shrikhand lettering warped slice by slice.
5
+ const TAU = Math.PI * 2;
6
+ const C = {
7
+ mag: '#ff1a8c', acid: '#a4f01a', orange: '#ff6a00', blue: '#1b3dff', purple: '#6d17c8', yellow: '#ffe11a',
8
+ ink: '#22072b', cream: '#fbefd2', red: '#ec1c24', pink: '#ff9ad5', white: '#fffaf0',
9
+ };
10
+ const cl = H.clamp, E = H.ease;
11
+ const seg = (t, a, b) => cl((t - a) / (b - a));
12
+ const lerp = H.lerp;
13
+ const cache = { text: new Map() };
14
+ const hash1 = (n) => { let h = Math.imul(n | 0, 374761393) ^ 0x5bd1e995; h = Math.imul(h ^ (h >>> 13), 1274126177); return ((h ^ (h >>> 16)) >>> 0) / 4294967296; };
15
+ const bez = (p0, p1, p2, p3, u) => { const v = 1 - u; return [v * v * v * p0[0] + 3 * v * v * u * p1[0] + 3 * v * u * u * p2[0] + u * u * u * p3[0], v * v * v * p0[1] + 3 * v * v * u * p1[1] + 3 * v * u * u * p2[1] + u * u * u * p3[1]]; };
16
+
17
+ // ---------- liquid ring bands (domain-warped, optionally kaleidoscope-folded) ----------
18
+ function liquid(ctx, W, H_, t, o) {
19
+ const S = 2, w = (W / S) | 0, h = (H_ / S) | 0;
20
+ if (!cache.liq) { cache.liq = H.layer(w, h); cache.liqX = cache.liq.getContext('2d'); cache.liqImg = cache.liqX.createImageData(w, h); cache.prevRow = new Float32Array(w); }
21
+ const d = cache.liqImg.data, prev = cache.prevRow;
22
+ const rgb = (c) => (Array.isArray(c) ? c : H.hex(c));
23
+ const A = o.cols.map(rgb), LA = o.line ? rgb(o.line) : null;
24
+ const fl = o.flood, B = fl ? fl.cols.map(rgb) : null, LB = fl && fl.line ? rgb(fl.line) : null, fr2 = fl ? fl.r * fl.r : 0;
25
+ const lw = o.lineW == null ? 0.12 : o.lineW;
26
+ const cx = o.cx == null ? W / 2 : o.cx, cy = o.cy == null ? H_ / 2 : o.cy, k = 1 / 360;
27
+ const warp = o.warp == null ? 0.3 : o.warp, freq = o.freq || 9, ph0 = (o.phase || 0) - t * (o.speed == null ? 0.6 : o.speed);
28
+ const spiral = o.spiral || 0, fold = o.fold || 0, nf = o.nfold || 8, sA = TAU / nf, frot = o.foldRot || 0;
29
+ const tt = t * (o.flow == null ? 1 : o.flow);
30
+ const band = (p, cols, line) => { const f0 = Math.floor(p), f = p - f0; if (line && f < lw) return line; const n = cols.length; return cols[((f0 % n) + n) % n]; };
31
+ for (let y = 0; y < h; y++) {
32
+ let lastP = 0;
33
+ for (let x = 0; x < w; x++) {
34
+ const X = x * S + 1, Y = y * S + 1;
35
+ let px = (X - cx) * k, py = (Y - cy) * k;
36
+ if (fold > 0) {
37
+ const r0 = Math.hypot(px, py); let a = Math.atan2(py, px) + frot; a = ((a % sA) + sA) % sA; a = Math.abs(a - sA / 2);
38
+ px += (Math.cos(a) * r0 - px) * fold; py += (Math.sin(a) * r0 - py) * fold;
39
+ }
40
+ let u = px, v = py;
41
+ for (let i = 1; i <= 4; i++) { u += (warp / i) * Math.sin(i * 1.6 * v + tt * 0.7 + i * 1.9); v += (warp / i) * Math.cos(i * 1.4 * u - tt * 0.55 + i * 0.6); }
42
+ let p = Math.hypot(u, v) * freq + ph0;
43
+ if (spiral) p += (spiral * Math.atan2(v, u)) / TAU;
44
+ const gx = x ? lastP - p : 0, gy = y ? prev[x] - p : 0;
45
+ const dp = Math.min(0.6, Math.max(0.02, Math.abs(gx), Math.abs(gy)));
46
+ lastP = p; prev[x] = p;
47
+ let cols = A, line = LA;
48
+ if (fl) { const dx = X - fl.cx, dy = Y - fl.cy; if (dx * dx + dy * dy < fr2) { cols = B; line = LB; } }
49
+ // colour plate (anti-aliased), then the key-line plate printed a hair off register (~1.4px right, 1px down)
50
+ const c0 = band(p - dp * 0.35, cols, null), c1 = band(p, cols, null), c2 = band(p + dp * 0.35, cols, null);
51
+ let r = (c0[0] + 2 * c1[0] + c2[0]) >> 2, g = (c0[1] + 2 * c1[1] + c2[1]) >> 2, b = (c0[2] + 2 * c1[2] + c2[2]) >> 2;
52
+ if (line) {
53
+ const pd = p + (Math.abs(gx) < 0.6 ? gx * 0.7 : 0) + (Math.abs(gy) < 0.6 ? gy * 0.5 : 0);
54
+ const fa = pd - dp * 0.35, fb = pd + dp * 0.35;
55
+ const cov = ((fa - Math.floor(fa) < lw) + 2 * (pd - Math.floor(pd) < lw) + (fb - Math.floor(fb) < lw)) * 0.25;
56
+ if (cov > 0) { r += (line[0] - r) * cov; g += (line[1] - g) * cov; b += (line[2] - b) * cov; }
57
+ }
58
+ const i4 = (y * w + x) * 4;
59
+ d[i4] = r; d[i4 + 1] = g; d[i4 + 2] = b; d[i4 + 3] = 255;
60
+ }
61
+ }
62
+ cache.liqX.putImageData(cache.liqImg, 0, 0);
63
+ ctx.save(); ctx.imageSmoothingEnabled = true; ctx.imageSmoothingQuality = 'high'; ctx.drawImage(cache.liq, 0, 0, W, H_); ctx.restore();
64
+ }
65
+
66
+ // ---------- paper + ink finish ----------
67
+ function finishTex(W, H_) {
68
+ if (cache.paper) return;
69
+ const c = H.layer(W, H_), x = c.getContext('2d');
70
+ const nz = H.makeNoise(77), sw = 160, sh = 90, s = H.layer(sw, sh), sx = s.getContext('2d'), im = sx.createImageData(sw, sh);
71
+ for (let y = 0; y < sh; y++) for (let xx = 0; xx < sw; xx++) {
72
+ const v = 0.5 + 0.5 * nz.fbm2(xx * 0.05, y * 0.05, 4), i = (y * sw + xx) * 4;
73
+ im.data[i] = 255 - 8 * v; im.data[i + 1] = 249 - 16 * v; im.data[i + 2] = 236 - 28 * v; im.data[i + 3] = 255;
74
+ }
75
+ sx.putImageData(im, 0, 0);
76
+ x.imageSmoothingQuality = 'high'; x.drawImage(s, 0, 0, W, H_);
77
+ const r = H.rng(5); x.lineCap = 'round';
78
+ for (let i = 0; i < 1100; i++) {
79
+ const px = r() * W, py = r() * H_, a = r() * TAU, l = r.range(4, 18);
80
+ x.strokeStyle = `rgba(120,80,40,${r.range(0.03, 0.1)})`; x.lineWidth = r.range(0.5, 1.2);
81
+ x.beginPath(); x.moveTo(px, py); x.quadraticCurveTo(px + Math.cos(a + 0.5) * l * 0.6, py + Math.sin(a + 0.5) * l * 0.6, px + Math.cos(a) * l, py + Math.sin(a) * l); x.stroke();
82
+ }
83
+ const id = x.getImageData(0, 0, W, H_), dd = id.data, rg = H.rng(9);
84
+ for (let i = 0; i < dd.length; i += 4) { const n = (rg() - 0.5) * 16; dd[i] += n; dd[i + 1] += n; dd[i + 2] += n; }
85
+ x.putImageData(id, 0, 0);
86
+ cache.paper = c;
87
+ cache.specks = [0, 1, 2].map((k) => {
88
+ const sc = H.layer(W, H_), s2 = sc.getContext('2d'), rr = H.rng(100 + k);
89
+ for (let i = 0; i < 2600; i++) { s2.fillStyle = `rgba(255,248,232,${rr.range(0.25, 0.75)})`; s2.beginPath(); s2.ellipse(rr() * W, rr() * H_, rr.range(0.4, 1.5), rr.range(0.4, 1.1), rr() * 3, 0, TAU); s2.fill(); }
90
+ for (let i = 0; i < 26; i++) { // larger worn-ink dropouts
91
+ const px = rr() * W, py = rr() * H_; s2.fillStyle = `rgba(255,248,232,${rr.range(0.12, 0.3)})`;
92
+ for (let j = 0; j < 14; j++) { s2.beginPath(); s2.arc(px + rr.gauss() * 6, py + rr.gauss() * 4, rr.range(0.6, 2), 0, TAU); s2.fill(); }
93
+ }
94
+ return sc;
95
+ });
96
+ }
97
+ function finish(ctx, W, H_, t) {
98
+ finishTex(W, H_);
99
+ ctx.save();
100
+ ctx.globalCompositeOperation = 'multiply'; ctx.drawImage(cache.paper, 0, 0);
101
+ ctx.globalCompositeOperation = 'source-over'; ctx.globalAlpha = 0.5; ctx.drawImage(cache.specks[Math.floor(t * 8) % 3], 0, 0);
102
+ ctx.restore();
103
+ H.vignette(ctx, W, H_, 0.3, '60,10,40');
104
+ }
105
+
106
+ // ---------- lettering: rendered offscreen, then warped in slices ----------
107
+ function txt(str, size, o) {
108
+ const key = str + '|' + size + '|' + JSON.stringify(o);
109
+ let tc = cache.text.get(key); if (tc) return tc;
110
+ if (cache.text.size > 220) cache.text.clear();
111
+ const fam = o.font || 'Shrikhand', font = `400 ${size}px "${fam}"`;
112
+ const m = H.layer(8, 8).getContext('2d'); m.font = font;
113
+ const tw = m.measureText(str).width;
114
+ const lw = o.lw || 0, ow = o.ow || 0, sh = o.shadow;
115
+ const pad = Math.ceil(lw + ow + (sh ? Math.max(Math.abs(sh.dx), Math.abs(sh.dy)) : 0) + size * 0.12) + 4;
116
+ const w = Math.ceil(tw + pad * 2), h = Math.ceil(size * 1.42 + pad * 2);
117
+ const c = H.layer(w, h), x = c.getContext('2d');
118
+ const X = w / 2, Y = h / 2 + size * (fam === 'Shrikhand' ? 0.02 : 0.04);
119
+ const setup = (g) => { g.font = font; g.textAlign = 'center'; g.textBaseline = 'middle'; g.lineJoin = 'round'; g.miterLimit = 2; };
120
+ setup(x);
121
+ if (sh) { x.save(); x.translate(sh.dx, sh.dy); x.fillStyle = x.strokeStyle = sh.col; x.lineWidth = (lw + ow) * 2; if (lw + ow) x.strokeText(str, X, Y); x.fillText(str, X, Y); x.restore(); }
122
+ if (o.outer) { x.strokeStyle = o.outer; x.lineWidth = (lw + ow) * 2; x.strokeText(str, X, Y); }
123
+ if (lw) { x.strokeStyle = o.line || C.ink; x.lineWidth = lw * 2; x.strokeText(str, X, Y); }
124
+ const f = H.layer(w, h), fx = f.getContext('2d'); setup(fx);
125
+ let fill = o.fill || C.yellow;
126
+ if (o.grad) { const g = fx.createLinearGradient(0, Y - size * 0.42, 0, Y + size * 0.42); o.grad.forEach((cc, i) => g.addColorStop(i / (o.grad.length - 1), cc)); fill = g; }
127
+ fx.fillStyle = fill; fx.fillText(str, X, Y);
128
+ if (o.inline) {
129
+ fx.globalCompositeOperation = 'source-atop';
130
+ fx.strokeStyle = o.inline; fx.lineWidth = (o.ins + o.iw) * 2; fx.strokeText(str, X, Y);
131
+ fx.strokeStyle = fill; fx.lineWidth = o.ins * 2; fx.strokeText(str, X, Y);
132
+ }
133
+ x.drawImage(f, 0, 0);
134
+ tc = { c, w, h, tw, size };
135
+ cache.text.set(key, tc);
136
+ return tc;
137
+ }
138
+ // draw text canvas centred at (x,y), columns displaced by a travelling sine; bulge swells the middle; melt drips
139
+ function wavy(ctx, tc, x, y, o = {}) {
140
+ const sc = o.scale == null ? 1 : o.scale, amp = o.amp == null ? 4 : o.amp, fr = o.freq == null ? 0.02 : o.freq, ph = o.ph || 0;
141
+ const bulge = o.bulge || 0, sw = o.sw || 3, melt = o.melt || 0, alpha = o.alpha == null ? 1 : o.alpha;
142
+ if (alpha <= 0.002 || sc <= 0.002) return;
143
+ const x0 = x - (tc.w * sc) / 2;
144
+ ctx.save(); ctx.globalAlpha *= alpha;
145
+ for (let sx = 0; sx < tc.w; sx += sw) {
146
+ const s = Math.min(sw, tc.w - sx), u = (sx + s / 2) / tc.w;
147
+ const dy = amp * Math.sin(sx * fr + ph);
148
+ const sy = 1 + bulge * Math.sin(Math.PI * u);
149
+ const hh = tc.h * sc * sy;
150
+ const drip = melt > 0 ? melt * tc.h * sc * (0.25 + 0.75 * Math.pow(0.5 + 0.5 * Math.sin(sx * 0.043 + 1.3) * Math.sin(sx * 0.0171 + 0.4), 2)) : 0;
151
+ ctx.drawImage(tc.c, sx, 0, s, tc.h, x0 + sx * sc, y - hh / 2 + dy - drip * 0.35, s * sc + 0.7, hh + drip);
152
+ }
153
+ ctx.restore();
154
+ }
155
+
156
+ // ---------- shapes ----------
157
+ function blob(x, cx, cy, rx, ry, amp, lobes, ph, n = 90) {
158
+ x.beginPath();
159
+ for (let i = 0; i <= n; i++) { const a = (i / n) * TAU, r = 1 + amp * Math.sin(a * lobes + ph); x.lineTo(cx + Math.cos(a) * rx * r, cy + Math.sin(a) * ry * r); }
160
+ x.closePath();
161
+ }
162
+ // fill with a slightly mis-registered colour plate, then the ink key line on top
163
+ function inkFill(x, fill, lw, off = [2.5, 2]) {
164
+ x.save(); x.translate(off[0], off[1]); x.fillStyle = fill; x.fill(); x.restore();
165
+ x.fillStyle = fill; x.fill();
166
+ if (lw) { x.lineWidth = lw; x.strokeStyle = C.ink; x.lineJoin = 'round'; x.stroke(); }
167
+ }
168
+ function petalP(inner, len, wid) {
169
+ const p = new Path2D();
170
+ p.moveTo(inner, 0);
171
+ p.bezierCurveTo(inner + len * 0.15, -wid, inner + len * 0.68, -wid * 1.15, inner + len * 0.95, -wid * 0.5);
172
+ p.quadraticCurveTo(inner + len * 1.05, 0, inner + len * 0.95, wid * 0.5);
173
+ p.bezierCurveTo(inner + len * 0.68, wid * 1.15, inner + len * 0.15, wid, inner, 0);
174
+ p.closePath();
175
+ return p;
176
+ }
177
+ function pathInk(x, p, fill, lw, off) {
178
+ if (off) { x.save(); x.translate(off[0], off[1]); x.fillStyle = fill; x.fill(p); x.restore(); }
179
+ x.fillStyle = fill; x.fill(p);
180
+ if (lw) { x.lineWidth = lw; x.strokeStyle = C.ink; x.lineJoin = 'round'; x.stroke(p); }
181
+ }
182
+ function sunburst(x, R, t, o) {
183
+ const N = o.n || 32, lit = o.lit == null ? 1 : o.lit, sp = o.spin == null ? 0.05 : o.spin;
184
+ // flame-tongue rays: long and short alternate, tips curl slowly
185
+ for (let pass = 0; pass < 2; pass++) for (let i = pass; i < N; i += 2) {
186
+ const a = ((i + 0.5) / N) * TAU - t * sp - Math.PI / 2, hw = (Math.PI / N) * (pass ? 1.5 : 1.9);
187
+ const on = i / N < lit - 1e-6;
188
+ const len = R * (pass ? 0.8 : 1) * (on ? 1 : 0.86), r0 = R * 0.4, curl = 0.1 * Math.sin(t * 2.2 + i * 1.7);
189
+ const P = (aa, rr) => [Math.cos(aa) * rr, Math.sin(aa) * rr];
190
+ const b0 = P(a - hw, r0), c0 = P(a - hw * 0.7 + curl * 0.5, len * 0.72), tip = P(a + curl, len), c1 = P(a + hw * 0.7 + curl * 0.5, len * 0.72), b1 = P(a + hw, r0);
191
+ x.beginPath(); x.moveTo(b0[0], b0[1]); x.quadraticCurveTo(c0[0], c0[1], tip[0], tip[1]); x.quadraticCurveTo(c1[0], c1[1], b1[0], b1[1]); x.closePath();
192
+ x.fillStyle = on ? (pass ? o.c1 : o.c2) : (pass ? '#4a1a63' : '#35104a'); x.fill();
193
+ x.lineWidth = 3.5; x.strokeStyle = C.ink; x.stroke();
194
+ }
195
+ }
196
+ const PAL = { r1: C.yellow, r2: C.mag, p1: C.purple, p2: C.acid, q1: C.orange, q2: C.blue, ring: C.cream, iris: [C.blue, C.acid, C.orange] };
197
+ // the eye-flower: petals are its weights, the eye is what it sees
198
+ function model(x, cx, cy, R, t, s = {}) {
199
+ const P = Object.assign({}, PAL, s.pal || {}), open = s.open == null ? 1 : s.open;
200
+ if (open <= 0 && !(s.rays > 0)) return;
201
+ const rot = (s.rot || 0) + t * 0.06, jit = s.jit || 0, jr = H.rng(900 + Math.floor(t * 15));
202
+ x.save(); x.translate(cx, cy);
203
+ if (s.rays > 0) sunburst(x, R * (s.rayLen || 1.6) * s.rays, t, { c1: P.r1, c2: P.r2, lit: s.lit, n: s.rayN || 32 });
204
+ const N = 12;
205
+ for (let i = 0; i < N; i++) { // outer petals
206
+ const op = E.back(cl(open * 1.6 - (i / N) * 0.6)); if (op <= 0) continue;
207
+ const w = s.wts ? s.wts[i] : 1, a = (i / N) * TAU + rot + (jit ? jr.range(-0.12, 0.12) * jit : 0);
208
+ const len = R * (0.5 + 0.48 * w) * op, wid = R * 0.21 * Math.min(1, op);
209
+ x.save(); x.rotate(a);
210
+ pathInk(x, petalP(R * 0.3, len, wid), i % 2 ? P.p1 : P.p2, 5, [3, -2]);
211
+ pathInk(x, petalP(R * 0.38, len * 0.72, wid * 0.5), i % 2 ? P.p2 : P.p1, 3);
212
+ x.beginPath(); x.arc(R * 0.3 + len * 0.86, 0, Math.max(0.1, wid * 0.2), 0, TAU); inkFill(x, P.ring, 2.5, [0, 0]);
213
+ x.restore();
214
+ }
215
+ for (let i = 0; i < N; i++) { // inner petals
216
+ const op = E.back(cl(open * 1.6 - 0.3 - (i / N) * 0.4)); if (op <= 0) continue;
217
+ const a = ((i + 0.5) / N) * TAU + rot * 0.6;
218
+ x.save(); x.rotate(a);
219
+ pathInk(x, petalP(R * 0.25, R * 0.4 * op, R * 0.12 * Math.min(1, op)), i % 2 ? P.q1 : P.q2, 4, [2, 2]);
220
+ x.restore();
221
+ }
222
+ if (s.noEye) { x.restore(); return; }
223
+ const eo = E.back(cl(open * 1.4 - 0.25));
224
+ if (eo * R > 12) {
225
+ blob(x, 0, 0, R * 0.5 * eo, R * 0.5 * eo, 0.05, 16, t * 0.5); inkFill(x, P.ring, 5);
226
+ for (let i = 0; i < 16; i++) { const a = (i / 16) * TAU + t * 0.1; x.beginPath(); x.arc(Math.cos(a) * R * 0.465 * eo, Math.sin(a) * R * 0.465 * eo, R * 0.022, 0, TAU); x.fillStyle = C.mag; x.fill(); }
227
+ const er = R * 0.4 * eo;
228
+ x.beginPath(); x.arc(0, 0, er, 0, TAU); inkFill(x, C.white, 5, [0, 0]);
229
+ x.save(); x.beginPath(); x.arc(0, 0, er - 2, 0, TAU); x.clip();
230
+ const vr = H.rng(31); x.strokeStyle = 'rgba(236,28,36,0.75)'; x.lineCap = 'round';
231
+ for (let i = 0; i < 9; i++) { // veins
232
+ const a = vr() * TAU; let px = Math.cos(a) * er, py = Math.sin(a) * er; x.lineWidth = vr.range(1.2, 2.4); x.beginPath(); x.moveTo(px, py);
233
+ for (let k = 0; k < 5; k++) { const aa = a + vr.range(-0.5, 0.5), rr = er * (1 - (k + 1) * 0.08); px = Math.cos(aa) * rr; py = Math.sin(aa) * rr; x.lineTo(px, py); }
234
+ x.stroke();
235
+ }
236
+ const lk = s.look || [0, 0], ir = er * 0.64, lx = lk[0] * er * 0.28, ly = lk[1] * er * 0.28;
237
+ x.translate(lx, ly);
238
+ const iris = P.iris;
239
+ x.beginPath(); x.arc(0, 0, ir, 0, TAU); x.fillStyle = iris[0]; x.fill();
240
+ x.beginPath(); x.arc(0, 0, ir * 0.78, 0, TAU); x.fillStyle = iris[1]; x.fill();
241
+ x.beginPath(); x.arc(0, 0, ir * 0.58, 0, TAU); x.fillStyle = iris[2]; x.fill();
242
+ x.strokeStyle = 'rgba(34,7,43,0.55)'; x.lineWidth = 2;
243
+ for (let i = 0; i < 20; i++) { const a = (i / 20) * TAU + t * 0.3; x.beginPath(); x.moveTo(Math.cos(a) * ir * 0.45, Math.sin(a) * ir * 0.45); x.lineTo(Math.cos(a + 0.12) * ir * 0.95, Math.sin(a + 0.12) * ir * 0.95); x.stroke(); }
244
+ x.beginPath(); x.arc(0, 0, ir, 0, TAU); x.lineWidth = 4; x.strokeStyle = C.ink; x.stroke();
245
+ const pr = ir * 0.4 * (s.pupil || 1);
246
+ x.beginPath(); x.arc(0, 0, pr, 0, TAU); x.fillStyle = C.ink; x.fill();
247
+ x.fillStyle = C.white; x.beginPath(); x.ellipse(-ir * 0.32, -ir * 0.36, ir * 0.17, ir * 0.12, -0.6, 0, TAU); x.fill();
248
+ x.beginPath(); x.arc(ir * 0.22, ir * 0.2, ir * 0.06, 0, TAU); x.fill();
249
+ x.restore();
250
+ x.beginPath(); x.arc(0, 0, er, 0, TAU); x.lineWidth = 5; x.strokeStyle = C.ink; x.stroke();
251
+ }
252
+ x.restore();
253
+ }
254
+ function daisy(x, cx, cy, r, t, sc) {
255
+ if (sc <= 0) return;
256
+ x.save(); x.translate(cx, cy); x.scale(sc, sc); x.rotate(t * 0.4);
257
+ for (let i = 0; i < 8; i++) { x.save(); x.rotate((i / 8) * TAU); pathInk(x, petalP(r * 0.2, r * 0.85, r * 0.3), C.white, 3.5); x.restore(); }
258
+ x.beginPath(); x.arc(0, 0, r * 0.32, 0, TAU); inkFill(x, C.yellow, 3.5, [0, 0]);
259
+ x.beginPath(); x.arc(0, 0, r * 0.14, 0, TAU); x.fillStyle = C.orange; x.fill();
260
+ x.restore();
261
+ }
262
+ function catFace(x, r) {
263
+ const s = r * 0.66;
264
+ for (const g of [-1, 1]) {
265
+ x.beginPath(); x.moveTo(g * s * 0.78, -s * 0.2); x.lineTo(g * s * 0.86, -s * 1.02); x.lineTo(g * s * 0.18, -s * 0.62); x.closePath(); inkFill(x, C.orange, 4, [0, 0]);
266
+ x.beginPath(); x.moveTo(g * s * 0.7, -s * 0.38); x.lineTo(g * s * 0.76, -s * 0.85); x.lineTo(g * s * 0.36, -s * 0.6); x.closePath(); x.fillStyle = C.pink; x.fill();
267
+ }
268
+ x.beginPath(); x.ellipse(0, 0, s * 0.9, s * 0.74, 0, 0, TAU); inkFill(x, C.orange, 4, [0, 0]);
269
+ x.strokeStyle = C.mag; x.lineWidth = s * 0.07; x.lineCap = 'round';
270
+ for (const g of [-1, 0, 1]) { x.beginPath(); x.moveTo(g * s * 0.2, -s * 0.66); x.quadraticCurveTo(g * s * 0.26, -s * 0.5, g * s * 0.18, -s * 0.36); x.stroke(); }
271
+ for (const g of [-1, 1]) {
272
+ x.beginPath(); x.ellipse(g * s * 0.36, -s * 0.08, s * 0.22, s * 0.15, 0, 0, TAU); inkFill(x, C.acid, 3, [0, 0]);
273
+ x.beginPath(); x.ellipse(g * s * 0.36, -s * 0.08, s * 0.05, s * 0.13, 0, 0, TAU); x.fillStyle = C.ink; x.fill();
274
+ }
275
+ x.beginPath(); x.moveTo(-s * 0.1, s * 0.16); x.lineTo(s * 0.1, s * 0.16); x.lineTo(0, s * 0.28); x.closePath(); inkFill(x, C.mag, 2.5, [0, 0]);
276
+ x.strokeStyle = C.ink; x.lineWidth = 3;
277
+ x.beginPath(); x.moveTo(-s * 0.2, s * 0.36); x.quadraticCurveTo(-s * 0.1, s * 0.46, 0, s * 0.3); x.quadraticCurveTo(s * 0.1, s * 0.46, s * 0.2, s * 0.36); x.stroke();
278
+ x.lineWidth = 2.5;
279
+ for (const g of [-1, 1]) for (let k = -1; k <= 1; k++) { x.beginPath(); x.moveTo(g * s * 0.4, s * 0.26 + k * s * 0.09); x.quadraticCurveTo(g * s * 0.8, s * 0.2 + k * s * 0.14, g * s * 1.08, s * 0.16 + k * s * 0.2); x.stroke(); }
280
+ }
281
+ function dogFace(x, r) {
282
+ const s = r * 0.66;
283
+ for (const g of [-1, 1]) { x.save(); x.translate(g * s * 0.78, -s * 0.2); x.rotate(g * 0.35); x.beginPath(); x.ellipse(0, s * 0.18, s * 0.28, s * 0.6, 0, 0, TAU); inkFill(x, C.purple, 4, [0, 0]); x.restore(); }
284
+ x.beginPath(); x.ellipse(0, 0, s * 0.74, s * 0.78, 0, 0, TAU); inkFill(x, C.yellow, 4, [0, 0]);
285
+ x.beginPath(); x.ellipse(s * 0.32, -s * 0.16, s * 0.24, s * 0.22, 0.3, 0, TAU); x.fillStyle = C.orange; x.fill();
286
+ for (const g of [-1, 1]) {
287
+ x.beginPath(); x.arc(g * s * 0.3, -s * 0.14, s * 0.1, 0, TAU); x.fillStyle = C.ink; x.fill();
288
+ x.beginPath(); x.arc(g * s * 0.3 - s * 0.03, -s * 0.18, s * 0.035, 0, TAU); x.fillStyle = C.white; x.fill();
289
+ }
290
+ x.beginPath(); x.ellipse(0, s * 0.3, s * 0.42, s * 0.3, 0, 0, TAU); inkFill(x, C.cream, 3, [0, 0]);
291
+ x.beginPath(); x.moveTo(-s * 0.06, s * 0.42); x.quadraticCurveTo(0, s * 0.82, s * 0.12, s * 0.46); x.closePath(); inkFill(x, C.mag, 2.5, [0, 0]);
292
+ x.beginPath(); x.ellipse(0, s * 0.2, s * 0.16, s * 0.1, 0, 0, TAU); x.fillStyle = C.ink; x.fill();
293
+ x.strokeStyle = C.ink; x.lineWidth = 3; x.beginPath(); x.moveTo(0, s * 0.28); x.lineTo(0, s * 0.4); x.moveTo(-s * 0.18, s * 0.42); x.quadraticCurveTo(0, s * 0.52, s * 0.18, s * 0.42); x.stroke();
294
+ }
295
+ function medallion(x, cx, cy, r, kind, t, o = {}) {
296
+ const sc = o.sc == null ? 1 : o.sc; if (sc <= 0.01) return;
297
+ x.save(); x.translate(cx, cy); x.rotate(o.rot || 0); x.scale(sc, sc);
298
+ blob(x, 0, 0, r, r, 0.07, 12, t * 1.4); inkFill(x, o.ring || (kind === 'cat' ? C.acid : C.orange), 5);
299
+ x.save(); x.beginPath(); x.arc(0, 0, r * 0.8, 0, TAU); x.clip();
300
+ const bg = kind === 'cat' ? [C.blue, C.purple] : [C.purple, C.mag];
301
+ for (let k = 7; k >= 1; k--) { blob(x, 0, 0, r * 0.8 * k / 6.2, r * 0.8 * k / 6.2, 0.05, 6, t * 2 + k); x.fillStyle = bg[k % 2]; x.fill(); }
302
+ x.translate(0, r * 0.08);
303
+ if (kind === 'cat') catFace(x, r); else dogFace(x, r);
304
+ x.restore();
305
+ x.beginPath(); x.arc(0, 0, r * 0.8, 0, TAU); x.lineWidth = 4.5; x.strokeStyle = C.ink; x.stroke();
306
+ x.restore();
307
+ }
308
+ function pill(x, cx, cy, label, t, o = {}) {
309
+ const sc = o.sc == null ? 1 : o.sc; if (sc <= 0.01) return;
310
+ // story label chip: always solid cream with a dark key line; an active/accent chip gets a coloured ink band around it
311
+ const size = Math.max(30, o.size || 30), tc = txt(label, size, { font: 'Righteous', fill: o.tcol || C.ink });
312
+ const w = tc.tw + size * 1.0, h = size * 1.6, acc = o.fill && o.fill !== C.cream ? o.fill : null;
313
+ x.save(); x.translate(cx, cy); x.rotate(o.rot || 0); x.scale(sc, sc);
314
+ x.beginPath(); x.roundRect(-w / 2, -h / 2, w, h, h / 2);
315
+ x.save(); x.translate(5, 5); x.fillStyle = o.shadow || C.mag; x.fill(); x.restore();
316
+ if (acc) { x.lineWidth = 19; x.strokeStyle = C.ink; x.stroke(); x.lineWidth = 12; x.strokeStyle = acc; x.stroke(); }
317
+ x.fillStyle = C.cream; x.fill(); x.lineWidth = 5; x.strokeStyle = C.ink; x.stroke();
318
+ wavy(x, tc, 0, 1, { amp: 1.0, freq: 0.05, ph: t * 3 });
319
+ x.restore();
320
+ }
321
+ function wArrow(x, pt, prog, t, o = {}) {
322
+ if (prog <= 0.001) return;
323
+ const n = 56, w = o.w || 12, wob = o.wob == null ? 6 : o.wob, waves = o.waves || 3, pts = [];
324
+ for (let i = 0; i <= n; i++) {
325
+ const u = (i / n) * prog, a = pt(Math.max(0, u - 0.005)), b = pt(Math.min(1, u + 0.005)), p = pt(u);
326
+ let tx = b[0] - a[0], ty = b[1] - a[1]; const tl = Math.hypot(tx, ty) || 1; tx /= tl; ty /= tl;
327
+ const wv = wob * Math.sin(u * TAU * waves - t * 7) * Math.sin(Math.PI * Math.min(1, u / Math.max(prog, 0.3)));
328
+ pts.push([p[0] - ty * wv, p[1] + tx * wv]);
329
+ }
330
+ x.save(); x.lineCap = 'round'; x.lineJoin = 'round';
331
+ const line = (lw, col) => { x.beginPath(); pts.forEach((p, i) => (i ? x.lineTo(p[0], p[1]) : x.moveTo(p[0], p[1]))); x.lineWidth = lw; x.strokeStyle = col; x.stroke(); };
332
+ line(w + 9, C.ink); line(w, o.col || C.yellow);
333
+ if (o.core) line(w * 0.3, o.core);
334
+ if (prog > 0.12) {
335
+ const e = pts[n], f = pts[n - 4], a = Math.atan2(e[1] - f[1], e[0] - f[0]), hs = w * 1.9;
336
+ x.translate(e[0], e[1]); x.rotate(a);
337
+ x.beginPath(); x.moveTo(hs * 0.9, 0); x.quadraticCurveTo(-hs * 0.1, -hs * 0.2, -hs * 0.5, -hs * 0.95); x.quadraticCurveTo(-hs * 0.25, 0, -hs * 0.5, hs * 0.95); x.quadraticCurveTo(-hs * 0.1, hs * 0.2, hs * 0.9, 0); x.closePath();
338
+ inkFill(x, o.col || C.yellow, 4.5, [0, 0]);
339
+ }
340
+ x.restore();
341
+ }
342
+ function crossMark(x, cx, cy, s, sc) {
343
+ if (sc <= 0) return;
344
+ x.save(); x.translate(cx, cy); x.scale(sc, sc); x.rotate(-0.08); x.lineCap = 'round';
345
+ const st = (lw, c) => { x.lineWidth = lw; x.strokeStyle = c; x.beginPath(); x.moveTo(-s, -s); x.quadraticCurveTo(0, -s * 0.1, s, s); x.moveTo(s, -s); x.quadraticCurveTo(s * 0.1, 0, -s, s); x.stroke(); };
346
+ st(s * 0.55 + 10, C.ink); st(s * 0.55, C.red); x.restore();
347
+ }
348
+ function checkMark(x, cx, cy, s, sc) {
349
+ if (sc <= 0) return;
350
+ x.save(); x.translate(cx, cy); x.scale(sc, sc); x.lineCap = 'round'; x.lineJoin = 'round';
351
+ const st = (lw, c) => { x.lineWidth = lw; x.strokeStyle = c; x.beginPath(); x.moveTo(-s, -s * 0.05); x.quadraticCurveTo(-s * 0.6, s * 0.3, -s * 0.3, s * 0.7); x.quadraticCurveTo(s * 0.2, -s * 0.3, s * 1.05, -s * 0.85); x.stroke(); };
352
+ st(s * 0.5 + 10, C.ink); st(s * 0.5, C.acid); x.restore();
353
+ }
354
+ function bubble(x, cx, cy, rx, ry, tail, t, sc, fill) {
355
+ if (sc <= 0.01) return;
356
+ x.save(); x.translate(cx, cy); x.scale(sc, sc);
357
+ x.beginPath(); x.moveTo(-rx * 0.62, ry * 0.3); x.quadraticCurveTo(-rx * 0.8, ry * 0.75, tail[0], tail[1]); x.quadraticCurveTo(-rx * 0.5, ry * 0.95, -rx * 0.12, ry * 0.8); x.closePath(); inkFill(x, fill || C.cream, 5, [4, 4]);
358
+ blob(x, 0, 0, rx, ry, 0.045, 7, t * 2); inkFill(x, fill || C.cream, 5, [4, 4]);
359
+ x.restore();
360
+ }
361
+ function banner(x, cx, cy, wHalf, h, prog, col) {
362
+ if (prog <= 0) return;
363
+ const wh = wHalf * E.out(prog);
364
+ x.save(); x.translate(cx, cy);
365
+ for (const g of [-1, 1]) { // folded tails
366
+ x.beginPath(); x.moveTo(g * (wh - 10), -h * 0.2); x.lineTo(g * (wh + 70), -h * 0.2); x.lineTo(g * (wh + 44), h * 0.4); x.lineTo(g * (wh + 70), h * 1.0); x.lineTo(g * (wh - 10), h * 1.0); x.closePath(); inkFill(x, col, 4, [3, 3]);
367
+ }
368
+ x.beginPath(); x.moveTo(-wh, -h / 2);
369
+ for (let i = 0; i <= 20; i++) { const u = i / 20; x.lineTo(-wh + 2 * wh * u, -h / 2 + Math.sin(u * Math.PI * 2) * 8); }
370
+ for (let i = 20; i >= 0; i--) { const u = i / 20; x.lineTo(-wh + 2 * wh * u, h / 2 + Math.sin(u * Math.PI * 2) * 8); }
371
+ x.closePath(); inkFill(x, C.cream, 4.5, [3, 3]);
372
+ x.restore();
373
+ }
374
+
375
+ // ---------- the poster (still + clip) ----------
376
+ function poster(ctx, W, H_, t) {
377
+ ctx.fillStyle = C.cream; ctx.fillRect(0, 0, W, H_);
378
+ const CX = 640, CY = 430;
379
+ const rr = E.out(seg(t, 0, 1.5)) * 1450;
380
+ if (rr > 2) {
381
+ ctx.save(); blob(ctx, CX, CY, rr, rr, 0.035, 7, t * 3); ctx.clip();
382
+ liquid(ctx, W, H_, t, { cx: CX, cy: CY, cols: [C.mag, C.acid], line: C.purple, lineW: 0.16, freq: 8.5, speed: 0.55, warp: 0.24 });
383
+ ctx.restore();
384
+ if (rr < 1440) { blob(ctx, CX, CY, rr, rr, 0.035, 7, t * 3); ctx.lineWidth = 16; ctx.strokeStyle = C.ink; ctx.stroke(); ctx.lineWidth = 8; ctx.strokeStyle = C.orange; ctx.stroke(); }
385
+ }
386
+ model(ctx, CX, CY, 182, t, { open: seg(t, 0.8, 2.5), rays: E.out(seg(t, 0.5, 1.7)), rayLen: 1.75, look: [Math.sin(t * 0.9) * 0.5, Math.cos(t * 0.7) * 0.25 + 0.15], pupil: 1 + 0.08 * Math.sin(t * 2.3),
387
+ pal: { r1: C.orange, r2: C.blue } });
388
+ [[86, 600, 62], [1194, 600, 62], [80, 92, 46], [1200, 92, 46]].forEach(([x, y, r], i) => daisy(ctx, x, y, r, t + i, E.back(seg(t, 1.7 + i * 0.12, 2.2 + i * 0.12))));
389
+ // title
390
+ const tc = txt('Electric Mind', 138, { grad: [C.yellow, C.yellow, C.orange], line: C.ink, lw: 8, outer: C.cream, ow: 6, shadow: { dx: 8, dy: 8, col: C.blue }, inline: C.mag, ins: 6, iw: 3 });
391
+ const tm = seg(t, 2.0, 3.3), melt = 1 - E.out(tm);
392
+ wavy(ctx, tc, 640, 120, { amp: 7 + 30 * melt, freq: 0.011, ph: t * 2.4, bulge: 0.32, melt: melt * 0.9, alpha: E.out(seg(t, 2.0, 2.5)), sw: 3 });
393
+ // bottom banner
394
+ const bp = seg(t, 3.0, 3.6);
395
+ banner(ctx, 640, 668, 230, 58, bp, C.mag);
396
+ if (bp > 0.6) { const tb = txt('dreaming in color', 34, { font: 'Righteous', fill: C.ink }); wavy(ctx, tb, 640, 668, { amp: 2.5, freq: 0.03, ph: t * 3, alpha: seg(bp, 0.6, 1) }); }
397
+ finish(ctx, W, H_, t);
398
+ }
399
+
400
+ // ---------- explainer scenes ----------
401
+ const TR1 = [5.85, 6.55], TR2 = [10.25, 10.95], TR3 = [12.85, 13.35];
402
+ const RIB = [
403
+ (u) => bez([-60, 300], [260, 160], [520, 470], [820, 370], u),
404
+ (u) => bez([-60, 430], [260, 545], [540, 280], [820, 410], u),
405
+ ];
406
+ // example cards: spawn times accelerate; alternate ribbons (shared with the score)
407
+ const CARDS = (() => { const out = [], r = H.rng(44); for (let i = 0, ts = 3.0; ts < 5.45; i++) { out.push({ ts, kind: r() < 0.5 ? 'cat' : 'dog', rib: i % 2, ph: r() * 6 }); ts += Math.max(0.17, 0.42 - i * 0.03); } return out; })();
408
+ const CARD_T = 1.45;
409
+ const DRIPS = (() => { const r = H.rng(808), out = []; for (let x = 30; x < 1280; x += r.range(70, 170)) out.push([x, r.range(11, 24), r.range(40, 170)]); return out; })();
410
+ const titleTC = () => txt('How does AI learn?', 100, { grad: [C.yellow, C.yellow, C.orange], line: C.ink, lw: 7, outer: C.cream, ow: 5, shadow: { dx: 7, dy: 7, col: C.purple }, inline: C.mag, ins: 5, iw: 2.5 });
411
+ const W0 = [0.55, 1.1, 0.7, 0.95, 0.45, 1.2, 0.8, 0.5, 1.15, 0.65, 0.9, 0.6];
412
+ const W1 = [0.95, 0.9, 0.95, 0.9, 0.95, 0.9, 0.95, 0.9, 0.95, 0.9, 0.95, 0.9];
413
+
414
+ function ribbon(x, f, prog, t, cols) {
415
+ if (prog <= 0) return;
416
+ const pts = []; for (let i = 0; i <= 90; i++) pts.push(f((i / 90) * prog));
417
+ x.save(); x.lineCap = 'round'; x.lineJoin = 'round';
418
+ const line = (lw, col, dash) => { x.beginPath(); pts.forEach((p, i) => (i ? x.lineTo(p[0], p[1]) : x.moveTo(p[0], p[1]))); x.lineWidth = lw; x.strokeStyle = col; if (dash) { x.setLineDash(dash); x.lineDashOffset = -t * 160; } else x.setLineDash([]); x.stroke(); };
419
+ line(54, C.ink); line(44, cols[0]); line(28, C.ink); line(22, cols[1]); line(8, cols[2], [18, 22]);
420
+ x.restore();
421
+ }
422
+
423
+ function sceneA(x, W, H_, t) {
424
+ const fr = E.inOut(seg(t, 1.55, 2.9)) * 1500;
425
+ liquid(x, W, H_, t, { cx: 640, cy: 360, cols: [C.mag, C.acid], freq: 8, speed: 0.75, warp: 0.32,
426
+ flood: fr > 1 ? { cx: 950, cy: 380, r: fr, cols: [C.orange, C.blue], line: C.ink } : null, lineW: 0.1 });
427
+ if (fr > 1 && fr < 1490) { blob(x, 950, 380, fr, fr, 0.03, 9, t * 4); x.lineWidth = 18; x.strokeStyle = C.ink; x.stroke(); x.lineWidth = 9; x.strokeStyle = C.yellow; x.stroke(); }
428
+ const MX = 950, MY = 380, MR = 165;
429
+ // ribbons + cards (under the flower)
430
+ RIB.forEach((f, i) => ribbon(x, f, E.inOut(seg(t, 2.7 + i * 0.15, 3.3 + i * 0.15)), t, i ? [C.yellow, C.mag, C.cream] : [C.acid, C.purple, C.cream]));
431
+ let gulp = 0;
432
+ CARDS.forEach((c, i) => {
433
+ const u = (t - c.ts) / CARD_T; if (u < 0 || u > 1) { if (u > 1 && u < 1.3) gulp = Math.max(gulp, 1 - (u - 1) / 0.3); return; }
434
+ const [px, py] = RIB[c.rib](u * 0.97);
435
+ const sc = u < 0.1 ? E.back(u / 0.1) : u > 0.82 ? 1 - E.in((u - 0.82) / 0.18) : 1;
436
+ medallion(x, px, py, 75, c.kind, t + c.ph, { sc, rot: 0.18 * Math.sin(t * 3 + c.ph) });
437
+ pill(x, px + 40 * sc, py + 62 * sc, c.kind, t, { sc, size: 30, fill: c.kind === 'cat' ? C.cream : C.yellow });
438
+ });
439
+ const wts = W0.map((w, i) => w + 0.08 * Math.sin(t * 2 + i));
440
+ model(x, MX, MY, MR, t, { open: seg(t, 1.45, 2.7), rays: E.out(seg(t, 1.9, 2.8)), rayLen: 1.62, wts, pupil: 1 + 0.35 * gulp, look: [-0.7, 0.05 * Math.sin(t * 3)] });
441
+ pill(x, MX, 625 - 40 * (1 - E.out(seg(t, 2.9, 3.2))), 'Model', t, { sc: E.back(seg(t, 2.9, 3.2)), size: 30, fill: C.yellow, shadow: C.blue });
442
+ // headline
443
+ const hp = seg(t, 2.55, 3.15);
444
+ if (hp > 0) { const tc = txt('Training data', 60, { fill: C.yellow, line: C.ink, lw: 5, outer: C.cream, ow: 4, shadow: { dx: 5, dy: 5, col: C.mag } }); wavy(x, tc, 380, 136, { amp: 3 + 18 * (1 - E.out(hp)), freq: 0.02, ph: t * 3, bulge: 0.15, melt: (1 - E.out(hp)) * 0.6, alpha: E.out(seg(t, 2.55, 2.85)) }); }
445
+ // counter cartouche
446
+ const cp = seg(t, 2.85, 3.2);
447
+ if (cp > 0) {
448
+ x.save(); x.translate(345, 640); x.scale(E.back(cp), E.back(cp));
449
+ blob(x, 0, 0, 315, 64, 0.03, 5, t * 2); inkFill(x, C.cream, 5, [5, 5]);
450
+ x.restore();
451
+ const n = Math.round(1e6 * Math.pow(seg(t, 3.0, 5.5), 2.2));
452
+ const tc = txt(n.toLocaleString('en-US'), 70, { fill: C.mag, line: C.ink, lw: 4, shadow: { dx: 4, dy: 4, col: C.acid } });
453
+ const done = t >= 5.5 ? 1 + 0.18 * (1 - E.out(seg(t, 5.5, 5.8))) : 1;
454
+ wavy(x, tc, 52 + tc.w / 2 * 0.95, 634, { amp: 3, freq: 0.03, ph: t * 4, scale: 0.95 * done * E.out(cp), bulge: 0.1 });
455
+ const te = txt('examples', 32, { font: 'Righteous', fill: C.ink });
456
+ wavy(x, te, 568, 642, { amp: 2, freq: 0.04, ph: t * 3, alpha: E.out(cp) });
457
+ }
458
+ }
459
+
460
+ function sceneB(x, W, H_, t) {
461
+ const clash = t >= 7.8 && t < 9.55 ? 1 : 0, step = Math.floor(t * 15), jr = H.rng(500 + step);
462
+ const harm = E.inOut(seg(t, 9.55, 10.15));
463
+ const cols = clash ? (step % 2 ? [C.red, C.mag, C.acid] : [C.mag, C.orange, C.blue]) : harm > 0 ? [C.purple, C.yellow, C.purple, C.acid] : [C.purple, C.yellow];
464
+ liquid(x, W, H_, t, { cx: 640 + clash * jr.range(-40, 40), cy: 390, cols, line: C.ink, lineW: 0.1, freq: 8, speed: clash ? 2.5 : 0.6, warp: 0.3 + clash * 0.22, phase: clash * jr(), fold: harm, nfold: 10, foldRot: t * 0.25 });
465
+ x.save();
466
+ if (clash) x.translate(jr.range(-7, 7), jr.range(-5, 5));
467
+ const MX = 640, MY = 390, MR = 150;
468
+ // cat picture
469
+ medallion(x, 190, 395, 100, 'cat', t, { rot: 0.06 * Math.sin(t * 2) });
470
+ const flip = seg(t, 9.6, 9.8);
471
+ pill(x, 190, 535, t < 9.7 ? '?' : 'cat', t, { size: 30, sc: t < 9.6 ? 1 : Math.abs(Math.cos(flip * Math.PI)) * (t >= 9.7 ? 1.1 : 1), fill: t < 9.7 ? C.cream : C.acid });
472
+ // arrow picture -> model
473
+ wArrow(x, (u) => [300 + u * 160, 395], E.inOut(seg(t, 6.55, 6.95)), t, { w: 14, col: C.yellow, wob: 5, waves: 2 });
474
+ // model with weights (petals) that adjust
475
+ const adj = E.inOut(seg(t, 8.85, 9.5));
476
+ const wts = W0.map((w, i) => lerp(w, W1[i], adj) + (clash ? jr.range(-0.15, 0.15) : 0));
477
+ const pal = clash ? { p1: C.red, p2: C.orange, q1: C.mag, q2: C.acid, r1: C.red, r2: C.mag, iris: [C.red, C.acid, C.mag] } : harm > 0.5 ? { p1: C.mag, p2: C.acid, q1: C.blue, q2: C.orange } : { p1: C.mag, p2: C.acid };
478
+ model(x, MX, MY, MR, t, { rays: 1, rayLen: 1.5, wts, rot: adj * 0.55, jit: clash, pal: Object.assign({ r1: C.orange, r2: C.blue }, pal), pupil: clash ? 1.5 : 1, look: t < 7.0 ? [-0.8, 0] : [0.8, -0.4] });
479
+ // Guess arc
480
+ const g0 = 6.9, gp = E.inOut(seg(t, g0, 7.3));
481
+ wArrow(x, (u) => bez([745, 300], [790, 175], [880, 180], [925, 268], u), gp, t, { w: 13, col: C.acid, wob: 4, waves: 2 });
482
+ // bubble with the guess
483
+ const bs = E.back(seg(t, 7.3, 7.55)), BX = 1065, BY = 315;
484
+ const bflip = seg(t, 9.45, 9.65), bsx = t < 9.45 ? 1 : Math.abs(Math.cos(bflip * Math.PI));
485
+ if (bs > 0) {
486
+ x.save(); x.translate(BX, BY); x.scale(bsx, 1); x.translate(-BX, -BY);
487
+ bubble(x, BX, BY, 130, 92, [-168, 100], t, bs, t < 9.55 ? C.cream : C.yellow);
488
+ const word = t < 9.55 ? 'dog?' : 'cat';
489
+ const tc = txt(word, 66, { fill: t < 9.55 ? C.blue : C.mag, line: C.ink, lw: 4, shadow: { dx: 4, dy: 4, col: t < 9.55 ? C.orange : C.acid } });
490
+ wavy(x, tc, BX, BY - 2, { amp: clash ? 6 : 3, freq: 0.04, ph: t * (clash ? 14 : 4), scale: bs, bulge: 0.12 });
491
+ x.restore();
492
+ }
493
+ // Check: X + scribbled ring + clash
494
+ if (t >= 7.8 && t < 9.5) {
495
+ const rp = E.out(seg(t, 7.85, 8.25));
496
+ x.save(); x.lineCap = 'round';
497
+ const ring = (lw, col) => { x.beginPath(); for (let i = 0; i <= 80 * rp; i++) { const a = -2.2 + (i / 80) * TAU * 1.08, r = 1 + 0.05 * Math.sin(a * 5 + 1); x.lineTo(BX + Math.cos(a) * 172 * r, BY + 4 + Math.sin(a) * 128 * r); } x.lineWidth = lw; x.strokeStyle = col; x.stroke(); };
498
+ ring(15, C.ink); ring(8, C.red);
499
+ x.restore();
500
+ crossMark(x, BX + 135, BY - 98, 34, 1 + 0.8 * (1 - E.out(seg(t, 7.8, 7.95))));
501
+ }
502
+ if (t >= 9.55) checkMark(x, BX + 135, BY - 98, 36, E.back(seg(t, 9.55, 9.75)));
503
+ // Adjust: error ripple travels back to the model
504
+ const ap = E.inOut(seg(t, 8.35, 8.85));
505
+ const apath = (u) => bez([990, 425], [965, 650], [780, 670], [700, 545], u);
506
+ wArrow(x, apath, ap, t, { w: 13, col: t < 9.55 ? C.red : C.orange, wob: 7, waves: 4 });
507
+ if (t >= 8.35 && t < 9.0) { // pulse bead
508
+ const u = seg(t, 8.35, 8.85), [px, py] = apath(E.inOut(u)), pr = 16 + 6 * Math.sin(t * 30);
509
+ x.beginPath(); x.arc(px, py, pr, 0, TAU); inkFill(x, C.yellow, 4, [0, 0]);
510
+ }
511
+ // loop labels land as each phase starts; all glow once the loop closes
512
+ const done = t >= 9.6;
513
+ const actv = (a, b) => (done || (t >= a && t < b));
514
+ pill(x, 835, 152, 'Guess', t, { size: 30, sc: E.back(seg(t, 6.9, 7.15)) * (actv(6.9, 7.8) ? 1.08 : 1), fill: actv(6.9, 7.8) ? C.yellow : C.cream, shadow: C.blue });
515
+ pill(x, 1100, 470, 'Check', t, { size: 30, sc: E.back(seg(t, 7.8, 8.05)) * (actv(7.8, 8.6) ? 1.08 : 1), fill: actv(7.8, 8.6) ? C.acid : C.cream, shadow: C.blue });
516
+ pill(x, 905, 668, 'Adjust', t, { size: 30, sc: E.back(seg(t, 8.6, 8.85)) * (actv(8.6, 9.6) ? 1.08 : 1), fill: actv(8.6, 9.6) ? C.orange : C.cream, shadow: C.blue });
517
+ // weights label lands on the petals
518
+ const wp = seg(t, 8.9, 9.15);
519
+ if (wp > 0) {
520
+ x.save(); x.lineCap = 'round'; const ey = 290 * E.out(wp) + 215 * (1 - E.out(wp)); for (const [lw, col] of [[9, C.ink], [4, C.cream]]) { x.strokeStyle = col; x.lineWidth = lw; x.beginPath(); x.moveTo(450, 215); x.quadraticCurveTo(515, 235, 545, ey); x.stroke(); } x.beginPath(); x.arc(545, ey, 7, 0, TAU); inkFill(x, C.cream, 3, [0, 0]); x.restore();
521
+ pill(x, 420, 200, 'weights', t, { size: 30, sc: E.back(wp), fill: C.pink, shadow: C.blue });
522
+ }
523
+ x.restore();
524
+ }
525
+
526
+ function sceneC(x, W, H_, t) {
527
+ const c0 = 10.9, c1 = 12.3;
528
+ const prog = E.inOut(seg(t, c0, c1)), acc = Math.round(61 + 36 * prog);
529
+ const burst = t >= c1, bp = seg(t, c1, c1 + 0.6);
530
+ const GX = 400, GY = 410;
531
+ liquid(x, W, H_, t, { cx: GX, cy: GY, cols: burst ? [C.mag, C.orange, C.yellow, C.acid, C.blue, C.purple] : [C.mag, C.acid], line: C.ink, lineW: 0.1, freq: 8, speed: 0.9 + 2 * (1 - bp) * (burst ? 1 : 0), warp: 0.3, fold: burst ? E.out(bp) : 0, nfold: 12, foldRot: t * 0.3, spiral: burst ? 2 : 0 });
532
+ // gauge: sunburst rays light up with accuracy, a flower in bloom around the number
533
+ x.save(); x.translate(GX, GY);
534
+ sunburst(x, 255 * (1 + 0.5 * E.out(bp) * (1 - seg(t, c1 + 0.6, c1 + 1.0) * 0.6)), t, { c1: C.yellow, c2: C.orange, lit: burst ? 1 : 0.61 + 0.36 * prog, n: 36, spin: 0 });
535
+ x.restore();
536
+ model(x, GX, GY, 165, t, { noEye: true, pal: { p1: C.blue, p2: C.purple, q1: C.acid, q2: C.yellow }, wts: W1, rot: prog * 1.2 });
537
+ const pop = burst ? 1 + 0.3 * (1 - E.out(seg(t, c1, c1 + 0.45))) : 1;
538
+ x.save(); x.translate(GX, GY); x.scale(pop, pop);
539
+ blob(x, 0, 0, 122, 122, 0.04, 9, t * 2); inkFill(x, C.cream, 6, [5, 5]);
540
+ const tc = txt(acc + '%', 104, { grad: [C.mag, C.mag, C.purple], line: C.ink, lw: 5, shadow: { dx: 5, dy: 5, col: C.acid } });
541
+ wavy(x, tc, 0, 4, { amp: 3, freq: 0.03, ph: t * 4, bulge: 0.12, scale: 0.98 });
542
+ x.restore();
543
+ if (burst) { // emphasis: ring + sparks
544
+ x.save(); x.lineCap = 'round';
545
+ const rp = E.out(seg(t, c1, c1 + 0.3));
546
+ const ring = (lw, col) => { x.beginPath(); for (let i = 0; i <= 90 * rp; i++) { const a = -1.6 + (i / 90) * TAU * 1.02, r = 1 + 0.015 * Math.sin(a * 9); x.lineTo(GX + Math.cos(a) * (136 * pop + 10) * r, GY + Math.sin(a) * (136 * pop + 10) * r); } x.lineWidth = lw; x.strokeStyle = col; x.stroke(); };
547
+ ring(18, C.ink); ring(10, C.yellow);
548
+ const sp = E.out(seg(t, c1, c1 + 0.8));
549
+ for (let i = 0; i < 12; i++) {
550
+ const a = (i / 12) * TAU + 0.2, r = 190 + sp * 160, s = 18 * (1 - seg(t, c1 + 0.5, c1 + 1.0)) + 2;
551
+ x.save(); x.translate(GX + Math.cos(a) * r, GY + Math.sin(a) * r); x.rotate(t * 3 + i);
552
+ x.beginPath(); for (let k = 0; k < 8; k++) { const rr = k % 2 ? s * 0.3 : s; x.lineTo(Math.cos((k / 8) * TAU) * rr, Math.sin((k / 8) * TAU) * rr); } x.closePath(); inkFill(x, i % 2 ? C.white : C.yellow, 3, [0, 0]);
553
+ x.restore();
554
+ }
555
+ x.restore();
556
+ }
557
+ // headline
558
+ const hp = seg(t, 10.75, 11.25);
559
+ const th = txt('Accuracy', 62, { fill: C.yellow, line: C.ink, lw: 5, outer: C.cream, ow: 4, shadow: { dx: 5, dy: 5, col: C.blue } });
560
+ wavy(x, th, 640, 112, { amp: 3 + 16 * (1 - E.out(hp)), freq: 0.02, ph: t * 3, bulge: 0.2, melt: (1 - E.out(hp)) * 0.6, alpha: E.out(seg(t, 10.75, 11.0)) });
561
+ // chart panel
562
+ const pp = E.back(seg(t, 10.7, 11.05));
563
+ if (pp > 0) {
564
+ x.save(); x.translate(985, 395); x.scale(pp, pp); x.rotate(0.015);
565
+ x.beginPath(); x.roundRect(-250, -225, 500, 440, 40); inkFill(x, C.cream, 6, [7, 7]);
566
+ x.restore();
567
+ x.save(); x.globalAlpha = seg(t, 10.85, 11.0);
568
+ const ox = 790, oy = 530, cw = 400, ch = 300;
569
+ const val = (i) => 61 + 36 * (1 - Math.exp(-i / 3.2)) / (1 - Math.exp(-12 / 3.2)) + (i > 0 && i < 12 ? Math.sin(i * 2.3) * 1.6 : 0);
570
+ const P = (i) => [ox + (i / 12) * cw, oy - ((val(i) - 50) / 50) * ch];
571
+ x.lineCap = 'round'; x.lineJoin = 'round';
572
+ // area + line up to progress
573
+ const np = prog * 12, pts = [];
574
+ for (let i = 0; i <= Math.floor(np); i++) pts.push(P(i));
575
+ if (np % 1 > 0 && np < 12) { const a = P(Math.floor(np)), b = P(Math.ceil(np)), f = np % 1; pts.push([lerp(a[0], b[0], f), lerp(a[1], b[1], f)]); }
576
+ if (pts.length > 1) {
577
+ x.beginPath(); x.moveTo(pts[0][0], oy); pts.forEach((p) => x.lineTo(p[0], p[1])); x.lineTo(pts[pts.length - 1][0], oy); x.closePath();
578
+ const g = x.createLinearGradient(0, oy - ch, 0, oy); g.addColorStop(0, C.acid); g.addColorStop(1, C.yellow); x.fillStyle = g; x.fill();
579
+ // stripes inside the area
580
+ x.save(); x.clip(); x.strokeStyle = 'rgba(255,26,140,0.5)'; x.lineWidth = 6; for (let k = -10; k < 30; k++) { x.beginPath(); x.moveTo(ox + k * 26, oy); x.lineTo(ox + k * 26 + 200, oy - 300); x.stroke(); } x.restore();
581
+ x.beginPath(); pts.forEach((p, i) => (i ? x.lineTo(p[0], p[1]) : x.moveTo(p[0], p[1]))); x.lineWidth = 13; x.strokeStyle = C.ink; x.stroke(); x.lineWidth = 6; x.strokeStyle = C.mag; x.stroke();
582
+ const cc = [C.blue, C.orange, C.purple, C.yellow];
583
+ for (let i = 0; i <= Math.floor(np); i++) { const [px, py] = P(i); x.beginPath(); x.arc(px, py, 9, 0, TAU); inkFill(x, cc[i % 4], 3.5, [0, 0]); }
584
+ }
585
+ x.lineWidth = 5; x.strokeStyle = C.ink; x.beginPath(); x.moveTo(ox, oy - ch - 10); x.lineTo(ox, oy); x.lineTo(ox + cw + 10, oy); x.stroke();
586
+ const tl = txt('training rounds', 31, { font: 'Righteous', fill: C.ink });
587
+ wavy(x, tl, ox + cw / 2, oy + 36, { amp: 1.5, freq: 0.04, ph: t * 3 });
588
+ const t100 = txt('100%', 28, { font: 'Righteous', fill: C.ink }); wavy(x, t100, ox + 52, oy - ch - 2, { amp: 1, freq: 0.05, ph: t * 3 });
589
+ x.restore();
590
+ }
591
+ if (burst) { const fl = 1 - E.out(seg(t, c1, c1 + 0.35)); if (fl > 0) { x.fillStyle = `rgba(255,250,220,${0.42 * fl})`; x.fillRect(0, 0, W, H_); } }
592
+ }
593
+
594
+ function sceneD(x, W, H_, t) {
595
+ liquid(x, W, H_, t, { cx: 640, cy: 360, cols: [C.mag, C.orange, C.yellow, C.acid, C.blue, C.purple], line: C.ink, lineW: 0.1, fold: 1, nfold: 12, foldRot: t * 0.15, freq: 7, speed: 0.6, warp: 0.28 });
596
+ [[120, 590], [1160, 590]].forEach(([mx, my], i) => model(x, mx, my, 92, t, { open: seg(t, 13.25 + i * 0.1, 13.9 + i * 0.1), rays: E.out(seg(t, 13.3, 13.9)), rayLen: 1.5, look: [i ? -0.6 : 0.6, -0.3] }));
597
+ const cp = E.back(seg(t, 13.1, 13.4));
598
+ x.save(); x.translate(640, 360); x.scale(cp, cp);
599
+ blob(x, 0, 0, 520, 205, 0.025, 6, t * 1.5); inkFill(x, C.cream, 7, [8, 8]);
600
+ blob(x, 0, 0, 500, 187, 0.025, 6, t * 1.5); x.lineWidth = 3; x.strokeStyle = C.mag; x.stroke();
601
+ x.restore();
602
+ const l1 = txt('More examples', 78, { grad: [C.orange, C.mag], line: C.ink, lw: 5, shadow: { dx: 5, dy: 5, col: C.yellow } });
603
+ const l2 = txt('better guesses', 84, { grad: [C.blue, C.purple], line: C.ink, lw: 5, shadow: { dx: 5, dy: 5, col: C.acid } });
604
+ const total = l1.tw + 150, x0 = 640 - total / 2;
605
+ const p1 = seg(t, 13.25, 13.75), p2 = seg(t, 13.55, 14.05);
606
+ wavy(x, l1, x0 + l1.tw / 2, 298, { amp: 3 + 22 * (1 - E.out(p1)), freq: 0.016, ph: t * 3, bulge: 0.14, melt: (1 - E.out(p1)) * 0.7, alpha: E.out(seg(t, 13.25, 13.5)) });
607
+ wArrow(x, (u) => [x0 + l1.tw + 22 + u * 112, 300], E.inOut(seg(t, 13.5, 13.8)), t, { w: 14, col: C.acid, wob: 4, waves: 1.5 });
608
+ wavy(x, l2, 640, 428, { amp: 3 + 22 * (1 - E.out(p2)), freq: 0.016, ph: t * 3 + 1, bulge: 0.14, melt: (1 - E.out(p2)) * 0.7, alpha: E.out(seg(t, 13.55, 13.8)) });
609
+ }
610
+
611
+ // ---------- transitions ----------
612
+ function layers(W, H_) {
613
+ if (!cache.LA) { cache.LA = H.layer(W, H_); cache.LB = H.layer(W, H_); }
614
+ return [cache.LA, cache.LB];
615
+ }
616
+ function kaleido(ctx, src, cx, cy, n, rot, zoom) {
617
+ const sA = TAU / n;
618
+ for (let i = 0; i < n; i++) {
619
+ ctx.save(); ctx.translate(cx, cy); ctx.rotate(i * sA + rot); if (i % 2) ctx.scale(1, -1);
620
+ ctx.beginPath(); ctx.moveTo(0, 0); ctx.arc(0, 0, 1600, -0.003, sA + 0.003); ctx.closePath(); ctx.clip();
621
+ ctx.rotate(-rot * 1.6); ctx.scale(zoom, zoom); ctx.drawImage(src, -cx, -cy);
622
+ ctx.restore();
623
+ }
624
+ ctx.save(); ctx.lineWidth = 5; ctx.strokeStyle = C.ink; // mirror seams
625
+ for (let i = 0; i < n; i++) { const a = i * sA + rot; ctx.beginPath(); ctx.moveTo(cx, cy); ctx.lineTo(cx + Math.cos(a) * 1600, cy + Math.sin(a) * 1600); ctx.stroke(); }
626
+ ctx.restore();
627
+ }
628
+ function scene(i, x, W, H_, t) { x.save(); [sceneA, sceneB, sceneC, sceneD][i](x, W, H_, t); x.restore(); }
629
+
630
+ function explainerFn(ctx, W, H_, t) {
631
+ const [LA, LB] = layers(W, H_), ax = LA.getContext('2d'), bx = LB.getContext('2d');
632
+ if (t < TR1[0]) scene(0, ctx, W, H_, t);
633
+ else if (t < TR1[1]) { // kaleidoscope rotation
634
+ const p = seg(t, TR1[0], TR1[1]), env = Math.sin(Math.PI * p);
635
+ const src = p < 0.5 ? LA : LB;
636
+ scene(p < 0.5 ? 0 : 1, src.getContext('2d'), W, H_, t);
637
+ ctx.drawImage(src, 0, 0);
638
+ ctx.save(); ctx.globalAlpha = H.smooth(0, 0.22, p) * (1 - H.smooth(0.78, 1, p));
639
+ kaleido(ctx, src, 640, 380, 10, (p - 0.5) * 2.4, 1 + env * 0.45);
640
+ ctx.restore();
641
+ } else if (t < TR2[0]) scene(1, ctx, W, H_, t);
642
+ else if (t < TR2[1]) { // liquid melt: the next poster pours down over the old one, drips leading
643
+ const p = seg(t, TR2[0], TR2[1]);
644
+ scene(1, ctx, W, H_, t); scene(2, bx, W, H_, t);
645
+ const lvl = E.inOut(p) * (H_ + 330) - 170, pts = [];
646
+ for (let sx = -4; sx <= W + 4; sx += 4) {
647
+ let y = lvl + 18 * Math.sin(sx * 0.009 + t * 3) + 10 * Math.sin(sx * 0.023 + 1.7);
648
+ for (const [xk, wk, lk0] of DRIPS) { // drip tongues with filleted roots and round tips
649
+ const d = (sx - xk) / wk, lk = lk0 * Math.min(1, p * 2.2);
650
+ if (Math.abs(d) < 3) y += lk * (0.8 * Math.sqrt(Math.max(0, 1 - d * d)) + 0.2 * Math.exp(-d * d / 2.5));
651
+ }
652
+ pts.push([sx, y]);
653
+ }
654
+ const path = () => { ctx.beginPath(); ctx.moveTo(-10, -10); pts.forEach(([px, py]) => ctx.lineTo(px, py)); ctx.lineTo(W + 10, -10); ctx.closePath(); };
655
+ ctx.save(); path(); ctx.clip(); ctx.drawImage(LB, 0, 0); ctx.restore();
656
+ ctx.save(); ctx.lineJoin = 'round';
657
+ const edge = (lw, col, off) => { ctx.beginPath(); pts.forEach(([px, py], i) => (i ? ctx.lineTo(px, py + off) : ctx.moveTo(px, py + off))); ctx.lineWidth = lw; ctx.strokeStyle = col; ctx.stroke(); };
658
+ edge(20, C.ink, 4); edge(9, C.mag, 2); edge(3, C.yellow, -4);
659
+ ctx.restore();
660
+ } else if (t < TR3[0]) scene(2, ctx, W, H_, t);
661
+ else if (t < TR3[1]) { // iris ripple: rings open from the centre onto the takeaway
662
+ const p = seg(t, TR3[0], TR3[1]), r = E.inOut(p) * 820;
663
+ scene(2, ctx, W, H_, t); scene(3, bx, W, H_, t);
664
+ ctx.save(); blob(ctx, 640, 360, r, r, 0.04, 8, t * 6); ctx.clip(); ctx.drawImage(LB, 0, 0); ctx.restore();
665
+ [[C.ink, 0, 34], [C.yellow, 4, 26], [C.ink, 16, 6], [C.mag, 22, 12], [C.ink, 32, 5]].forEach(([col, off, lw]) => { blob(ctx, 640, 360, r + off, r + off, 0.04, 8, t * 6); ctx.lineWidth = lw * Math.min(1, p * 4); ctx.strokeStyle = col; ctx.stroke(); });
666
+ } else scene(3, ctx, W, H_, t);
667
+
668
+ // the question: melts in, holds, then shrinks into the corner header (stays put through transitions)
669
+ const fade = 1 - seg(t, 12.85, 13.1);
670
+ if (fade > 0) {
671
+ const tc = titleTC(), m = E.inOut(seg(t, 1.7, 2.4)), melt = 1 - E.out(seg(t, 0.05, 1.05)), sc = lerp(1, 0.5, m);
672
+ wavy(ctx, tc, lerp(640, 10 + (tc.w * 0.5) / 2, m), lerp(330, 44, m), { scale: sc, amp: lerp(6 + 34 * melt, 2, m), freq: lerp(0.012, 0.02, m), ph: t * 3, bulge: lerp(0.4, 0.06, m), melt: melt * 0.85, alpha: E.out(seg(t, 0.05, 0.6)) * fade });
673
+ }
674
+ finish(ctx, W, H_, t);
675
+ }
676
+
677
+ // ---------- sound: a warm phased organ drone, swirly phaser whooshes, round bass plucks ----------
678
+ // Timings come from the explainer above (TR1/TR2/TR3, CARDS, scene seg() windows).
679
+ // Voiceover mode (k.vo): the organ drone stays but drops to half and is minor; card plucks, counter tocks,
680
+ // ribbon swirls and small landings are minor; transitions, the wrong guess, the correction and 97% stay full.
681
+ function psySound(k) {
682
+ const D = 15, VOG = k.vo ? 0.3 : 0.6;
683
+ const hz = k.hz;
684
+ const pan = (px) => H.clamp((px / 1280) * 2 - 1, -1, 1) * 0.6;
685
+ // first time an eased progress over [a,b] reaches u
686
+ const when = (a, b, ease, u) => { for (let i = 0; i <= 400; i++) if (ease(i / 400) >= u - 1e-6) return a + ((b - a) * i) / 400; return b; };
687
+ // organ voice: two oscillators a few Hz apart beat into a slow tremolo; resonant lowpass sweeps like a phaser
688
+ const organ = (t, notes, dur, g, sweep) => notes.forEach((n, i) => {
689
+ const f = hz(n), beat = 3.2 + i * 0.7;
690
+ const f2 = sweep || [[0, 420], [dur * 0.3, 1100], [dur * 0.65, 480], [dur, 900]];
691
+ for (const [ff, type, gg] of [[f, 'sawtooth', 0.022], [f + beat, 'triangle', 0.05], [f * 0.5 + beat * 0.25, 'sine', 0.03]])
692
+ k.tone(t, { f: ff, type, dur, gain: gg * g * VOG, a: Math.min(0.6, dur * 0.25), hold: dur * 0.55, filter: 'lowpass', f2, q: 3.5, pan: (i - (notes.length - 1) / 2) * 0.35, verb: 0.3, minor: true });
693
+ });
694
+ // round bassy pluck: triangle with a closing lowpass and a sine sub
695
+ const pluck = (t, n, g = 1, p = 0, minor = false) => {
696
+ const f = hz(n);
697
+ k.tone(t, { f, type: 'triangle', dur: 0.5, gain: 0.34 * g, a: 0.004, filter: 'lowpass', f2: [[0, 1600], [0.25, 320]], q: 2, pan: p, verb: 0.2, minor });
698
+ k.tone(t, { f: f / 2, dur: 0.35, gain: 0.22 * g, a: 0.004, pan: p, minor });
699
+ };
700
+ // swirly phaser whoosh: filtered noise whose resonant band sweeps up and back down
701
+ const phaser = (t, dur, g = 1, lo = 260, hi = 1500, minor = false) => {
702
+ k.noise(t, { dur, color: 'pink', filter: 'bandpass', f: [[0, lo], [dur * 0.5, hi], [dur, lo * 1.2]], q: 5, gain: 0.3 * g, a: dur * 0.45, verb: 0.25, minor });
703
+ k.noise(t + 0.03, { dur, color: 'pink', filter: 'bandpass', f: [[0, lo * 1.5], [dur * 0.45, hi * 0.7], [dur, lo]], q: 7, gain: 0.2 * g, a: dur * 0.5, pan: 0.3, minor });
704
+ };
705
+ const tock = (t, f, g = 1, p = 0) => { k.tone(t, { f, type: 'triangle', dur: 0.08, gain: 0.16 * g, a: 0.002, pan: p, minor: true }); k.noise(t, { dur: 0.03, filter: 'bandpass', f: f * 2, q: 4, gain: 0.12 * g, a: 0.001, pan: p, minor: true }); };
706
+
707
+ // ---- the drone: E dorian organ, one voicing per scene
708
+ organ(0, ['E2', 'B2'], D, 1, [[0, 380], [3.5, 900], [7, 420], [11, 1000], [D, 500]]);
709
+ organ(0.0, ['E3', 'G3', 'B3'], 6.1, 0.8);
710
+ organ(6.0, ['A2', 'E3', 'C#4'], 1.9, 0.8);
711
+ organ(9.55, ['D3', 'F#3', 'A3'], 0.9, 0.7);
712
+ organ(10.3, ['E3', 'G3', 'D4'], 2.7, 0.8);
713
+ organ(13.1, ['E3', 'G#3', 'B3'], 1.9, 0.85);
714
+
715
+ // ---- 1 HOOK: the question melts up out of the liquid (0.05..1.05), then slides to the corner (1.7..2.4)
716
+ k.tone(0.05, { f: [[0, 98], [0.9, 165]], type: 'triangle', dur: 1.1, gain: 0.16, a: 0.5, filter: 'lowpass', f2: [[0, 300], [0.9, 1200]], q: 4, verb: 0.3 });
717
+ phaser(0.05, 1.0, 0.7, 200, 900);
718
+ pluck(1.05, 'E2', 0.8); // title settles
719
+ k.noise(1.7, { dur: 0.7, color: 'pink', filter: 'bandpass', f: [[0, 600], [0.7, 260]], q: 1, gain: 0.08, a: 0.25, pan: -0.4, minor: true });
720
+ // the eye opens and its colour floods out (1.5..2.9)
721
+ phaser(1.55, 1.35, 1, 220, 1300);
722
+ pluck(when(1.45, 2.7, (u) => u, 0.75), 'B2', 0.7, pan(950));
723
+
724
+ // ---- 2 DATA
725
+ pluck(2.62, 'G2', 0.7, pan(360)); // "Training data" melts in
726
+ phaser(2.7, 0.65, 0.45, 300, 1100, true); phaser(2.85, 0.65, 0.4, 260, 900, true); // ribbons swirl on
727
+ pluck(when(2.85, 3.2, E.back, 1), 'E2', 0.7, pan(345), true); // counter cartouche
728
+ pluck(when(2.9, 3.2, E.back, 1), 'B2', 0.8, pan(950)); // "Model" lands
729
+ CARDS.forEach((c, i) => {
730
+ const p = -0.55 + c.rib * 0.15;
731
+ pluck(c.ts + 0.05, ['E3', 'G3', 'A3', 'B3', 'D4'][i % 5], 0.4, p, true); // card pops onto the ribbon
732
+ k.tone(c.ts + CARD_T, { f: [[0, 180], [0.12, 90]], dur: 0.16, gain: 0.12, pan: pan(900), minor: true }); // swallowed by the eye
733
+ });
734
+ for (let t = 3.05, last = -1; t < 5.45;) { const u = seg(t, 3.0, 5.5); tock(t, 380 + 260 * u, 0.9, pan(250)); last = t; t += 0.16 - 0.08 * u; }
735
+ pluck(5.5, 'E2', 1.1, pan(250)); pluck(5.5, 'B2', 0.6, pan(250)); pluck(5.5, 'E3', 0.5, pan(250)); // 1,000,000
736
+
737
+ // ---- kaleidoscope rotation (TR1)
738
+ phaser(TR1[0] - 0.05, TR1[1] - TR1[0] + 0.15, 1.15, 220, 1700);
739
+ k.tone(TR1[0], { f: [[0, 130], [0.35, 196], [0.7, 147]], type: 'triangle', dur: 0.75, gain: 0.1, a: 0.3, filter: 'lowpass', f2: 900, verb: 0.4 });
740
+
741
+ // ---- 3 GUESS -> CHECK -> ADJUST
742
+ k.noise(6.55, { dur: 0.4, color: 'pink', filter: 'bandpass', f: [[0, 400], [0.4, 900]], q: 2, gain: 0.08, a: 0.2, pan: pan(380), minor: true }); // arrow to the eye
743
+ pluck(when(6.9, 7.15, E.back, 1), 'G2', 0.8, pan(835)); // Guess
744
+ k.noise(6.9, { dur: 0.4, color: 'pink', filter: 'bandpass', f: [[0, 500], [0.4, 1100]], q: 2, gain: 0.08, a: 0.2, pan: pan(840), minor: true });
745
+ pluck(when(7.3, 7.55, E.back, 1), 'B2', 0.9, pan(1065)); // "dog?" bubble
746
+ // WRONG (7.8): woozy pitch-bent dip, two sour detuned saws sliding down + a soft low thud
747
+ for (const f0 of [233, 233 * 1.06, 175])
748
+ k.tone(7.8, { f: [[0, f0], [0.12, f0 * 1.03], [0.75, f0 * 0.62]], type: 'sawtooth', dur: 0.9, gain: 0.09, a: 0.01, hold: 0.3, filter: 'lowpass', f2: [[0, 1400], [0.8, 400]], q: 3, pan: pan(1100), verb: 0.25 });
749
+ k.play('thud', 7.8, { f: 110, gain: 0.7, pan: pan(1100) });
750
+ pluck(when(7.8, 8.05, E.back, 1), 'F2', 0.6, pan(1100), true); // Check lands
751
+ // the clash: a sour beating drone under the jitter (tritone, fast beat)
752
+ k.tone(7.85, { f: 'Bb2', type: 'sawtooth', dur: 1.7, gain: 0.03 * VOG, a: 0.1, hold: 1.3, filter: 'lowpass', f2: 700, pan: -0.3, minor: true });
753
+ k.tone(7.85, { f: hz('E3') + 7, type: 'sawtooth', dur: 1.7, gain: 0.03 * VOG, a: 0.1, hold: 1.3, filter: 'lowpass', f2: 700, pan: 0.3, minor: true });
754
+ // error ripple travels back (8.35..8.85): a descending phaser sweep with a low glide
755
+ k.noise(8.35, { dur: 0.55, color: 'pink', filter: 'bandpass', f: [[0, 1400], [0.5, 240]], q: 6, gain: 0.3, a: 0.15, pan: pan(900), verb: 0.2 });
756
+ k.tone(8.35, { f: [[0, 260], [0.5, 110]], type: 'triangle', dur: 0.55, gain: 0.14, a: 0.05, pan: pan(800) });
757
+ pluck(when(8.6, 8.85, E.back, 1), 'A2', 0.7, pan(905)); // Adjust lands
758
+ // petals (weights) re-tune: four round plucks climbing as they turn (8.85..9.5)
759
+ ['E2', 'G2', 'A2', 'B2'].forEach((n, i) => pluck(when(8.85, 9.5, E.inOut, (i + 1) / 4) - 0.04, n, 0.55, pan(640) + (i - 1.5) * 0.12, true));
760
+ pluck(when(8.9, 9.15, E.back, 1), 'D3', 0.45, pan(420), true); // "weights" label
761
+ // RIGHT (9.55): bright major chord swell as the swirl folds into a mandala
762
+ ['E3', 'G#3', 'B3', 'E4'].forEach((n, i) => {
763
+ k.tone(9.55, { f: n, type: 'triangle', dur: 1.3, gain: 0.07, a: 0.12, hold: 0.4, filter: 'lowpass', f2: [[0, 700], [0.4, 2000], [1.3, 900]], q: 1.5, pan: (i - 1.5) * 0.3, verb: 0.4 });
764
+ k.tone(9.55, { f: hz(n) + 2.5, dur: 1.3, gain: 0.05, a: 0.15, hold: 0.4, pan: (i - 1.5) * 0.3 });
765
+ });
766
+ pluck(9.55, 'E2', 0.9);
767
+
768
+ // ---- liquid melt (TR2): the new poster pours down, a gloopy falling slide with drips
769
+ k.noise(TR2[0], { dur: 0.75, color: 'pink', filter: 'bandpass', f: [[0, 900], [0.7, 200]], q: 4, gain: 0.32, a: 0.2, verb: 0.2 });
770
+ k.tone(TR2[0], { f: [[0, 330], [0.7, 98]], type: 'sine', dur: 0.75, gain: 0.14, a: 0.1 });
771
+ [0.25, 0.42, 0.6].forEach((d, i) => k.tone(TR2[0] + d, { f: [[0, 520 - i * 60], [0.07, 200]], dur: 0.1, gain: 0.1, pan: (i - 1) * 0.5, minor: true }));
772
+
773
+ // ---- 4 PROGRESS
774
+ pluck(when(10.7, 11.05, E.back, 1), 'G2', 0.6, pan(985), true); // chart panel
775
+ pluck(10.8, 'B2', 0.7, pan(575)); // "Accuracy"
776
+ for (let t = 10.9, last = 61, lastT = -1; t < 12.3; t += 1 / 120) {
777
+ const v = Math.round(61 + 36 * E.inOut(seg(t, 10.9, 12.3)));
778
+ if (v !== last && t - lastT >= 1 / 11) { tock(t, 300 + (v - 61) * 7, 1, pan(400)); last = v; lastT = t; }
779
+ }
780
+ // 97% (12.3): big shimmering bloom: low impact + a wide detuned E-major chord swelling in
781
+ k.play('impact', 12.3, { gain: 1.15, pan: pan(400) });
782
+ ['E2', 'B2', 'E3', 'G#3', 'B3', 'E4'].forEach((n, i) => {
783
+ for (const d of [-3, 3]) k.tone(12.3, { f: hz(n) + d * (1 + i * 0.3), type: i < 2 ? 'triangle' : 'sine', dur: 1.6, gain: 0.065, a: 0.06, hold: 0.5, filter: 'lowpass', f2: [[0, 2200], [1.6, 700]], pan: (i - 2.5) * 0.25 + d * 0.05, verb: 0.5 });
784
+ });
785
+ k.noise(12.3, { dur: 1.2, color: 'pink', filter: 'bandpass', f: [[0, 2000], [1.2, 700]], q: 3, gain: 0.08, a: 0.05, verb: 0.5 });
786
+
787
+ // ---- iris ripple (TR3) onto the takeaway
788
+ phaser(TR3[0] - 0.05, 0.6, 0.9, 260, 1500);
789
+
790
+ // ---- 5 TAKEAWAY
791
+ pluck(13.3, 'E2', 0.8); // "More examples" melts in
792
+ k.noise(13.5, { dur: 0.3, color: 'pink', filter: 'bandpass', f: [[0, 500], [0.3, 1000]], q: 2, gain: 0.08, a: 0.12, pan: 0.4, minor: true }); // arrow
793
+ pluck(13.6, 'B2', 0.85); // "better guesses"
794
+ ['E3', 'G#3', 'B3'].forEach((n, i) => k.tone(13.95, { f: n, type: 'triangle', dur: 1.05, gain: 0.08, a: 0.05, hold: 0.5, filter: 'lowpass', f2: 1400, pan: (i - 1) * 0.3, verb: 0.4 }));
795
+ pluck(13.95, 'E2', 0.9);
796
+ }
797
+
798
+ registerStyle({
799
+ id: 'psychedelic',
800
+ name: 'Psychedelic Poster',
801
+ category: 'Cosmic & Psychedelic',
802
+ description: '1960s San Francisco concert-poster psychedelia: full-strength inks in vibrating complementary pairs, liquid churning ring bands, sunbursts and a mirror-symmetric eye-flower, with bulbous melting Shrikhand lettering on worn poster stock.',
803
+ motion: 'Colour ripples out from the centre, petals unfurl and the eye opens, then the lettering melts into place while the liquid bands keep slowly churning.',
804
+ fonts: ['400 138px "Shrikhand"', '400 34px "Righteous"'],
805
+ duration: 6,
806
+ frameT: 5.6,
807
+ readsPixels: true,
808
+ draw(ctx, W, H_, t) { poster(ctx, W, H_, t); },
809
+ explainerDuration: 15,
810
+ explainerNote: 'The model is a giant eye-flower whose petals are its weights: examples ride striped ribbons into it, the wrong guess makes the inks clash and jitter, the correction folds the swirl into a symmetric mandala, 97% bursts into a kaleidoscope sunburst; scenes change by kaleidoscope rotation, a liquid melt and an iris ripple.',
811
+ explainer(ctx, W, H_, t) { explainerFn(ctx, W, H_, t); },
812
+ explainerSound(k) { psySound(k); },
813
+ });
814
+ }