@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,909 @@
1
+ {
2
+ // ---------------------------------------------------------------
3
+ // Watercolor — layered deformed-polygon washes on cold-press paper
4
+ // ---------------------------------------------------------------
5
+ const PAPER = [251, 248, 240];
6
+
7
+ // recursive midpoint displacement; each vertex carries its own "wobble" weight v
8
+ function deform(pts, r, depth, amt) {
9
+ let p = pts;
10
+ for (let d = 0; d < depth; d++) {
11
+ const out = [];
12
+ for (let i = 0; i < p.length; i++) {
13
+ const a = p[i], b = p[(i + 1) % p.length];
14
+ out.push(a);
15
+ const len = Math.hypot(b.x - a.x, b.y - a.y);
16
+ const v = (a.v + b.v) * 0.5;
17
+ const s = len * amt * v;
18
+ out.push({ x: (a.x + b.x) / 2 + r.gauss() * s, y: (a.y + b.y) / 2 + r.gauss() * s, v: v * (0.7 + r() * 0.6) });
19
+ }
20
+ p = out;
21
+ }
22
+ return p;
23
+ }
24
+ function poly(c, pts) {
25
+ c.beginPath(); c.moveTo(pts[0].x, pts[0].y);
26
+ for (let i = 1; i < pts.length; i++) c.lineTo(pts[i].x, pts[i].y);
27
+ c.closePath();
28
+ }
29
+ const P = (x, y, v = 1) => ({ x, y, v });
30
+ function circlePts(cx, cy, rx, ry, n, r, vv = 1, a0 = 0, a1 = Math.PI * 2) {
31
+ const out = [];
32
+ for (let i = 0; i < n; i++) { const a = a0 + (a1 - a0) * i / n; out.push(P(cx + Math.cos(a) * rx, cy + Math.sin(a) * ry, vv * (0.6 + r() * 0.8))); }
33
+ return out;
34
+ }
35
+
36
+ // value-noise field (fast) in 0..1, sampled bilinearly from a random grid
37
+ function grid(W, H_, cell, r) {
38
+ const gw = Math.ceil(W / cell) + 2, gh = Math.ceil(H_ / cell) + 2, g = new Float32Array(gw * gh);
39
+ for (let i = 0; i < g.length; i++) g[i] = r();
40
+ return (x, y) => {
41
+ const fx = x / cell, fy = y / cell, ix = fx | 0, iy = fy | 0, tx = fx - ix, ty = fy - iy;
42
+ const sx = tx * tx * (3 - 2 * tx), sy = ty * ty * (3 - 2 * ty);
43
+ const a = g[iy * gw + ix], b = g[iy * gw + ix + 1], c = g[(iy + 1) * gw + ix], d = g[(iy + 1) * gw + ix + 1];
44
+ return a + (b - a) * sx + (c - a) * sy + (a - b - c + d) * sx * sy;
45
+ };
46
+ }
47
+
48
+ function makeMottle(W, H_, seed) {
49
+ const c = H.layer(W, H_), x = c.getContext('2d'), r = H.rng(seed);
50
+ const small = H.layer(48, 27), sx = small.getContext('2d');
51
+ for (let j = 0; j < 27; j++) for (let i = 0; i < 48; i++) { sx.fillStyle = `rgba(0,0,0,${0.55 + r() * 0.45})`; sx.fillRect(i, j, 1, 1); }
52
+ const mid = H.layer(160, 90), mx = mid.getContext('2d');
53
+ for (let j = 0; j < 90; j++) for (let i = 0; i < 160; i++) { mx.fillStyle = `rgba(0,0,0,${0.75 + r() * 0.25})`; mx.fillRect(i, j, 1, 1); }
54
+ x.imageSmoothingEnabled = true; x.imageSmoothingQuality = 'high';
55
+ x.drawImage(small, 0, 0, W, H_);
56
+ x.globalCompositeOperation = 'destination-in'; x.drawImage(mid, 0, 0, W, H_);
57
+ return c;
58
+ }
59
+
60
+
61
+ // =================================================================
62
+ // EXPLAINER — "How does AI learn?" painted along one long sketchbook sheet; the camera pans across it.
63
+ // =================================================================
64
+ const EXW = 3400;
65
+ let EXC = null;
66
+ const lerp = (a, b, u) => a + (b - a) * u;
67
+ const cl = (v) => (v < 0 ? 0 : v > 1 ? 1 : v);
68
+ const ez = (u) => H.ease.inOut(cl(u));
69
+ const win = (t, a, b) => cl((t - a) / (b - a));
70
+
71
+ // pigment pools at the drying edge: alpha += (alpha - blurred alpha) * pool
72
+ function rimPool(cv, pool = 2.2, blur = 4) {
73
+ const w = cv.width, h = cv.height, c = cv.getContext('2d');
74
+ const B = H.layer(w, h), b = B.getContext('2d');
75
+ b.filter = `blur(${blur}px)`; b.drawImage(cv, 0, 0); b.filter = 'none';
76
+ const A = c.getImageData(0, 0, w, h), d = A.data, e = b.getImageData(0, 0, w, h).data;
77
+ for (let i = 3; i < d.length; i += 4) { const rim = d[i] - e[i]; if (rim > 0) d[i] = Math.min(255, d[i] + rim * pool); }
78
+ c.putImageData(A, 0, 0);
79
+ return cv;
80
+ }
81
+ // layered deformed-polygon wash into a canvas context
82
+ function exWash(c, base, col, { layers = 26, alpha = 0.06, amt = 0.14, depth = 3, seed = 1, comp = 'source-over' } = {}) {
83
+ const r = H.rng(seed);
84
+ c.save(); c.globalCompositeOperation = comp; c.fillStyle = Array.isArray(col) ? H.rgba(col, 1) : col;
85
+ for (let i = 0; i < layers; i++) { c.globalAlpha = alpha * (0.6 + r() * 0.8); poly(c, deform(base, r, depth, amt)); c.fill(); }
86
+ c.restore();
87
+ }
88
+ const blob = (x, y, rx, ry, seed, n = 10, v = 1) => deform(circlePts(x, y, rx, ry, n, H.rng(seed), v), H.rng(seed + 1), 2, 0.25);
89
+ function exBloom(c, x, y, r0, seed, a = 0.5) { exWash(c, blob(x, y, r0, r0 * 0.85, seed, 9, 1.4), '#000', { layers: 10, alpha: a / 5, amt: 0.35, depth: 2, seed: seed + 3, comp: 'destination-out' }); }
90
+
91
+ function cachedExplainer() {
92
+ if (EXC) return EXC;
93
+ const C = {};
94
+ // --- world-long sheet of cold-press paper (tooth baked in once; the height map is kept for granulation) ---
95
+ const pw = H.layer(EXW, 720), px = pw.getContext('2d');
96
+ const gr = H.rng(99), fine = grid(EXW, 720, 2.2, gr), mid = grid(EXW, 720, 7, gr), big = grid(EXW, 720, 40, gr);
97
+ const img = px.createImageData(EXW, 720), d = img.data, HM = new Float32Array(EXW * 720);
98
+ let prev = new Float32Array(EXW), cur = new Float32Array(EXW);
99
+ for (let y = 0; y < 720; y++) {
100
+ for (let x = 0; x < EXW; x++) cur[x] = HM[y * EXW + x] = fine(x, y) * 0.3 + mid(x, y) * 0.5 + big(x, y) * 0.2;
101
+ for (let x = 0; x < EXW; x++) {
102
+ const sh = 1 + ((x > 0 ? prev[x - 1] : prev[x]) - cur[x]) * 0.1 + (big(x, y) - 0.5) * 0.03, o = (y * EXW + x) * 4;
103
+ d[o] = PAPER[0] * sh; d[o + 1] = PAPER[1] * sh; d[o + 2] = PAPER[2] * sh; d[o + 3] = 255;
104
+ }
105
+ const tmp = prev; prev = cur; cur = tmp;
106
+ }
107
+ px.putImageData(img, 0, 0);
108
+ // the sheet isn't bare white: a very faint warm tone that gathers toward the top and bottom edges, plus old ghost washes
109
+ px.save(); px.globalCompositeOperation = 'multiply';
110
+ const ev = px.createLinearGradient(0, 0, 0, 720); ev.addColorStop(0, 'rgba(232,214,182,0.55)'); ev.addColorStop(0.18, 'rgba(250,240,222,0.2)');
111
+ ev.addColorStop(0.8, 'rgba(250,240,222,0.2)'); ev.addColorStop(1, 'rgba(228,208,172,0.6)'); px.fillStyle = ev; px.fillRect(0, 0, EXW, 720);
112
+ const gw = H.rng(404);
113
+ for (let k = 0; k < 14; k++) { const warm = gw() < 0.5, x0 = gw.range(0, EXW), y0 = gw.range(0, 720), rx = gw.range(140, 320), ry = gw.range(70, 170);
114
+ px.save(); px.translate(x0, y0); px.scale(1, ry / rx); const g = px.createRadialGradient(0, 0, 0, 0, 0, rx);
115
+ g.addColorStop(0, warm ? 'rgba(236,214,170,0.2)' : 'rgba(214,214,226,0.16)'); g.addColorStop(1, 'rgba(255,255,255,0)'); px.fillStyle = g; px.fillRect(-rx, -rx, rx * 2, rx * 2); px.restore(); }
116
+ px.restore();
117
+ C.paper = pw;
118
+ // mottle (same recipe as makeMottle, built from ImageData instead of thousands of fillRects)
119
+ const mottle = H.layer(1400, 700); {
120
+ const r = H.rng(77), cell = (w, h, lo) => { const c = H.layer(w, h), x = c.getContext('2d'), im = x.createImageData(w, h);
121
+ for (let i = 0; i < w * h; i++) im.data[i * 4 + 3] = (lo + r() * (1 - lo)) * 255; x.putImageData(im, 0, 0); return c; };
122
+ const sm = cell(48, 27, 0.55), md = cell(160, 90, 0.75), mx = mottle.getContext('2d');
123
+ mx.imageSmoothingQuality = 'high'; mx.drawImage(sm, 0, 0, 1400, 700); mx.globalCompositeOperation = 'destination-in'; mx.drawImage(md, 0, 0, 1400, 700); }
124
+ // pooled drying edge + granulation in one pixel pass (alpha += (alpha - blurred alpha) * pool, then the paper-pit boost)
125
+ const poolGran = (cv, pool, blur, at) => {
126
+ // the blurred alpha is smooth, so it is computed at half resolution
127
+ const w = cv.width, h = cv.height, c = cv.getContext('2d'), w2 = Math.ceil(w / 2), h2 = Math.ceil(h / 2), B = H.layer(w2, h2), b = B.getContext('2d');
128
+ b.filter = `blur(${blur / 2}px)`; b.drawImage(cv, 0, 0, w2, h2);
129
+ const im = c.getImageData(0, 0, w, h), dd = im.data, e = b.getImageData(0, 0, w2, h2).data, wx = at[0], wy = at[1], k = at[2] || 1;
130
+ let hs = 9173;
131
+ for (let y = 0; y < h; y++) { const Y = y + wy, row = Y >= 0 && Y < 720 ? Y * EXW : -1; for (let x = 0; x < w; x++) {
132
+ const i = (y * w + x) * 4; let a = dd[i + 3]; hs = (hs * 1103515245 + 12345) & 0x7fffffff; if (!a) continue;
133
+ const rim = a - e[((y >> 1) * w2 + (x >> 1)) * 4 + 3]; if (rim > 0) a = Math.min(255, a + rim * pool);
134
+ const X = x + wx, hh = row >= 0 && X >= 0 && X < EXW ? HM[row + X] : 0.5;
135
+ const blue = Math.max(0, (dd[i + 2] - dd[i]) / 120), sp = (hs & 1023) / 1023;
136
+ dd[i + 3] = Math.min(255, a * (1 + k * ((0.5 - hh) * 2 * (0.18 + blue * 0.7) + (sp > 0.88 ? (sp - 0.88) * 4 * (0.2 + blue) : 0))));
137
+ } }
138
+ c.putImageData(im, 0, 0);
139
+ };
140
+ // softened mottle for the explainer washes: alpha 0.5 + 0.5 * mottle, so pigment load varies without camouflage blotches
141
+ const soft = H.layer(1400, 700); { const sx = soft.getContext('2d'); sx.fillStyle = 'rgba(0,0,0,0.5)'; sx.fillRect(0, 0, 1400, 700); sx.drawImage(mottle, 0, 0); }
142
+ // wash canvas: paint (optionally at half resolution for the big loose washes) -> mottle -> pooled drying edge -> granulation
143
+ const mk = (w, h, fn, pool = 2.2, blur = 6, at = null, post = null, half = false) => {
144
+ const cv = H.layer(w, h), c = cv.getContext('2d');
145
+ if (half) { const hv = H.layer(Math.ceil(w / 2), Math.ceil(h / 2)), hc = hv.getContext('2d'); hc.scale(0.5, 0.5); fn(hc, w, h);
146
+ c.imageSmoothingQuality = 'high'; c.drawImage(hv, 0, 0, w, h);
147
+ // feather the canvas border so a wash can never end in a straight cut
148
+ c.globalCompositeOperation = 'destination-in'; const fx = c.createLinearGradient(0, 0, w, 0), fy = c.createLinearGradient(0, 0, 0, h);
149
+ [[0, 0], [40 / w, 1], [1 - 40 / w, 1], [1, 0]].forEach(([o, a]) => fx.addColorStop(o, `rgba(0,0,0,${a})`));
150
+ [[0, 0], [40 / h, 1], [1 - 40 / h, 1], [1, 0]].forEach(([o, a]) => fy.addColorStop(o, `rgba(0,0,0,${a})`));
151
+ c.fillStyle = fx; c.fillRect(0, 0, w, h); c.fillStyle = fy; c.fillRect(0, 0, w, h); }
152
+ else fn(c, w, h);
153
+ c.globalCompositeOperation = 'destination-in'; c.drawImage(soft, 0, 0, w, h); c.globalCompositeOperation = 'source-over';
154
+ if (at) poolGran(cv, pool, blur, at); else rimPool(cv, pool, blur);
155
+ if (post) post(c, w, h);
156
+ return cv;
157
+ };
158
+ // wet-in-wet: a second pigment dropped into the damp wash, as soft radial blooms that only tint where the wash already is
159
+ const softEll = (c, x, y, rx, ry, rot, col, a) => { c.save(); c.translate(x, y); c.rotate(rot); c.scale(1, ry / rx); const g = c.createRadialGradient(0, 0, 0, 0, 0, rx * 1.25);
160
+ g.addColorStop(0, H.rgba(col, a)); g.addColorStop(0.6, H.rgba(col, a * 0.75)); g.addColorStop(1, H.rgba(col, 0)); c.fillStyle = g; c.fillRect(-rx * 1.25, -rx * 1.25, rx * 2.5, rx * 2.5); c.restore(); };
161
+ const drop = (c, col, blobs) => { c.save(); c.globalCompositeOperation = 'source-atop';
162
+ blobs.forEach(([x, y, rx, ry, a]) => { c.save(); c.translate(x, y); c.scale(1, ry / rx); const g = c.createRadialGradient(0, 0, 0, 0, 0, rx * 1.3);
163
+ g.addColorStop(0, H.rgba(col, a)); g.addColorStop(0.55, H.rgba(col, a * 0.7)); g.addColorStop(1, H.rgba(col, 0)); c.fillStyle = g; c.fillRect(-rx * 1.3, -rx * 1.3, rx * 2.6, rx * 2.6); c.restore(); });
164
+ c.restore(); };
165
+ // built on first use, so a frame only pays for the washes it actually shows
166
+ const lazy = (name, build) => { let v = null; Object.defineProperty(C, name, { get: () => v || (v = build()) }); };
167
+ // --- loose background washes, one per stop on the sheet (revealed as the camera arrives) ---
168
+ lazy('bgData', () => mk(1300, 600, (c) => {
169
+ const base = deform([P(150, 330, 1.3), P(380, 250, 1.0), P(700, 270, 1.2), P(1000, 250, 1.3), P(1120, 380, 1.2), P(820, 470, 1.1), P(400, 480, 1.2), P(170, 450, 1.3)], H.rng(3), 3, 0.2);
170
+ exWash(c, base, [222, 184, 118], { layers: 22, alpha: 0.05, amt: 0.15, depth: 3, seed: 4 });
171
+ // wet-on-dry second glaze over part of it: a darker overlapped band with its own edge
172
+ exWash(c, deform([P(300, 300, 1.2), P(640, 290, 1.1), P(900, 300, 1.3), P(860, 400, 1.2), P(520, 420, 1.0), P(280, 400, 1.3)], H.rng(31), 3, 0.22), [206, 150, 92], { layers: 15, alpha: 0.038, amt: 0.15, depth: 3, seed: 32 });
173
+ drop(c, [176, 96, 62], [[520, 420, 120, 50, 0.32], [960, 330, 90, 60, 0.28], [250, 400, 80, 40, 0.24]]);
174
+ drop(c, [120, 110, 170], [[720, 450, 110, 36, 0.2]], 20);
175
+ exBloom(c, 460, 400, 40, 7, 0.6); exBloom(c, 900, 330, 30, 8, 0.5); exBloom(c, 680, 300, 26, 17, 0.55); exBloom(c, 230, 360, 22, 18, 0.5);
176
+ }, 3, 8, [-60, 110, 0.7], null, true));
177
+ lazy('bgLoop', () => mk(1200, 660, (c) => {
178
+ const base = deform([P(170, 200, 1.3), P(420, 130, 1.1), P(820, 140, 1.3), P(1040, 260, 1.3), P(1000, 500, 1.2), P(640, 540, 1.1), P(280, 520, 1.3), P(150, 380, 1.2)], H.rng(5), 3, 0.2);
179
+ exWash(c, base, [150, 188, 220], { layers: 22, alpha: 0.05, amt: 0.15, depth: 3, seed: 6 });
180
+ exWash(c, deform([P(260, 180, 1.3), P(600, 150, 1.1), P(900, 190, 1.4), P(820, 300, 1.2), P(500, 280, 1.0), P(240, 300, 1.3)], H.rng(33), 3, 0.22), [110, 140, 200], { layers: 15, alpha: 0.038, amt: 0.15, depth: 3, seed: 34 });
181
+ drop(c, [80, 84, 168], [[420, 240, 160, 70, 0.34], [700, 200, 120, 60, 0.26], [940, 380, 90, 70, 0.22]]);
182
+ drop(c, [200, 120, 150], [[820, 440, 130, 60, 0.3], [300, 430, 80, 40, 0.18]]);
183
+ exBloom(c, 760, 260, 44, 9, 0.7); exBloom(c, 300, 460, 34, 10, 0.6); exBloom(c, 560, 420, 30, 19, 0.55); exBloom(c, 980, 300, 26, 20, 0.5);
184
+ }, 3, 8, [960, 0, 0.8], null, true));
185
+ lazy('bgChart', () => mk(1100, 560, (c) => {
186
+ const base = deform([P(130, 170, 1.3), P(520, 150, 1.1), P(960, 170, 1.3), P(980, 470, 1.3), P(580, 500, 1.1), P(140, 480, 1.3)], H.rng(11), 3, 0.2);
187
+ exWash(c, base, [168, 202, 168], { layers: 22, alpha: 0.05, amt: 0.15, depth: 3, seed: 12 });
188
+ exWash(c, deform([P(140, 380, 1.2), P(520, 330, 1.1), P(960, 300, 1.3), P(960, 460, 1.2), P(560, 490, 1.0), P(150, 470, 1.3)], H.rng(35), 3, 0.22), [120, 170, 150], { layers: 15, alpha: 0.038, amt: 0.15, depth: 3, seed: 36 });
189
+ drop(c, [70, 130, 150], [[300, 420, 140, 60, 0.3], [760, 430, 120, 50, 0.26]]);
190
+ drop(c, [200, 200, 90], [[620, 220, 150, 60, 0.26], [260, 210, 90, 40, 0.2]]);
191
+ exBloom(c, 860, 140, 40, 13, 0.6); exBloom(c, 420, 300, 30, 21, 0.5); exBloom(c, 700, 380, 26, 22, 0.5);
192
+ }, 3, 8, [2140, 60, 0.7], null, true));
193
+ // --- a cerulean sky painted around the bulb, with a ragged white halo lifted out (negative painting, as in the still) ---
194
+ lazy('sky', () => mk(640, 600, (c) => {
195
+ const cx = 290, cy = 270;
196
+ exWash(c, deform([P(90, 130, 1.4), P(230, 62, 1.2), P(420, 48, 1.4), P(560, 110, 1.3), P(588, 270, 1.4), P(548, 420, 1.2), P(430, 470, 1.0), P(300, 450, 1.0), P(170, 470, 1.3), P(70, 380, 1.4), P(60, 250, 1.3)], H.rng(82), 3, 0.18), [126, 178, 214], { layers: 22, alpha: 0.05, amt: 0.12, depth: 3, seed: 83 });
197
+ exWash(c, deform([P(120, 110, 1.3), P(330, 60, 1.2), P(540, 100, 1.4), P(560, 200, 1.3), P(420, 170, 1.0), P(200, 210, 1.3), P(100, 220, 1.4)], H.rng(92), 3, 0.2), [70, 98, 172], { layers: 15, alpha: 0.03, amt: 0.14, depth: 3, seed: 93 });
198
+ drop(c, [70, 82, 170], [[160, 160, 110, 70, 0.34], [470, 120, 100, 60, 0.3], [480, 420, 90, 60, 0.24], [130, 430, 80, 60, 0.26]]);
199
+ drop(c, [200, 120, 150], [[520, 300, 70, 50, 0.24]]);
200
+ exWash(c, deform(circlePts(cx + 4, cy + 6, 154, 160, 20, H.rng(84), 1.0), H.rng(85), 4, 0.16), '#000', { layers: 10, alpha: 0.35, amt: 0.12, depth: 2, seed: 86, comp: 'destination-out' });
201
+ exWash(c, deform(circlePts(cx, cy + 4, 128, 136, 12, H.rng(87), 1.0), H.rng(88), 3, 0.22), '#000', { layers: 10, alpha: 0.5, amt: 0.1, depth: 2, seed: 89, comp: 'destination-out' });
202
+ exBloom(c, 520, 160, 34, 90, 0.7); exBloom(c, 110, 330, 30, 91, 0.6);
203
+ }, 2.6, 8, [870, 30, 0.8], null, true));
204
+ // --- the model: a lightbulb with a sprout (the still's motif), painted once ---
205
+ const BCX = 150, BCY = 150, BRAD = 112;
206
+ const arcPts = (x, y, r1, r2, a0, a1, n = 40) => { const o = []; for (let i = 0; i <= n; i++) { const a = a0 + (a1 - a0) * i / n; o.push([x + Math.cos(a) * r1, y + Math.sin(a) * r2]); } return o; };
207
+ C.bulb = mk(300, 420, (c) => {
208
+ const cx = BCX, cy = BCY, rad = BRAD, g = [];
209
+ for (let i = 0; i <= 24; i++) { const a = Math.PI * 0.72 + Math.PI * 1.56 * i / 24; g.push(P(cx + Math.cos(a) * rad, cy + Math.sin(a) * rad, 0.5)); }
210
+ g.push(P(cx + 55, cy + 136, 0.4), P(cx + 52, cy + 150, 0.3), P(cx - 52, cy + 150, 0.3), P(cx - 55, cy + 136, 0.4));
211
+ // violet cast shadow on the table, granulating (light from the top-left)
212
+ exWash(c, deform(circlePts(cx + 26, cy + 224, 84, 13, 14, H.rng(25), 1.0), H.rng(26), 3, 0.16), [130, 120, 176], { layers: 16, alpha: 0.03, amt: 0.16, seed: 27 });
213
+ exWash(c, deform(g, H.rng(21), 2, 0.1), [250, 214, 90], { layers: 30, alpha: 0.05, amt: 0.08, seed: 22 });
214
+ // second aureolin layer (wet on dry), pulled toward the shadow side -> a layered edge inside the glass
215
+ const g2 = []; for (let i = 0; i <= 16; i++) { const a = -Math.PI * 0.55 + Math.PI * 1.25 * i / 16; g2.push(P(cx + 8 + Math.cos(a) * (rad - 10), cy + 8 + Math.sin(a) * (rad - 8), 0.7)); }
216
+ exWash(c, deform(g2, H.rng(28), 2, 0.14), [240, 190, 70], { layers: 18, alpha: 0.04, amt: 0.12, seed: 29 });
217
+ // wet-in-wet warm core and a touch of rose
218
+ c.save(); c.globalCompositeOperation = 'source-atop';
219
+ softEll(c, cx + 8, cy + 30, 66, 72, 0, [246, 150, 60], 0.5); softEll(c, cx + 30, cy + 76, 44, 36, 0, [225, 90, 90], 0.3); c.restore();
220
+ // cool reflected light on the shadow side of the glass
221
+ const refl = []; for (let i = 0; i <= 12; i++) { const a = -Math.PI * 0.32 + Math.PI * 0.62 * i / 12; refl.push(P(cx + Math.cos(a) * (rad - 2), cy + Math.sin(a) * (rad - 2), 0.5)); }
222
+ for (let i = 12; i >= 0; i--) { const a = -Math.PI * 0.22 + Math.PI * 0.5 * i / 12; refl.push(P(cx + Math.cos(a) * (rad - 22), cy + Math.sin(a) * (rad - 22), 0.9)); }
223
+ c.save(); c.globalCompositeOperation = 'source-atop'; exWash(c, deform(refl, H.rng(30), 2, 0.2), [150, 180, 210], { layers: 14, alpha: 0.05, amt: 0.15, seed: 31 }); c.restore();
224
+ const cres = []; for (let i = 0; i <= 10; i++) { const a = Math.PI * 1.08 + Math.PI * 0.32 * i / 10; cres.push(P(cx + Math.cos(a) * (rad - 16), cy + Math.sin(a) * (rad - 16), 0.6)); }
225
+ for (let i = 10; i >= 0; i--) { const a = Math.PI * 1.12 + Math.PI * 0.26 * i / 10; cres.push(P(cx + 6 + Math.cos(a) * (rad - 34), cy + 6 + Math.sin(a) * (rad - 34), 0.6)); }
226
+ exWash(c, deform(cres, H.rng(23), 2, 0.2), '#000', { layers: 12, alpha: 0.2, amt: 0.2, depth: 2, seed: 24, comp: 'destination-out' });
227
+ exWash(c, deform(circlePts(cx + 74, cy - 62, 6, 9, 8, H.rng(37)), H.rng(38), 2, 0.2), '#000', { layers: 6, alpha: 0.7, amt: 0.1, depth: 2, seed: 39, comp: 'destination-out' });
228
+ exBloom(c, cx - 30, cy + 80, 20, 40, 0.45);
229
+ // sprout
230
+ c.save(); c.strokeStyle = 'rgba(84,122,58,0.8)'; c.lineWidth = 4; c.lineCap = 'round'; c.beginPath(); c.moveTo(cx - 2, cy + 140); c.bezierCurveTo(cx - 8, cy + 90, cx + 8, cy + 40, cx + 2, cy - 14); c.stroke(); c.restore();
231
+ const leaf = (x0, y0, ang, len, wid, seed) => { const pts = []; for (let i = 0; i <= 10; i++) { const u = i / 10; pts.push([u * len, -Math.sin(u * Math.PI) * wid]); } for (let i = 9; i >= 1; i--) { const u = i / 10; pts.push([u * len, Math.sin(u * Math.PI) * wid * 0.8]); }
232
+ exWash(c, deform(pts.map(([u, v]) => P(x0 + u * Math.cos(ang) - v * Math.sin(ang), y0 + u * Math.sin(ang) + v * Math.cos(ang), 0.5)), H.rng(seed), 2, 0.1), [92, 148, 64], { layers: 18, alpha: 0.08, amt: 0.07, seed: seed + 1 }); };
233
+ leaf(cx - 2, cy + 28, Math.PI * 1.06, 82, 24, 31); leaf(cx + 2, cy - 4, -Math.PI * 0.1, 78, 22, 33);
234
+ // wet-in-wet yellow at the leaf tips, deep green at the stem
235
+ c.save(); c.globalCompositeOperation = 'source-atop';
236
+ softEll(c, cx - 58, cy + 22, 28, 11, 0.15, [190, 200, 60], 0.55); softEll(c, cx + 56, cy - 14, 28, 11, -0.3, [190, 200, 60], 0.55);
237
+ softEll(c, cx - 16, cy + 30, 22, 11, 0.15, [40, 90, 70], 0.5); softEll(c, cx + 18, cy - 8, 22, 10, -0.3, [40, 90, 70], 0.5); c.restore();
238
+ // screw base: Payne's grey, a warm burnt-sienna side, dark bands, a lifted highlight
239
+ exWash(c, deform([P(cx - 54, cy + 150, 0.3), P(cx + 54, cy + 150, 0.3), P(cx + 50, cy + 196, 0.3), P(cx + 22, cy + 212, 0.4), P(cx - 22, cy + 212, 0.4), P(cx - 50, cy + 196, 0.3)], H.rng(41), 2, 0.08), [150, 152, 170], { layers: 18, alpha: 0.06, amt: 0.06, seed: 42 });
240
+ c.save(); c.globalCompositeOperation = 'source-atop'; softEll(c, cx + 34, cy + 180, 26, 34, 0, [160, 96, 60], 0.45); c.restore();
241
+ for (let k = 0; k < 3; k++) exWash(c, deform([P(cx - 54, cy + 160 + k * 13, 0.3), P(cx + 54, cy + 156 + k * 13, 0.3), P(cx + 54, cy + 163 + k * 13, 0.3), P(cx - 54, cy + 167 + k * 13, 0.3)], H.rng(43 + k), 2, 0.1), [70, 72, 100], { layers: 8, alpha: 0.1, amt: 0.08, seed: 46 + k });
242
+ exWash(c, deform([P(cx - 36, cy + 154, 0.2), P(cx - 27, cy + 154, 0.2), P(cx - 28, cy + 204, 0.2), P(cx - 36, cy + 200, 0.2)], H.rng(49), 2, 0.1), '#000', { layers: 6, alpha: 0.55, amt: 0.1, depth: 2, seed: 50, comp: 'destination-out' });
243
+ }, 2.8, 5, [1010, 150, 0.45], (c) => {
244
+ // faint pencil underdrawing left showing around the glass and base (drawn after the wash, so it isn't pooled)
245
+ pencil(c, arcPts(BCX, BCY, BRAD + 3, BRAD + 3, Math.PI * 0.7, Math.PI * 2.3), 1, 0.3, 1.1);
246
+ pencil(c, arcPts(BCX + 1.5, BCY - 1, BRAD + 1, BRAD + 2, Math.PI * 0.9, Math.PI * 1.9), 1, 0.18, 0.9);
247
+ pencil(c, [[BCX - 82, BCY + 82], [BCX - 55, BCY + 136], [BCX - 53, BCY + 154]], 1, 0.28); pencil(c, [[BCX + 82, BCY + 82], [BCX + 55, BCY + 136], [BCX + 53, BCY + 154]], 1, 0.28);
248
+ pencil(c, [[BCX, BCY - BRAD - 26], [BCX, BCY + 226]], 1, 0.1, 0.8); pencil(c, [[BCX - BRAD - 22, BCY], [BCX + BRAD + 22, BCY]], 1, 0.09, 0.8);
249
+ for (let k = 0; k < 3; k++) pencil(c, [[BCX - 58, BCY + 158 + k * 13], [BCX + 58, BCY + 154 + k * 13]], 1, 0.18, 1);
250
+ pencil(c, arcPts(BCX, BCY + 210, 24, 8, 0, Math.PI), 1, 0.22);
251
+ });
252
+ // --- cat & dog vignettes (painted big once, drawn small on the cards) ---
253
+ const animal = (dog) => mk(220, 220, (c) => {
254
+ const col = dog ? [150, 100, 60] : [236, 150, 60], cx = 110, cy = 120;
255
+ if (dog) {
256
+ exWash(c, blob(cx, cy, 62, 56, 51, 12, 0.6), col, { layers: 22, alpha: 0.07, amt: 0.1, seed: 52 });
257
+ exWash(c, blob(cx - 62, cy - 4, 20, 46, 53, 8, 0.6), [100, 66, 40], { layers: 16, alpha: 0.08, amt: 0.1, seed: 54 });
258
+ exWash(c, blob(cx + 62, cy - 4, 20, 46, 55, 8, 0.6), [100, 66, 40], { layers: 16, alpha: 0.08, amt: 0.1, seed: 56 });
259
+ exWash(c, blob(cx, cy + 26, 30, 22, 57, 8, 0.5), [236, 210, 170], { layers: 14, alpha: 0.08, amt: 0.1, seed: 58 });
260
+ } else {
261
+ exWash(c, [P(cx - 58, cy - 20, 0.4), P(cx - 50, cy - 84, 0.3), P(cx - 18, cy - 46, 0.4), P(cx + 18, cy - 46, 0.4), P(cx + 50, cy - 84, 0.3), P(cx + 58, cy - 20, 0.4), P(cx + 56, cy + 30, 0.5), P(cx, cy + 62, 0.5), P(cx - 56, cy + 30, 0.5)], col, { layers: 22, alpha: 0.07, amt: 0.08, seed: 61 });
262
+ c.save(); c.filter = 'blur(8px)'; c.globalAlpha = 0.35; c.fillStyle = 'rgb(200,90,50)'; c.beginPath(); c.ellipse(cx + 26, cy - 10, 26, 30, 0, 0, 7); c.fill(); c.restore();
263
+ }
264
+ c.save(); c.fillStyle = 'rgba(40,40,70,0.85)'; c.beginPath(); c.ellipse(cx - 22, cy - 2, 6, dog ? 7 : 9, 0, 0, 7); c.ellipse(cx + 22, cy - 2, 6, dog ? 7 : 9, 0, 0, 7); c.fill();
265
+ c.beginPath(); c.moveTo(cx - 7, cy + 20); c.lineTo(cx + 7, cy + 20); c.lineTo(cx, cy + 28); c.fill();
266
+ c.strokeStyle = 'rgba(40,40,70,0.5)'; c.lineWidth = 1.5;
267
+ if (!dog) for (const s of [-1, 1]) for (let k = 0; k < 3; k++) { c.beginPath(); c.moveTo(cx + s * 16, cy + 26 + k * 4); c.lineTo(cx + s * 52, cy + 18 + k * 9); c.stroke(); }
268
+ c.restore();
269
+ }, 2.6, 4);
270
+ C.cat = animal(false); C.dog = animal(true);
271
+ // speech bubble
272
+ C.bubble = mk(300, 170, (c) => {
273
+ exWash(c, deform([P(30, 70, 0.6), P(80, 18, 0.5), P(220, 16, 0.5), P(280, 70, 0.6), P(230, 128, 0.5), P(120, 132, 0.5), P(70, 166, 0.3), P(80, 124, 0.4)], H.rng(71), 2, 0.12), [236, 226, 200], { layers: 20, alpha: 0.07, amt: 0.08, seed: 72 });
274
+ }, 3, 4);
275
+ // a small bank of hand-lettered text, cached per string
276
+ C.text = new Map();
277
+ EXC = C;
278
+ return C;
279
+ }
280
+
281
+ // brush-lettered text with pooled edges; cached per (string,size,colour)
282
+ function wcText(c, str, x, y, size, col, { align = 'left', reveal = 1, font = '700', alpha = 1 } = {}) {
283
+ if (reveal <= 0 || !str) return;
284
+ const C = cachedExplainer(), key = str + '|' + size + '|' + col + '|' + font;
285
+ let cv = C.text.get(key);
286
+ if (!cv) {
287
+ const m = H.layer(4, 4).getContext('2d'); m.font = `${font} ${size}px "Caveat"`;
288
+ const w = Math.ceil(m.measureText(str).width) + 30, h = Math.ceil(size * 1.5);
289
+ cv = H.layer(w, h); const tc = cv.getContext('2d');
290
+ tc.font = `${font} ${size}px "Caveat"`; tc.fillStyle = col; tc.textBaseline = 'alphabetic';
291
+ tc.globalAlpha = 0.85; tc.fillText(str, 15, size * 1.08); tc.globalAlpha = 0.25; tc.fillText(str, 16.5, size * 1.08 + 1);
292
+ rimPool(cv, 2.4, 2.5);
293
+ cv.base = size * 1.08;
294
+ if (C.text.size > 300) C.text.clear();
295
+ C.text.set(key, cv);
296
+ }
297
+ const w = cv.width - 30, ox = align === 'center' ? -w / 2 : align === 'right' ? -w : 0;
298
+ c.save(); c.globalCompositeOperation = 'multiply'; c.globalAlpha = alpha;
299
+ const rw = Math.max(1, cv.width * cl(reveal));
300
+ c.drawImage(cv, 0, 0, rw, cv.height, x + ox - 15, y - cv.base, rw, cv.height);
301
+ c.restore();
302
+ }
303
+ // a loaded round brush pulled along a path: tapered ribbon + darker pooled edge, drawn on progressively
304
+ function wcStroke(c, pts, w, col, prog = 1, { head = true, alpha = 0.75, taper = true } = {}) {
305
+ if (prog <= 0) return;
306
+ const L = [], R = [], n = pts.length;
307
+ const N = Math.max(2, Math.ceil(n * cl(prog)));
308
+ for (let i = 0; i < N; i++) {
309
+ const a = pts[Math.max(0, i - 1)], b = pts[Math.min(n - 1, i + 1)], dx = b[0] - a[0], dy = b[1] - a[1], l = Math.hypot(dx, dy) || 1;
310
+ const u = i / (n - 1), ww = w * (taper ? 0.35 + 0.65 * Math.sin(Math.min(1, u * 1.15 + 0.1) * Math.PI * 0.95) : 0.8 + 0.2 * Math.sin(i * 0.7)) * 0.5;
311
+ L.push([pts[i][0] - dy / l * ww, pts[i][1] + dx / l * ww]); R.push([pts[i][0] + dy / l * ww, pts[i][1] - dx / l * ww]);
312
+ }
313
+ c.save(); c.globalCompositeOperation = 'multiply'; c.fillStyle = H.rgba(col, alpha); c.strokeStyle = H.rgba(col, 0.45); c.lineWidth = 1.2; c.lineJoin = 'round';
314
+ c.beginPath(); L.forEach(([x, y], i) => (i ? c.lineTo(x, y) : c.moveTo(x, y))); for (let i = R.length - 1; i >= 0; i--) c.lineTo(R[i][0], R[i][1]); c.closePath(); c.fill(); c.stroke();
315
+ if (head && prog >= 1) {
316
+ const a = pts[n - 3] || pts[0], b = pts[n - 1], ang = Math.atan2(b[1] - a[1], b[0] - a[0]);
317
+ c.lineCap = 'round'; c.strokeStyle = H.rgba(col, alpha); c.lineWidth = w * 0.55;
318
+ for (const s of [-1, 1]) { c.beginPath(); c.moveTo(b[0], b[1]); c.lineTo(b[0] - Math.cos(ang + s * 0.5) * w * 2.6, b[1] - Math.sin(ang + s * 0.5) * w * 2.6); c.stroke(); }
319
+ }
320
+ c.restore();
321
+ }
322
+ const bez = (p0, p1, p2, p3, n = 40) => { const o = []; for (let i = 0; i <= n; i++) { const u = i / n, a = 1 - u; o.push([a * a * a * p0[0] + 3 * a * a * u * p1[0] + 3 * a * u * u * p2[0] + u * u * u * p3[0], a * a * a * p0[1] + 3 * a * a * u * p1[1] + 3 * a * u * u * p2[1] + u * u * u * p3[1]]); } return o; };
323
+ // revealed wash: the cached painting appears as if flooding outward from its centre
324
+ function bloomIn(c, cv, x, y, p, w = cv.width, h = cv.height) {
325
+ if (p <= 0) return;
326
+ c.save(); c.globalCompositeOperation = 'multiply';
327
+ if (p >= 1) { c.drawImage(cv, x, y, w, h); c.restore(); return; }
328
+ const T = H.layer(Math.ceil(w), Math.ceil(h)), tc = T.getContext('2d');
329
+ tc.drawImage(cv, 0, 0, w, h);
330
+ tc.globalCompositeOperation = 'destination-in';
331
+ const r = Math.hypot(w, h) * 0.55 * H.ease.out(p), g = tc.createRadialGradient(w / 2, h / 2, r * 0.6, w / 2, h / 2, r + 1);
332
+ g.addColorStop(0, '#000'); g.addColorStop(1, 'rgba(0,0,0,0)'); tc.fillStyle = g; tc.fillRect(0, 0, w, h);
333
+ c.globalAlpha = Math.min(1, p * 1.5); c.drawImage(T, x, y); c.restore();
334
+ }
335
+ function pencil(c, pts, prog = 1, a = 0.4, w = 1.1) {
336
+ if (prog <= 0) return;
337
+ const n = Math.max(2, Math.ceil(pts.length * cl(prog)));
338
+ c.save(); c.strokeStyle = `rgba(70,68,72,${a})`; c.lineWidth = w; c.lineCap = 'round';
339
+ c.beginPath(); for (let i = 0; i < n; i++) i ? c.lineTo(pts[i][0], pts[i][1]) : c.moveTo(pts[i][0], pts[i][1]); c.stroke(); c.restore();
340
+ }
341
+ const fmt = (n) => Math.round(n).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
342
+ const INDIGO = [44, 52, 112], ALIZ = [190, 40, 60], SAP = [70, 130, 60], CERU = [60, 120, 190], SIENNA = [170, 90, 50];
343
+
344
+ function explainWatercolor(ctx, W, H_, t) {
345
+ const C = cachedExplainer();
346
+ // camera: data stop -> loop stop -> chart stop (a pan along the sheet is the scene transition)
347
+ const camX = 760 * ez((t - 6.0) / 0.9) + 1320 * ez((t - 10.5) / 0.9);
348
+ const cam = Math.round(camX);
349
+ ctx.drawImage(C.paper, cam, 0, W, H_, 0, 0, W, H_);
350
+ ctx.save(); ctx.translate(-cam, 0);
351
+
352
+ // ---------- backgrounds ----------
353
+ const vis = (x, w, p) => p > 0 && x + w > cam && x < cam + W; // skip (and don't build) washes that are off screen
354
+ if (vis(-60, 1300, win(t, 1.4, 2.8))) bloomIn(ctx, C.bgData, -60, 110, win(t, 1.4, 2.8));
355
+ if (vis(960, 1200, win(t, 5.9, 7.0))) bloomIn(ctx, C.bgLoop, 960, 0, win(t, 5.9, 7.0));
356
+ if (vis(2140, 1100, win(t, 10.4, 11.6))) bloomIn(ctx, C.bgChart, 2140, 60, win(t, 10.4, 11.6));
357
+
358
+ // ---------- the model ----------
359
+ const BX = 1010, BY = 150; // bulb canvas top-left in world space
360
+ if (vis(870, 640, win(t, 0.9, 2.3))) bloomIn(ctx, C.sky, 870, 30, win(t, 0.9, 2.3));
361
+ bloomIn(ctx, C.bulb, BX, BY, win(t, 0.8, 2.2));
362
+ const bcx = BX + 150, bcy = BY + 150;
363
+ if (t > 2.6) {
364
+ pencil(ctx, [[bcx - 40, BY + 380], [bcx - 120, BY + 420]], win(t, 2.6, 3.0), 0.45);
365
+ wcText(ctx, 'the model', bcx - 245, BY + 440, 38, 'rgb(80,78,84)', { reveal: win(t, 2.8, 3.3), font: '400' });
366
+ }
367
+ // three little dials (its "weights") on the screw base; they turn when it adjusts
368
+ const turn = ez((t - 8.7) / 0.7);
369
+ for (let k = 0; k < 3; k++) {
370
+ const x = bcx - 34 + k * 34, y = BY + 345, a = -2.2 + k * 0.9 + turn * (k === 1 ? -1.6 : 1.3);
371
+ if (t < 2.9) break;
372
+ ctx.save(); ctx.globalCompositeOperation = 'multiply';
373
+ ctx.fillStyle = 'rgba(236,226,200,0.9)'; ctx.strokeStyle = H.rgba(INDIGO, 0.7); ctx.lineWidth = 2;
374
+ ctx.beginPath(); ctx.arc(x, y, 12, 0, 7); ctx.fill(); ctx.stroke();
375
+ ctx.lineWidth = 3; ctx.lineCap = 'round'; ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x + Math.cos(a) * 10, y + Math.sin(a) * 10); ctx.stroke();
376
+ ctx.restore();
377
+ }
378
+ if (t > 8.6 && t < 9.6) { // a warm bloom of light as the knobs move
379
+ const k = Math.sin(win(t, 8.6, 9.6) * Math.PI);
380
+ ctx.save(); ctx.globalCompositeOperation = 'multiply'; ctx.filter = 'blur(14px)'; ctx.fillStyle = `rgba(246,190,80,${0.35 * k})`;
381
+ ctx.beginPath(); ctx.arc(bcx, bcy, 150, 0, 7); ctx.fill(); ctx.restore();
382
+ }
383
+
384
+ // ---------- beat 2: labelled examples flow into the model ----------
385
+ const flow = bez([-80, 470], [260, 600], [620, 560], [bcx - 70, bcy + 70], 60);
386
+ wcStroke(ctx, flow.slice(0, 57), 10, SIENNA, win(t, 2.4, 3.0), { alpha: 0.45 });
387
+ const at = (u) => { const f = u * (flow.length - 1), i = Math.min(flow.length - 2, Math.floor(f)), r = f - i; return [lerp(flow[i][0], flow[i + 1][0], r), lerp(flow[i][1], flow[i + 1][1], r)]; };
388
+ for (let i = 0; i < 26; i++) {
389
+ const s = 2.7 + i * 0.13, u = (t - s) / 1.5;
390
+ if (u <= 0 || u >= 1) continue;
391
+ const [x, y] = at(u), dog = H.rng(i * 17 + 3)() < 0.5, sc = u > 0.8 ? 1 - (u - 0.8) / 0.2 * 0.85 : 1;
392
+ const sz = 84 * sc;
393
+ ctx.save(); ctx.translate(x, y - 50 * sc); ctx.rotate(Math.sin(i * 2.1) * 0.12);
394
+ ctx.globalCompositeOperation = 'multiply'; ctx.fillStyle = 'rgba(250,247,240,1)';
395
+ ctx.drawImage(dog ? C.dog : C.cat, -sz / 2, -sz / 2, sz, sz);
396
+ ctx.strokeStyle = 'rgba(70,68,72,0.45)'; ctx.lineWidth = 1.2; ctx.strokeRect(-sz / 2, -sz / 2, sz, sz);
397
+ if (sc > 0.5) { ctx.globalCompositeOperation = 'source-over'; pencil(ctx, [[sz / 2 - 6, sz / 2 - 6], [sz / 2 + 8, sz / 2 + 8]], 1, 0.45); ctx.restore(); ctx.save(); ctx.translate(x, y - 50 * sc); ctx.rotate(Math.sin(i * 2.1) * 0.12);
398
+ wcText(ctx, dog ? 'dog' : 'cat', sz / 2 + 6, sz / 2 + 34, 30, dog ? 'rgb(120,70,40)' : 'rgb(200,100,40)'); }
399
+ ctx.restore();
400
+ }
401
+ // a counter, written and re-written as the examples pour in
402
+ if (t > 2.9) {
403
+ const k = H.ease.in(win(t, 3.0, 5.6)), n = Math.round(1e6 * k / 1000) * 1000;
404
+ const str = fmt(t > 5.6 ? 1e6 : n) + ' examples';
405
+ wcText(ctx, str, 120, 690, 66, `rgb(${INDIGO})`, { reveal: win(t, 2.9, 3.2) });
406
+ if (t > 5.6) wcStroke(ctx, bez([120, 704], [320, 716], [520, 704], [700, 708], 30), 7, SIENNA, win(t, 5.6, 5.95), { head: false, alpha: 0.6 });
407
+ }
408
+
409
+ // ---------- beat 3: guess -> check -> adjust ----------
410
+ const PX = 1710, PY = 300; // the new picture
411
+ if (t > 6.4) {
412
+ bloomIn(ctx, C.cat, PX, PY, win(t, 6.4, 7.0), 200, 200);
413
+ pencil(ctx, [[PX, PY], [PX + 200, PY], [PX + 200, PY + 200], [PX, PY + 200], [PX, PY]], win(t, 6.4, 6.9), 0.5);
414
+ wcText(ctx, 'new picture', PX + 100, PY + 240, 34, 'rgb(80,78,84)', { align: 'center', reveal: win(t, 6.7, 7.1), font: '400' });
415
+ }
416
+ const BBX = 1350, BBY = 70; // speech bubble
417
+ // Guess
418
+ wcStroke(ctx, bez([bcx + 70, bcy - 80], [bcx + 120, bcy - 160], [BBX - 10, BBY + 170], [BBX + 30, BBY + 120], 30), 8, INDIGO, win(t, 6.8, 7.2));
419
+ wcText(ctx, 'Guess', bcx + 30, bcy - 150, 40, `rgb(${INDIGO})`, { reveal: win(t, 6.9, 7.3) });
420
+ bloomIn(ctx, C.bubble, BBX, BBY, win(t, 7.0, 7.4));
421
+ const second = t > 9.4;
422
+ if (!second) wcText(ctx, 'dog?', BBX + 150, BBY + 92, 64, 'rgb(120,70,40)', { align: 'center', reveal: win(t, 7.1, 7.5) });
423
+ // Check: the true label is compared -> red cross + an emphatic circle
424
+ wcStroke(ctx, bez([PX + 40, PY - 10], [PX - 20, PY - 90], BBX + 330 > PX ? [BBX + 330, BBY + 30] : [BBX + 330, BBY + 30], [BBX + 290, BBY + 70], 30), 7, INDIGO, win(t, 7.5, 7.9));
425
+ wcText(ctx, 'Check', PX + 30, PY - 70, 40, `rgb(${INDIGO})`, { reveal: win(t, 7.6, 8.0) });
426
+ if (t > 7.9 && !second) {
427
+ wcStroke(ctx, [[BBX + 105, BBY + 45], [BBX + 195, BBY + 115]], 10, ALIZ, win(t, 7.9, 8.05), { head: false, alpha: 0.85 });
428
+ wcStroke(ctx, [[BBX + 195, BBY + 45], [BBX + 105, BBY + 115]], 10, ALIZ, win(t, 8.05, 8.2), { head: false, alpha: 0.85 });
429
+ const ring = []; for (let i = 0; i <= 50; i++) { const a = -0.6 + i / 50 * Math.PI * 2.15; ring.push([BBX + 150 + Math.cos(a) * 118, BBY + 78 + Math.sin(a) * 66]); }
430
+ wcStroke(ctx, ring, 6, ALIZ, win(t, 8.0, 8.45), { head: false, alpha: 0.7 });
431
+ wcText(ctx, "it's a cat!", PX + 100, PY + 285, 40, `rgb(${ALIZ})`, { align: 'center', reveal: win(t, 8.0, 8.4) });
432
+ }
433
+ // Adjust: the error travels back to the model
434
+ wcStroke(ctx, bez([BBX + 110, BBY + 150], [BBX + 60, BBY + 330], [bcx + 200, bcy + 220], [bcx + 80, bcy + 190], 36), 9, ALIZ, win(t, 8.25, 8.8), { alpha: 0.7 });
435
+ wcText(ctx, 'Adjust', BBX + 20, BBY + 330, 40, `rgb(${ALIZ})`, { reveal: win(t, 8.5, 8.9) });
436
+ if (second) {
437
+ wcText(ctx, 'cat', BBX + 135, BBY + 92, 64, 'rgb(200,100,40)', { align: 'center', reveal: win(t, 9.4, 9.7) });
438
+ wcStroke(ctx, [[BBX + 190, BBY + 72], [BBX + 205, BBY + 92], [BBX + 240, BBY + 40]], 9, SAP, win(t, 9.7, 9.95), { head: false, alpha: 0.85 });
439
+ }
440
+
441
+ // ---------- beat 4: progress chart ----------
442
+ const CX0 = 2260, CY0 = 560, CW = 760, CH = 360;
443
+ if (t > 10.6) {
444
+ pencil(ctx, [[CX0, CY0 - CH - 20], [CX0, CY0], [CX0 + CW + 20, CY0]], win(t, 10.7, 11.2), 0.5, 1.4);
445
+ wcText(ctx, 'training rounds', CX0 + CW / 2, CY0 + 50, 34, 'rgb(80,78,84)', { align: 'center', reveal: win(t, 11.0, 11.4), font: '400' });
446
+ const N = 24, pts = [];
447
+ for (let i = 0; i <= N; i++) { const acc = 61 + 36 * (1 - Math.exp(-i / 5.5)) / (1 - Math.exp(-N / 5.5)) + (i > 0 && i < N ? Math.sin(i * 2.7) * 1.6 : 0); pts.push([CX0 + i / N * CW, CY0 - (acc - 50) / 50 * CH, acc]); }
448
+ const pr = win(t, 11.2, 12.7), line = [];
449
+ for (let i = 0; i < pts.length - 1; i++) for (let k = 0; k < 4; k++) { const u = k / 4; line.push([lerp(pts[i][0], pts[i + 1][0], u), lerp(pts[i][1], pts[i + 1][1], u)]); }
450
+ line.push(pts[N]);
451
+ wcStroke(ctx, line, 9, CERU, pr, { head: false, alpha: 0.8, taper: false });
452
+ const cur = Math.min(N, Math.floor(pr * N));
453
+ ctx.save(); ctx.globalCompositeOperation = 'multiply'; ctx.fillStyle = H.rgba(INDIGO, 0.75);
454
+ for (let i = 0; i <= cur; i += 3) { ctx.beginPath(); ctx.arc(pts[i][0], pts[i][1], 6, 0, 7); ctx.fill(); }
455
+ ctx.restore();
456
+ const acc = Math.round(t < 11.2 ? 61 : t > 12.7 ? 97 : lerp(61, 97, H.ease.out(pr)));
457
+ wcText(ctx, 'Accuracy', CX0 + 20, CY0 - CH - 40, 50, `rgb(${INDIGO})`, { reveal: win(t, 10.9, 11.3) });
458
+ wcText(ctx, acc + '%', CX0 + 230, CY0 - CH - 40, 70, acc >= 97 ? `rgb(${ALIZ})` : `rgb(${INDIGO})`, { reveal: win(t, 11.1, 11.3) });
459
+ if (t > 12.7) {
460
+ const ring = []; for (let i = 0; i <= 50; i++) { const a = -0.4 + i / 50 * Math.PI * 2.15; ring.push([CX0 + 290 + Math.cos(a) * 100, CY0 - CH - 62 + Math.sin(a) * 52]); }
461
+ wcStroke(ctx, ring, 6, ALIZ, win(t, 12.7, 13.1), { head: false, alpha: 0.7 });
462
+ const ring2 = []; for (let i = 0; i <= 40; i++) { const a = i / 40 * Math.PI * 2.1; ring2.push([pts[N][0] + Math.cos(a) * 24, pts[N][1] + Math.sin(a) * 24]); }
463
+ wcStroke(ctx, ring2, 5, ALIZ, win(t, 12.9, 13.2), { head: false, alpha: 0.7 });
464
+ }
465
+ wcText(ctx, '61%', CX0 - 70, pts[0][1] + 12, 30, 'rgb(80,78,84)', { reveal: win(t, 11.2, 11.5), font: '400' });
466
+ }
467
+ ctx.restore();
468
+
469
+ // ---------- beat 5: takeaway (screen space) ----------
470
+ if (t > 13.2) {
471
+ wcText(ctx, 'More examples → better guesses', 640, 690, 62, `rgb(${INDIGO})`, { align: 'center', reveal: ez((t - 13.2) / 0.7) });
472
+ }
473
+ // ---------- beat 1: hook, then it becomes the corner header ----------
474
+ {
475
+ const k = ez((t - 1.5) / 0.8), s = lerp(1, 0.42, k);
476
+ const m = H.layer(4, 4).getContext('2d'); m.font = '700 110px "Caveat"'; const tw = m.measureText('How does AI learn?').width;
477
+ const x = lerp(640 - tw / 2, 40, k), y = lerp(370, 66, k);
478
+ ctx.save(); ctx.translate(x, y); ctx.scale(s, s);
479
+ wcText(ctx, 'How does AI learn?', 0, 0, 110, `rgb(${INDIGO})`, { reveal: win(t, 0.1, 1.1) });
480
+ ctx.restore();
481
+ }
482
+ }
483
+
484
+ registerStyle({
485
+ id: 'watercolor',
486
+ name: 'Watercolor Wash',
487
+ category: 'Painterly',
488
+ description: 'Transparent pigment glazed in dozens of ragged low-opacity layers on cold-press paper: dark pooled edges, wet-in-wet bleeds, cauliflower blooms, granulation and untouched white paper for the lights, over a faint pencil sketch.',
489
+ motion: 'Each wash floods in from its pencil outline, edges darken as the water dries and blooms creep outward; the title is brushed in stroke by stroke.',
490
+ fonts: ['700 132px "Caveat"', '400 30px "Caveat"', '700 40px "Caveat"'],
491
+ duration: 6,
492
+ frameT: 5.9,
493
+ readsPixels: true,
494
+ explainerDuration: 15,
495
+ explainerNote: 'One long sketchbook sheet the camera pans along; arrows are loaded round-brush strokes with pooled edges, labels and the counter are brush-lettered and re-written as they change, and red alizarin circles do the emphasis.',
496
+ explainer(ctx, W, H_, t) { explainWatercolor(ctx, W, H_, t); },
497
+ explainerSound(k) {
498
+ // all times copied from explainWatercolor() above (its win(t, a, b) windows)
499
+ const D = 15;
500
+ // first time f(t) >= v (1 ms scan)
501
+ const when = (f, v, a, b) => { for (let t = a; t <= b; t += 0.001) if (f(t) >= v) return t; return b; };
502
+ // a loaded round brush on wet paper: soft wet touch-down, then the hair dragging through water
503
+ const brush = (a, b, g = 1, pan = 0, minor = true) => {
504
+ k.noise(a, { dur: 0.05, color: 'pink', filter: 'lowpass', f: 700, gain: 0.16 * g, a: 0.008, pan, minor });
505
+ k.play('stroke', a, { material: 'brush', dur: b - a, gain: 1.5 * g, pan, minor });
506
+ };
507
+ // brush lettering: one wet stroke per word, timed by character position like the reveal
508
+ const letter = (s, a, b, g = 0.7, pan = 0) => { const re = /\S+/g; let m;
509
+ while ((m = re.exec(s))) brush(a + (b - a) * m.index / s.length, a + (b - a) * (m.index + m[0].length) / s.length, g, pan); };
510
+ // a wash flooding outward from its pencil line: a slow, low wet swell
511
+ const wash = (a, b, g = 1, pan = 0, minor = true) => {
512
+ const d = b - a;
513
+ k.noise(a, { dur: d, color: 'pink', filter: 'bandpass', f: [[0, 260], [d * 0.45, 820], [d, 420]], q: 0.7, gain: 0.09 * g, a: d * 0.4, pan, minor, verb: 0.1 });
514
+ k.noise(a + 0.03, { dur: d * 0.7, color: 'brown', filter: 'lowpass', f: 380, gain: 0.08 * g, a: d * 0.3, pan, minor });
515
+ };
516
+ // a single drop of water landing in the wash (low, so it never chirps)
517
+ const drop = (t, g = 1, pan = 0) => k.tone(t, { f: [[0, 330], [0.05, 560]], dur: 0.08, gain: 0.07 * g, a: 0.003, pan, minor: true, verb: 0.2 });
518
+ // brush swirled in the rinse jar and tapped on the rim: the sheet's own scene change
519
+ const rinse = (t, d, pan = 0) => {
520
+ for (let i = 0; i < 4; i++) { const ti = t + i * d / 5; k.noise(ti, { dur: d / 2.5, color: 'pink', filter: 'bandpass', f: [[0, 420], [d / 5, 1100], [d / 2.5, 520]], q: 1.6, gain: 0.13, a: d / 8, pan: pan + (i % 2 ? 0.2 : -0.2) }); }
521
+ drop(t + d * 0.35, 1.1, pan); drop(t + d * 0.62, 0.8, pan);
522
+ k.play('tock', t + d, { f: 900, gain: 0.45, pan });
523
+ };
524
+ // dabbing the counter: a soft brush tip on paper, no click
525
+ const dab = (t, g = 1, pan = 0) => { k.withMinor(() => { k.noise(t, { dur: 0.035, color: 'pink', filter: 'bandpass', f: 1250, q: 1.1, gain: 0.26 * g, a: 0.004, pan }); k.tone(t, { f: 190, dur: 0.05, gain: 0.07 * g, pan }); }); };
526
+ // ticks when the shown value changes, at most 12/s
527
+ const counter = (val, a, b, g, pan) => { let last = val(a), lastT = -1;
528
+ for (let t = a; t <= b; t += 1 / 240) { const v = val(t); if (v !== last && t - lastT >= 1 / 12) { dab(t, g, pan); lastT = t; } last = v; } };
529
+
530
+ // ---- beds: a quiet room and a soft painterly pad (F: Fmaj7, Dm7, Bbmaj7, Fadd9; one bar = 3.75 s)
531
+ k.bed('room', 0, D, { gain: 0.45 });
532
+ k.music('pad', 0, D, { bpm: 64, gain: 0.35, chords: [['F3', 'A3', 'C4', 'E4'], ['D3', 'F3', 'A3', 'C4'], ['Bb2', 'D3', 'F3', 'A3'], ['F3', 'C4', 'G4', 'A4']] });
533
+
534
+ // ---- 1 HOOK: title brush-lettered 0.1-1.1, then it slides into the corner 1.5-2.3
535
+ letter('How does AI learn?', 0.1, 1.1, 0.95);
536
+ k.noise(1.5, { dur: 0.8, color: 'pink', filter: 'bandpass', f: [[0, 300], [0.8, 700]], q: 0.7, gain: 0.07, a: 0.3, minor: true }); // soft slide
537
+ wash(0.8, 2.2, 1.0, 0.6, false); // the bulb blooms in
538
+ wash(1.4, 2.8, 0.8, -0.3); // ochre ground floods under the data
539
+
540
+ // ---- 2 DATA
541
+ brush(2.4, 3.0, 1.1, -0.4, false); // sienna flow arrow
542
+ k.play('stroke', 2.6, { material: 'pencil', dur: 0.4, gain: 0.4, pan: 0.4, minor: true }); // pencil leader
543
+ brush(3.02, 3.3, 0.8, -0.5); // counter lettered in under the stream (reveal 2.9-3.2, after the arrow lifts)
544
+ // cards float down the stream: a gentle trickle under them, a drop now and then as one sinks into the bulb
545
+ k.noise(2.7, { dur: 3.6, color: 'pink', filter: 'bandpass', f: 700, q: 0.6, gain: 0.05, a: 0.6, hold: 2.4, pan: -0.2, minor: true });
546
+ for (let i = 0; i < 26; i += 4) drop(2.7 + i * 0.13 + 1.5, 0.8, 0.5);
547
+ // counter re-written: n = 1e6 * ease.in(win(3.0, 5.6)), rounded to thousands
548
+ counter((t) => Math.round(1e6 * H.ease.in(win(t, 3.0, 5.6)) / 1000), 3.0, 5.58, 1, -0.5);
549
+ k.play('tock', 5.6, { f: 520, gain: 0.55, pan: -0.5 }); // 1,000,000 lands
550
+ brush(5.6, 5.95, 1.1, -0.4, false); // sienna underline
551
+
552
+ // ---- pan to the loop (camera 6.0-6.9): rinse the brush, new blue wash floods in
553
+ rinse(5.95, 0.5, 0.2);
554
+ wash(5.9, 7.0, 1.0, 0.3, false);
555
+
556
+ // ---- 3 GUESS -> CHECK -> ADJUST
557
+ k.play('stroke', 6.4, { material: 'pencil', dur: 0.5, gain: 0.7, pan: 0.6, minor: true });
558
+ brush(6.8, 7.2, 1.0, 0.0, false); // Guess arrow
559
+ letter('dog?', 7.1, 7.5, 0.8, 0.2);
560
+ brush(7.5, 7.9, 1.0, 0.5, false); // Check arrow
561
+ // the wrong guess: two hard alizarin slashes and a low, soft "nope"
562
+ brush(7.9, 8.05, 1.9, 0.2, false); brush(8.05, 8.2, 1.9, 0.2, false);
563
+ k.tone(7.9, { f: 'A3', type: 'triangle', dur: 0.22, gain: 0.2, a: 0.01, hold: 0.08, verb: 0.2, pan: 0.2 });
564
+ k.tone(8.08, { f: 'F3', type: 'triangle', dur: 0.4, gain: 0.2, a: 0.01, hold: 0.12, verb: 0.2, pan: 0.2 });
565
+ k.play('thud', 7.9, { f: 120, gain: 0.35, pan: 0.2 });
566
+ brush(8.25, 8.8, 1.5, 0.0, false); // Adjust arrow runs back to the model
567
+ // three dials on the screw base turn (ez over 8.7-9.4): soft wooden detents
568
+ for (let s = 1; s <= 3; s++) k.play('tock', when((t) => ez((t - 8.7) / 0.7) * 4, s, 8.7, 9.4), { f: 640 + s * 20, gain: 0.45, pan: -0.2, minor: true });
569
+ letter('cat', 9.4, 9.7, 0.8, 0.2);
570
+ brush(9.7, 9.95, 1.2, 0.2, false); // sap-green check mark
571
+ k.play('success', 9.95, { f: 'A5', gain: 0.48, pan: 0.2 });
572
+
573
+ // ---- pan to the chart (camera 10.5-11.4)
574
+ rinse(10.45, 0.5, -0.2);
575
+ wash(10.4, 11.6, 1.0, 0.2, false);
576
+
577
+ // ---- 4 PROGRESS
578
+ k.play('stroke', 10.7, { material: 'pencil', dur: 0.5, gain: 0.5, pan: -0.4, minor: true }); // pencil axes
579
+ letter('Accuracy', 10.9, 11.3, 0.5, -0.4);
580
+ brush(11.2, 12.7, 0.55, 0.1); // cerulean line pulled along
581
+ // % counter: lerp(61, 97, ease.out(pr)), pr = win(11.2, 12.7)
582
+ const acc = (t) => Math.round(61 + 36 * H.ease.out(win(t, 11.2, 12.7)));
583
+ const t97 = when(acc, 97, 11.2, 12.7);
584
+ counter(acc, 11.2, t97 - 0.05, 1, -0.3);
585
+ // 97% lands and turns alizarin red: the biggest hit, a deep wet bloom with a warm bell chord
586
+ k.play('thud', t97, { f: 95, gain: 0.8, pan: -0.3 });
587
+ k.play('impact', t97, { gain: 0.55, pan: -0.3 });
588
+ k.play('ding', t97, { f: 'C5', gain: 0.5 });
589
+ ['F4', 'A5'].forEach((f, i) => k.tone(t97 + 0.03 + i * 0.03, { f, dur: 1.3, gain: 0.08, verb: 0.3, pan: (i - 0.5) * 0.5 }));
590
+ wash(t97, t97 + 0.9, 0.9, -0.3);
591
+ brush(12.7, 13.1, 1.4, -0.3, false); // red ring around 97%
592
+ brush(12.9, 13.2, 0.9, 0.6); // small ring on the last point
593
+
594
+ // ---- 5 TAKEAWAY (reveal 13.2-13.9), then a resolving chord
595
+ letter('More examples → better guesses', 13.2, 13.9, 1.1);
596
+ k.play('ding', 13.95, { f: 'F4', gain: 0.42 }); // resolving chord, rolled upward
597
+ ['A4', 'C5', 'F5'].forEach((f, i) => k.tone(14.01 + i * 0.06, { f, dur: 1.2, gain: 0.07 - i * 0.01, verb: 0.3, pan: (i - 1) * 0.3 }));
598
+ },
599
+ draw(ctx, W, H_, t) {
600
+ const R = H.rng(1207);
601
+ // timeline: each wash has its own local progress; `cur` is the wash being painted right now
602
+ const ph = (a, b) => H.ease.inOut(H.clamp((t - a) / (b - a)));
603
+ let cur = 1;
604
+ const mottle = makeMottle(W, H_, 77);
605
+ const L = H.layer(W, H_), lx = L.getContext('2d');
606
+ const B = H.layer(W, H_), bx = B.getContext('2d');
607
+
608
+ // ---------- 1. paper ----------
609
+ ctx.fillStyle = `rgb(${PAPER})`; ctx.fillRect(0, 0, W, H_);
610
+
611
+ // ---------- 2. pencil underdrawing ----------
612
+ const cx = 420, cy = 285, rad = 168;
613
+ const pr = H.rng(31);
614
+ let pencilK = 0;
615
+ function pencilLine(pts, a = 0.28, w = 1.1, passes = 2) {
616
+ const reveal = H.clamp((t - 0.05 - pencilK++ * 0.055) / 0.45);
617
+ for (let p = 0; p < passes; p++) {
618
+ ctx.save(); ctx.strokeStyle = `rgba(70,68,72,${a * (0.6 + pr() * 0.5)})`; ctx.lineWidth = w * (0.7 + pr() * 0.6);
619
+ ctx.lineCap = 'round'; ctx.beginPath();
620
+ const ox = pr.gauss() * 1.5, oy = pr.gauss() * 1.5;
621
+ const lim = reveal * (pts.length - 1);
622
+ pts.forEach((q, i) => {
623
+ let x = q[0] + ox + pr.gauss() * 0.5, y = q[1] + oy + pr.gauss() * 0.5;
624
+ if (i > lim + 1) return;
625
+ if (i > lim) { const f = lim - (i - 1), qp = pts[i - 1]; x = qp[0] + (x - qp[0]) * f; y = qp[1] + (y - qp[1]) * f; }
626
+ i ? ctx.lineTo(x, y) : ctx.moveTo(x, y);
627
+ });
628
+ if (reveal > 0) ctx.stroke(); ctx.restore();
629
+ }
630
+ }
631
+ const arcPts = (x, y, r1, r2, a0, a1, n = 60) => { const o = []; for (let i = 0; i <= n; i++) { const a = a0 + (a1 - a0) * i / n; o.push([x + Math.cos(a) * r1, y + Math.sin(a) * r2]); } return o; };
632
+ // bulb outline + construction lines
633
+ pencilLine(arcPts(cx, cy, rad + 2, rad + 2, Math.PI * 0.72, Math.PI * 2.28), 0.3, 1.1, 3);
634
+ pencilLine([[cx - 125, cy + 112], [cx - 82, cy + 205], [cx - 78, cy + 228]], 0.3);
635
+ pencilLine([[cx + 125, cy + 112], [cx + 82, cy + 205], [cx + 78, cy + 228]], 0.3);
636
+ pencilLine([[cx, cy - rad - 40], [cx, cy + 330]], 0.12, 0.8, 1);
637
+ pencilLine([[cx - rad - 30, cy], [cx + rad + 30, cy]], 0.1, 0.8, 1);
638
+ for (let k = 0; k < 4; k++) pencilLine([[cx - 80, cy + 232 + k * 17], [cx + 80, cy + 226 + k * 17]], 0.24, 1, 1);
639
+ pencilLine(arcPts(cx, cy + 315, 36, 12, 0, Math.PI), 0.22);
640
+ // sprout sketch
641
+ pencilLine([[cx - 4, cy + 210], [cx - 10, cy + 120], [cx + 6, cy + 40], [cx + 2, cy - 30]], 0.25, 1, 2);
642
+ pencilLine(arcPts(cx - 62, cy + 10, 62, 28, Math.PI * 0.95, Math.PI * 2.05), 0.2);
643
+ pencilLine(arcPts(cx + 60, cy - 46, 60, 26, Math.PI * 0.95, Math.PI * 2.05), 0.2);
644
+ // horizon + table edge
645
+ pencilLine([[40, 548], [1240, 552]], 0.13, 0.9, 1);
646
+ // lettering guides
647
+ pencilLine([[760, 316], [1210, 312]], 0.13, 0.8, 1);
648
+ pencilLine([[760, 448], [1210, 444]], 0.13, 0.8, 1);
649
+
650
+ // ---------- wash machinery ----------
651
+ // finish(): pool pigment at the drying edges (alpha - blurred alpha), then glaze onto paper with multiply
652
+ function finish(bb, pool = 1.6, blurPx = 7, glaze = 1) {
653
+ if (cur <= 0) { lx.clearRect(0, 0, W, H_); return; }
654
+ pool *= cur * cur; // edges darken only as the water dries
655
+ const [x0, y0, x1, y1] = bb.map(Math.round);
656
+ const w = Math.max(1, x1 - x0), h = Math.max(1, y1 - y0);
657
+ lx.globalCompositeOperation = 'destination-in'; lx.globalAlpha = 1; lx.drawImage(mottle, 0, 0); lx.globalCompositeOperation = 'source-over';
658
+ bx.clearRect(0, 0, W, H_); bx.filter = `blur(${blurPx}px)`; bx.drawImage(L, x0 - 20, y0 - 20, w + 40, h + 40, x0 - 20, y0 - 20, w + 40, h + 40); bx.filter = 'none';
659
+ const a = lx.getImageData(x0, y0, w, h), b = bx.getImageData(x0, y0, w, h), d = a.data, e = b.data;
660
+ for (let i = 3; i < d.length; i += 4) {
661
+ const la = d[i], rim = la - e[i];
662
+ if (rim > 0) d[i] = Math.min(255, la + rim * pool);
663
+ }
664
+ lx.putImageData(a, x0, y0);
665
+ ctx.save(); ctx.globalCompositeOperation = 'multiply'; ctx.globalAlpha = glaze; ctx.drawImage(L, 0, 0); ctx.restore();
666
+ lx.clearRect(0, 0, W, H_);
667
+ }
668
+ // layered polygon wash into the working layer
669
+ function wash(base, color, { layers = 36, alpha = 0.045, amt = 0.32, depth = 3, seed = 1, comp = 'source-over' } = {}) {
670
+ const r = H.rng(seed);
671
+ lx.save(); lx.globalCompositeOperation = comp; lx.fillStyle = Array.isArray(color) ? H.rgba(color, 1) : color;
672
+ const n = Math.round(layers * (comp === 'source-over' ? Math.min(1, 0.25 + cur) : 1));
673
+ let cxm = 0, cym = 0; base.forEach((q) => { cxm += q.x; cym += q.y; }); cxm /= base.length; cym /= base.length;
674
+ const sc = comp === 'source-over' ? 0.55 + 0.45 * H.ease.out(cur) : 1;
675
+ const b2 = sc === 1 ? base : base.map((q) => ({ x: cxm + (q.x - cxm) * sc, y: cym + (q.y - cym) * sc, v: q.v }));
676
+ for (let i = 0; i < n; i++) { lx.globalAlpha = alpha * (0.6 + r() * 0.8) * (comp === 'source-over' ? Math.min(1, cur * 1.6) : 1); poly(lx, deform(b2, r, depth, amt)); lx.fill(); }
677
+ lx.restore();
678
+ }
679
+ const shape = (pts, seed, depth = 3, amt = 0.4) => deform(pts, H.rng(seed), depth, amt);
680
+ // cauliflower bloom: a ragged hole lifted out of the damp wash
681
+ function bloom(x, y, r0, seed, strength = 0.55) {
682
+ const r = H.rng(seed);
683
+ if (cur <= 0) return;
684
+ const base = shape(circlePts(x, y, r0, r0 * (0.8 + r() * 0.4), 9, r, 1.4), seed + 1, 3, 0.5);
685
+ const k = H.clamp((cur - 0.45) * 1.8); if (k <= 0) return;
686
+ wash(base, '#000', { layers: 14, alpha: strength / 6 * k, amt: 0.4, depth: 2, seed: seed + 2, comp: 'destination-out' });
687
+ }
688
+
689
+ // ---------- 3. sky: vignetted wash, negatively painted around the bulb ----------
690
+ cur = ph(0.9, 2.3);
691
+ const skyBase = shape([P(70, 120, 1.6), P(250, 40, 1.2), P(520, 22, 1.5), P(760, 70, 1.3), P(820, 200, 1.6), P(780, 400, 1.4), P(660, 510, 1.2), P(400, 540, 1.0), P(130, 520, 1.6), P(40, 330, 1.4)], 5, 3, 0.28);
692
+ wash(skyBase, [126, 178, 214], { layers: 34, alpha: 0.05, amt: 0.12, depth: 4, seed: 11 });
693
+ // wet-in-wet: ultramarine + a little rose dropped in, softened by blur
694
+ lx.save(); lx.filter = 'blur(14px)';
695
+ const dr = H.rng(19);
696
+ for (let k = 0; k < 7; k++) {
697
+ const x = dr.range(90, 720), y = dr.range(60, 300), rr = dr.range(60, 130);
698
+ lx.globalAlpha = (0.18 + dr() * 0.12) * H.clamp(cur * 1.5 - 0.3); lx.fillStyle = k % 3 === 2 ? 'rgb(200,120,150)' : 'rgb(70,82,170)';
699
+ poly(lx, shape(circlePts(x, y, rr, rr * 0.7, 8, dr, 1.2), 40 + k, 3, 0.45)); lx.fill();
700
+ }
701
+ lx.restore();
702
+ // lift the glow halo around the bulb (negative painting) — crisp ragged edge
703
+ const halo = shape(circlePts(cx + 6, cy + 10, rad + 58, rad + 62, 22, R, 1.0), 23, 4, 0.18);
704
+ wash(halo, '#000', { layers: 10, alpha: 0.35, amt: 0.12, depth: 2, seed: 24, comp: 'destination-out' });
705
+ wash(shape(circlePts(cx, cy + 4, rad + 34, rad + 36, 12, R, 1.0), 25, 3, 0.25), '#000', { layers: 10, alpha: 0.5, amt: 0.1, depth: 2, seed: 26, comp: 'destination-out' });
706
+ bloom(700, 160, 40 + 16 * H.smooth(2.2, 6, t), 301, 0.75); bloom(170, 390, 44, 311, 0.7); bloom(640, 420, 34, 321, 0.6); bloom(110, 170, 30, 351, 0.6);
707
+ finish([0, 0, 960, 600], 2.2, 8, 0.95);
708
+
709
+ // second glaze of sky (wet on dry) only on top region -> darker overlapped band
710
+ cur = ph(1.7, 2.7);
711
+ const sky2 = shape([P(120, 70, 1.4), P(420, 30, 1.2), P(700, 50, 1.4), P(790, 140, 1.6), P(660, 200, 1.4), P(560, 150, 1.0), P(250, 190, 1.4), P(90, 230, 1.6)], 7, 3, 0.3);
712
+ wash(sky2, [64, 92, 168], { layers: 26, alpha: 0.045, amt: 0.12, depth: 4, seed: 12 });
713
+ wash(halo, '#000', { layers: 6, alpha: 0.6, amt: 0.1, depth: 2, seed: 27, comp: 'destination-out' });
714
+ bloom(330, 100, 36, 331, 0.75);
715
+ finish([0, 0, 960, 320], 2.6, 6, 0.8);
716
+
717
+ // ---------- 4. table / ground: ochre wash + violet cast shadow ----------
718
+ cur = ph(1.5, 2.5);
719
+ const ground = shape([P(60, 556, 1.2), P(400, 540, 0.6), P(780, 546, 0.8), P(930, 560, 1.6), P(880, 640, 1.8), P(500, 668, 1.4), P(140, 650, 1.6), P(30, 610, 1.4)], 9, 3, 0.3);
720
+ wash(ground, [214, 168, 92], { layers: 28, alpha: 0.05, amt: 0.25, seed: 13 });
721
+ lx.save(); lx.filter = 'blur(10px)'; lx.globalAlpha = 0.22 * cur; lx.fillStyle = 'rgb(190,110,70)';
722
+ poly(lx, shape(circlePts(700, 600, 160, 40, 8, R), 50, 3, 0.4)); lx.fill(); lx.restore();
723
+ finish([0, 500, 980, 700], 2.0, 6, 0.9);
724
+ cur = ph(2.4, 3.0);
725
+ const shadow = shape(circlePts(cx + 70, 572, 170, 26, 12, R, 1.0), 14, 3, 0.25);
726
+ wash(shadow, [120, 110, 170], { layers: 22, alpha: 0.035, amt: 0.2, seed: 15 });
727
+ finish([200, 520, 720, 620], 2.4, 5, 0.85);
728
+
729
+ // ---------- 5. bulb glass: aureolin glow, wet-in-wet warm core, white paper highlight ----------
730
+ const globe = [];
731
+ for (let i = 0; i <= 26; i++) { const a = Math.PI * 0.72 + (Math.PI * 1.56) * i / 26; globe.push(P(cx + Math.cos(a) * rad, cy + Math.sin(a) * rad, 0.5)); }
732
+ globe.push(P(cx + 82, cy + 205, 0.4), P(cx + 78, cy + 226, 0.3), P(cx - 78, cy + 226, 0.3), P(cx - 82, cy + 205, 0.4));
733
+ cur = ph(2.1, 3.1);
734
+ const globeB = shape(globe, 61, 2, 0.12);
735
+ wash(globeB, [250, 214, 90], { layers: 30, alpha: 0.05, amt: 0.08, seed: 16 });
736
+ lx.save(); lx.filter = 'blur(18px)';
737
+ lx.globalAlpha = 0.45 * H.clamp(cur * 1.4 - 0.3); lx.fillStyle = 'rgb(246,150,60)';
738
+ poly(lx, shape(circlePts(cx + 10, cy + 40, 95, 105, 9, R, 1.2), 62, 3, 0.4)); lx.fill();
739
+ lx.globalAlpha = 0.25 * H.clamp(cur * 1.4 - 0.4); lx.fillStyle = 'rgb(225,90,90)';
740
+ poly(lx, shape(circlePts(cx + 40, cy + 110, 60, 50, 8, R, 1.2), 63, 3, 0.4)); lx.fill();
741
+ lx.restore();
742
+ // white highlight crescent left unpainted
743
+ // lifted highlights: two broken crescent marks, soft on one side
744
+ const crescent = (a0, a1, r0, r1, seed) => {
745
+ const c = [];
746
+ for (let i = 0; i <= 10; i++) { const a = a0 + (a1 - a0) * i / 10; c.push(P(cx + Math.cos(a) * r0, cy + Math.sin(a) * r0, 0.7)); }
747
+ for (let i = 10; i >= 0; i--) { const a = a0 + 0.04 + (a1 - a0 - 0.08) * i / 10, rr = r1 + Math.sin(i / 10 * Math.PI) * -14; c.push(P(cx + 6 + Math.cos(a) * rr, cy + 6 + Math.sin(a) * rr, 0.7)); }
748
+ wash(shape(c, seed, 3, 0.22), '#000', { layers: 16, alpha: 0.17, amt: 0.25, depth: 3, seed: seed + 1, comp: 'destination-out' });
749
+ };
750
+ crescent(Math.PI * 1.06, Math.PI * 1.27, rad - 24, rad - 40, 64);
751
+ crescent(Math.PI * 1.32, Math.PI * 1.42, rad - 22, rad - 34, 72);
752
+ wash(shape(circlePts(cx + 112, cy - 92, 9, 13, 8, R), 66, 2, 0.2), '#000', { layers: 6, alpha: 0.8, amt: 0.1, depth: 2, seed: 67, comp: 'destination-out' });
753
+ bloom(cx - 40, cy + 120, 28, 341, 0.45);
754
+ finish([cx - rad - 20, cy - rad - 20, cx + rad + 20, cy + 240], 2.8, 6, 1);
755
+ // cool reflected light on the shadow side of the glass
756
+ const refl = [];
757
+ for (let i = 0; i <= 16; i++) { const a = -Math.PI * 0.32 + Math.PI * 0.62 * i / 16; refl.push(P(cx + Math.cos(a) * (rad - 2), cy + Math.sin(a) * (rad - 2), 0.5)); }
758
+ for (let i = 16; i >= 0; i--) { const a = -Math.PI * 0.22 + Math.PI * 0.5 * i / 16; refl.push(P(cx + Math.cos(a) * (rad - 30), cy + Math.sin(a) * (rad - 30), 0.9)); }
759
+ cur = ph(2.8, 3.3);
760
+ wash(shape(refl, 68, 3, 0.2), [140, 175, 215], { layers: 18, alpha: 0.035, amt: 0.18, seed: 69 });
761
+ finish([cx, cy - rad, cx + rad + 10, cy + rad], 2.4, 5, 0.8);
762
+
763
+ // ---------- 6. sprout: sap green leaves, wet-in-wet yellow, veins ----------
764
+ function leaf(x0, y0, ang, len, wid, seed) {
765
+ const pts = [], ca = Math.cos(ang), sa = Math.sin(ang);
766
+ for (let i = 0; i <= 10; i++) { const u = i / 10, w = Math.sin(u * Math.PI) * wid * (1 - u * 0.25); pts.push([u * len, -w]); }
767
+ for (let i = 9; i >= 1; i--) { const u = i / 10, w = Math.sin(u * Math.PI) * wid * 0.85 * (1 - u * 0.25); pts.push([u * len, w]); }
768
+ return shape(pts.map(([u, v]) => P(x0 + u * ca - v * sa, y0 + u * sa + v * ca, 0.5)), seed, 2, 0.12);
769
+ }
770
+ cur = ph(2.9, 3.7);
771
+ // stem
772
+ lx.save(); lx.strokeStyle = 'rgb(84,122,58)'; lx.lineCap = 'round';
773
+ for (let k = 0; k < 4; k++) {
774
+ lx.globalAlpha = 0.35; lx.lineWidth = 7 - k * 1.2; lx.beginPath();
775
+ // the stem grows upward with the brush
776
+ lx.setLineDash([240 * H.ease.out(H.clamp(cur * 1.6)), 400]);
777
+ lx.moveTo(cx - 4 + k, cy + 215); lx.bezierCurveTo(cx - 14 + k, cy + 140, cx + 12, cy + 70, cx + 2 + k * 0.5, cy - 22);
778
+ lx.stroke();
779
+ }
780
+ lx.restore();
781
+ const g1 = leaf(cx - 4, cy + 36, Math.PI * 1.06, 128, 36, 81), g2 = leaf(cx + 4, cy - 14, -Math.PI * 0.1, 122, 34, 82), g3 = leaf(cx, cy - 20, -Math.PI * 0.55, 62, 18, 83);
782
+ [g1, g2, g3].forEach((g, i) => wash(g, [92, 148, 64], { layers: 22, alpha: 0.07, amt: 0.08, seed: 84 + i }));
783
+ lx.save(); lx.filter = 'blur(8px)'; lx.globalAlpha = 0.5 * cur; lx.fillStyle = 'rgb(190,200,60)';
784
+ lx.beginPath(); lx.ellipse(cx - 70, cy + 22, 40, 14, 0.15, 0, 7); lx.fill();
785
+ lx.beginPath(); lx.ellipse(cx + 72, cy - 40, 38, 13, -0.3, 0, 7); lx.fill();
786
+ lx.fillStyle = 'rgb(40,90,70)'; lx.globalAlpha = 0.45 * cur;
787
+ lx.beginPath(); lx.ellipse(cx - 20, cy + 40, 26, 14, 0.15, 0, 7); lx.fill();
788
+ lx.beginPath(); lx.ellipse(cx + 24, cy - 12, 26, 12, -0.3, 0, 7); lx.fill();
789
+ lx.restore();
790
+ finish([cx - 160, cy - 110, cx + 160, cy + 230], 3.0, 4, 1);
791
+ // veins as fine "circuit" traces with node dots
792
+ const vk = ph(3.6, 3.9); ctx.save(); ctx.globalCompositeOperation = 'multiply'; ctx.strokeStyle = `rgba(40,82,50,${0.55 * vk})`; ctx.fillStyle = `rgba(40,82,50,${0.6 * vk})`; ctx.lineWidth = 1.6; ctx.lineCap = 'round';
793
+ [[cx - 8, cy + 34, cx - 118, cy + 22], [cx + 6, cy - 16, cx + 112, cy - 52]].forEach(([a, b, c, d]) => {
794
+ ctx.beginPath(); ctx.moveTo(a, b); ctx.quadraticCurveTo((a + c) / 2, (b + d) / 2 - 6, c, d); ctx.stroke();
795
+ for (let k = 1; k < 4; k++) { const u = k / 4, x = a + (c - a) * u, y = b + (d - b) * u - 4; const s = k % 2 ? -1 : 1;
796
+ ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x + (c > a ? 12 : -12), y + s * 12); ctx.stroke();
797
+ ctx.beginPath(); ctx.arc(x + (c > a ? 12 : -12), y + s * 12, 2.4, 0, 7); ctx.fill(); }
798
+ });
799
+ ctx.restore();
800
+
801
+ // ---------- 7. screw base: Payne's grey + burnt sienna, bands, white highlights ----------
802
+ cur = ph(3.2, 3.9);
803
+ const baseP = shape([P(cx - 80, cy + 222, 0.3), P(cx + 80, cy + 220, 0.3), P(cx + 76, cy + 296, 0.3), P(cx + 36, cy + 318, 0.4), P(cx - 36, cy + 318, 0.4), P(cx - 76, cy + 296, 0.3)], 91, 2, 0.08);
804
+ wash(baseP, [150, 152, 170], { layers: 22, alpha: 0.045, amt: 0.06, seed: 92 });
805
+ lx.save(); lx.filter = 'blur(6px)'; lx.globalAlpha = 0.35 * cur; lx.fillStyle = 'rgb(160,96,60)'; lx.fillRect(cx + 20, cy + 230, 50, 80); lx.restore();
806
+ for (let k = 0; k < 4; k++) {
807
+ const y = cy + 238 + k * 17;
808
+ wash(shape([P(cx - 80, y, 0.3), P(cx + 80, y - 5, 0.3), P(cx + 80, y + 6, 0.3), P(cx - 80, y + 10, 0.3)], 93 + k, 2, 0.1), [70, 72, 100], { layers: 10, alpha: 0.08, amt: 0.08, seed: 95 + k });
809
+ }
810
+ wash(shape([P(cx - 52, cy + 226, 0.2), P(cx - 38, cy + 226, 0.2), P(cx - 40, cy + 300, 0.2), P(cx - 52, cy + 296, 0.2)], 99, 2, 0.1), '#000', { layers: 6, alpha: 0.6, amt: 0.1, depth: 2, seed: 100, comp: 'destination-out' });
811
+ finish([cx - 100, cy + 210, cx + 100, cy + 330], 2.2, 3, 1);
812
+
813
+ // ---------- 8. loose brush contour on the shadow side ----------
814
+ const br = H.rng(123);
815
+ ctx.save(); ctx.globalCompositeOperation = 'multiply'; ctx.lineCap = 'round';
816
+ for (let s = 0; s < 3; s++) {
817
+ const a0 = -Math.PI * 0.42 + s * 0.55 + br() * 0.2, a1 = a0 + 0.35 + br() * 0.3;
818
+ const cp = H.clamp((t - 3.8 - s * 0.12) / 0.25);
819
+ for (let i = 0; i < 18; i++) {
820
+ if (i / 18 > cp) { br(); continue; }
821
+ const u0 = i / 18, u1 = (i + 1) / 18, w = Math.sin(u0 * Math.PI) * 3.4 + 0.4;
822
+ const aa = a0 + (a1 - a0) * u0, ab = a0 + (a1 - a0) * u1;
823
+ ctx.strokeStyle = `rgba(50,48,92,${0.35 + br() * 0.15})`; ctx.lineWidth = w;
824
+ ctx.beginPath(); ctx.moveTo(cx + Math.cos(aa) * (rad + 1), cy + Math.sin(aa) * (rad + 1)); ctx.lineTo(cx + Math.cos(ab) * (rad + 1), cy + Math.sin(ab) * (rad + 1)); ctx.stroke();
825
+ }
826
+ }
827
+ ctx.restore();
828
+
829
+ // ---------- 9. splatter ----------
830
+ const sp = H.rng(555);
831
+ ctx.save(); ctx.globalCompositeOperation = 'multiply';
832
+ const spCols = [[70, 82, 170], [92, 148, 64], [235, 150, 60], [126, 178, 214]];
833
+ for (let i = 0; i < 70; i++) {
834
+ const c = sp.pick(spCols), ang = sp.range(-0.6, 0.3), d = Math.abs(sp.gauss()) * 240;
835
+ const x = 700 + Math.cos(ang) * d + sp.gauss() * 50, y = 120 + Math.sin(ang) * d * 0.6 + sp.gauss() * 60;
836
+ const rr = (Math.pow(sp(), 3) * 7 + 0.8) * H.ease.back(H.clamp((t - 3.95 - i * 0.003) / 0.12));
837
+ if (rr <= 0.05) { sp(); sp(); sp(); continue; }
838
+ ctx.fillStyle = H.rgba(c, 0.25 + sp() * 0.35);
839
+ ctx.beginPath(); ctx.ellipse(x, y, rr, rr * (0.7 + sp() * 0.3), sp() * 3, 0, 7); ctx.fill();
840
+ ctx.fillStyle = H.rgba(c, 0.25); ctx.beginPath(); ctx.arc(x, y, rr * 0.7, 0, 7); ctx.fill();
841
+ }
842
+ ctx.restore();
843
+
844
+ // ---------- 10. hand-lettered title (brush + pooled edges) ----------
845
+ const tr = H.rng(808);
846
+ lx.save(); lx.fillStyle = 'rgb(44,52,112)';
847
+ let chK = 0;
848
+ function letter(str, x, y, size, rot = 0.03) {
849
+ lx.font = `700 ${size}px "Caveat"`;
850
+ let xx = x;
851
+ for (const ch of str) {
852
+ const w = lx.measureText(ch).width;
853
+ lx.save(); lx.translate(xx, y + tr.gauss() * 2.5); lx.rotate(tr.gauss() * rot);
854
+ const reveal = H.ease.out(H.clamp((t - 3.55 - chK++ * 0.06) / 0.16));
855
+ if (reveal > 0) {
856
+ lx.beginPath(); lx.rect(-10, -size, (w + 24) * reveal, size * 1.5); lx.clip();
857
+ lx.globalAlpha = 0.82; lx.fillText(ch, 0, 0); lx.globalAlpha = 0.25; lx.fillText(ch, 1.5, 1);
858
+ }
859
+ lx.restore();
860
+ xx += w * 0.96;
861
+ }
862
+ }
863
+ letter('Ideas', 770, 312, 138);
864
+ letter('take root', 790, 444, 120);
865
+ lx.restore();
866
+ // a tiny bloom in the "I" and wet-in-wet violet in the title
867
+ lx.save(); lx.globalCompositeOperation = 'source-atop'; lx.filter = 'blur(12px)'; lx.fillStyle = 'rgb(130,70,150)'; lx.globalAlpha = 0.55;
868
+ lx.beginPath(); lx.ellipse(960 + 50 * H.smooth(3.8, 6, t), 420, 90 + 40 * H.smooth(3.8, 6, t), 40, 0, 0, 7); lx.fill(); lx.restore();
869
+ cur = ph(3.55, 4.6);
870
+ finish([740, 180, 1240, 480], 2.4, 3, 1);
871
+ // underline swash
872
+ ctx.save(); ctx.globalCompositeOperation = 'multiply'; ctx.lineCap = 'round';
873
+ for (let i = 0; i < 40; i++) {
874
+ const u0 = i / 40, u1 = (i + 1) / 40, w = Math.sin(Math.pow(u0, 0.7) * Math.PI) * 6 + 0.5;
875
+ const X = (u) => 800 + u * 360, Y = (u) => 478 - Math.sin(u * 3.2) * 6 + u * 4;
876
+ ctx.strokeStyle = `rgba(230,140,60,${0.55 * H.clamp((t - 4.3) / 0.35 * 1.2 - u0)})`; ctx.lineWidth = w;
877
+ ctx.beginPath(); ctx.moveTo(X(u0), Y(u0)); ctx.lineTo(X(u1), Y(u1)); ctx.stroke();
878
+ }
879
+ ctx.restore();
880
+ // pencil caption
881
+ ctx.save(); ctx.font = '400 30px "Caveat"'; ctx.fillStyle = 'rgba(80,78,84,0.62)';
882
+ ctx.translate(808, 530); ctx.rotate(-0.012);
883
+ const cap = 'fig. 1 — where the spark begins', nc = Math.floor(cap.length * H.clamp((t - 4.4) / 0.6));
884
+ ctx.fillText(cap.slice(0, nc), 0, 0); ctx.restore();
885
+
886
+ // ---------- 11. paper: cold-press tooth, granulation, pigment settling in the valleys ----------
887
+ const gr = H.rng(99), fine = grid(W, H_, 2.2, gr), mid = grid(W, H_, 7, gr), big = grid(W, H_, 36, gr), speck = grid(W, H_, 1.3, gr);
888
+ const img = ctx.getImageData(0, 0, W, H_), d = img.data;
889
+ const hgt = new Float32Array(W * H_);
890
+ for (let y = 0; y < H_; y++) for (let x = 0; x < W; x++) hgt[y * W + x] = fine(x, y) * 0.3 + mid(x, y) * 0.5 + big(x, y) * 0.2;
891
+ for (let y = 1; y < H_ - 1; y++) for (let x = 1; x < W - 1; x++) {
892
+ const i = y * W + x, p = i * 4, h = hgt[i];
893
+ const shade = 1 + (hgt[i - W - 1] - hgt[i + W + 1]) * 0.1;
894
+ const valley = (0.5 - h) * 2; // >0 in pits of the paper
895
+ const sp = speck(x, y);
896
+ let dens = 0;
897
+ for (let c = 0; c < 3; c++) dens += 1 - d[p + c] / PAPER[c];
898
+ dens /= 3;
899
+ const blue = Math.max(0, (d[p + 2] - d[p]) / 120); // ultramarine / violet granulate, yellows don't
900
+ const g = 1 + (valley * (0.22 + blue * 0.7) + (sp > 0.82 ? (sp - 0.82) * 5 * blue : 0)) * Math.min(1, dens * 3);
901
+ for (let c = 0; c < 3; c++) {
902
+ const dc = Math.max(0, 1 - d[p + c] / PAPER[c]) * g;
903
+ d[p + c] = Math.max(0, Math.min(255, PAPER[c] * (1 - dc) * shade));
904
+ }
905
+ }
906
+ ctx.putImageData(img, 0, 0);
907
+ }
908
+ });
909
+ }