sera-code 0.1.2 → 0.1.4

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 (333) hide show
  1. package/README.md +9 -1
  2. package/bin/sera.mjs +31 -0
  3. package/dist/bundle/chunks/{chunk-LOMPDCMP.js → chunk-DFRGGJWV.js} +1 -1
  4. package/dist/bundle/chunks/{chunk-AZC5WTED.js → chunk-EMXTNOOJ.js} +5 -5
  5. package/dist/bundle/chunks/{chunk-KXU77PUU.js → chunk-ET2ARYK4.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-ZNCN2NGY.js → chunk-G5BGS7HZ.js} +2 -2
  7. package/dist/bundle/chunks/{chunk-HODJBMOY.js → chunk-GSGPISRE.js} +3 -4
  8. package/dist/bundle/chunks/{chunk-46WGNYIE.js → chunk-NMUS7OCP.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-HQBQWHLD.js → chunk-RCQXVPCE.js} +1 -1
  10. package/dist/bundle/chunks/{cli-MML2DU4A.js → cli-NOCFT7AL.js} +1 -1
  11. package/dist/bundle/chunks/{execute-HXDNZ26B.js → execute-S2O3RL6V.js} +1 -1
  12. package/dist/bundle/chunks/github-copilot.js +1 -1
  13. package/dist/bundle/chunks/{runtime-JAH75CB5.js → runtime-BRT7AUXY.js} +1 -1
  14. package/dist/bundle/chunks/{virtual-modules-Z2V3PTLI.js → virtual-modules-QR2XYBMY.js} +1 -1
  15. package/dist/bundle/cli-runtime.js +1 -1
  16. package/dist/bundle/index.js +1 -1
  17. package/dist/bundle/rpc-entry.js +1 -1
  18. package/lib/postinstall.js +16 -0
  19. package/lib/update.js +85 -0
  20. package/lib/win-setup.js +96 -0
  21. package/package.json +4 -1
  22. package/sera-core/skills/ambalaj-tasarim/NOTICE +1 -0
  23. package/sera-core/skills/ambalaj-tasarim/SKILL.md +34 -0
  24. package/sera-core/skills/ambalaj-tasarim/dieline.mjs +17 -0
  25. package/sera-core/skills/ambalaj-tasarim/sera-pack.js +535 -0
  26. package/sera-core/skills/animasyonlu-site/NOTICE +1 -0
  27. package/sera-core/skills/animasyonlu-site/SKILL.md +26 -0
  28. package/sera-core/skills/animasyonlu-site/sera-motion.js +310 -0
  29. package/sera-core/skills/animate/LICENSE +21 -0
  30. package/sera-core/skills/animate/NOTICE +2 -0
  31. package/sera-core/skills/animate/RECIPES.md +324 -0
  32. package/sera-core/skills/animate/SKILL.md +209 -0
  33. package/sera-core/skills/astryx-ui/SKILL.md +37 -0
  34. package/sera-core/skills/awwwards/LICENSE +21 -0
  35. package/sera-core/skills/awwwards/NOTICE +5 -0
  36. package/sera-core/skills/awwwards/SKILL.md +357 -0
  37. package/sera-core/skills/awwwards/references/anatomy.md +103 -0
  38. package/sera-core/skills/awwwards/references/art-direction.md +114 -0
  39. package/sera-core/skills/awwwards/references/astro.md +235 -0
  40. package/sera-core/skills/awwwards/references/concepts.md +110 -0
  41. package/sera-core/skills/awwwards/references/content.md +88 -0
  42. package/sera-core/skills/awwwards/references/engine.md +751 -0
  43. package/sera-core/skills/awwwards/references/layout.md +81 -0
  44. package/sera-core/skills/awwwards/references/motion.md +463 -0
  45. package/sera-core/skills/awwwards/references/nextjs.md +386 -0
  46. package/sera-core/skills/awwwards/references/patterns.md +123 -0
  47. package/sera-core/skills/awwwards/references/quality-bar.md +151 -0
  48. package/sera-core/skills/awwwards/references/quality.md +91 -0
  49. package/sera-core/skills/awwwards/references/ship.md +36 -0
  50. package/sera-core/skills/awwwards/references/typography.md +135 -0
  51. package/sera-core/skills/awwwards/references/webgl.md +430 -0
  52. package/sera-core/skills/awwwards/scripts/audit.mjs +243 -0
  53. package/sera-core/skills/awwwards/scripts/browser.mjs +54 -0
  54. package/sera-core/skills/awwwards/scripts/font.mjs +87 -0
  55. package/sera-core/skills/awwwards/scripts/og.mjs +20 -0
  56. package/sera-core/skills/awwwards/scripts/photos.mjs +65 -0
  57. package/sera-core/skills/awwwards/scripts/serve.mjs +48 -0
  58. package/sera-core/skills/awwwards/scripts/shoot.mjs +675 -0
  59. package/sera-core/skills/beceri-yaz/SKILL.md +39 -0
  60. package/sera-core/skills/brag-slim/LICENSE +21 -0
  61. package/sera-core/skills/brag-slim/NOTICE +2 -0
  62. package/sera-core/skills/brag-slim/SKILL.md +108 -0
  63. package/sera-core/skills/brainstorming/LICENSE +21 -0
  64. package/sera-core/skills/brainstorming/NOTICE +5 -0
  65. package/sera-core/skills/brainstorming/SKILL.md +298 -0
  66. package/sera-core/skills/brainstorming/builder-check-prompt.md +23 -0
  67. package/sera-core/skills/copywriting/LICENSE +21 -0
  68. package/sera-core/skills/copywriting/NOTICE +5 -0
  69. package/sera-core/skills/copywriting/SKILL.md +343 -0
  70. package/sera-core/skills/copywriting/references/ai-tells.md +309 -0
  71. package/sera-core/skills/copywriting/references/copy-frameworks.md +432 -0
  72. package/sera-core/skills/copywriting/references/natural-transitions.md +256 -0
  73. package/sera-core/skills/cro/LICENSE +21 -0
  74. package/sera-core/skills/cro/NOTICE +5 -0
  75. package/sera-core/skills/cro/SKILL.md +198 -0
  76. package/sera-core/skills/cro/references/experiments.md +248 -0
  77. package/sera-core/skills/cro/references/form.md +422 -0
  78. package/sera-core/skills/derin-arastirma/referanslar/arastirma-yontem.md +11 -0
  79. package/sera-core/skills/emil-design-eng/LICENSE +21 -0
  80. package/sera-core/skills/emil-design-eng/NOTICE +2 -0
  81. package/sera-core/skills/emil-design-eng/SKILL.md +684 -0
  82. package/sera-core/skills/frontend-design/LICENSE.txt +177 -0
  83. package/sera-core/skills/frontend-design/NOTICE +2 -0
  84. package/sera-core/skills/frontend-design/SKILL.md +71 -0
  85. package/sera-core/skills/gorsel-denetim/SKILL.md +30 -0
  86. package/sera-core/skills/hallmark/LICENSE +21 -0
  87. package/sera-core/skills/hallmark/NOTICE +5 -0
  88. package/sera-core/skills/hallmark/SKILL.md +154 -0
  89. package/sera-core/skills/hallmark/references/anatomy.md +71 -0
  90. package/sera-core/skills/hallmark/references/brand-truth.md +40 -0
  91. package/sera-core/skills/hallmark/references/comp.md +104 -0
  92. package/sera-core/skills/hallmark/references/craft.md +116 -0
  93. package/sera-core/skills/hallmark/references/dark-mode.md +49 -0
  94. package/sera-core/skills/hallmark/references/data-viz.md +48 -0
  95. package/sera-core/skills/hallmark/references/design-md.md +53 -0
  96. package/sera-core/skills/hallmark/references/direction.md +52 -0
  97. package/sera-core/skills/hallmark/references/export-formats.md +80 -0
  98. package/sera-core/skills/hallmark/references/flow.md +131 -0
  99. package/sera-core/skills/hallmark/references/fonts.md +58 -0
  100. package/sera-core/skills/hallmark/references/gates.md +243 -0
  101. package/sera-core/skills/hallmark/references/genres/atmospheric.md +24 -0
  102. package/sera-core/skills/hallmark/references/genres/editorial.md +24 -0
  103. package/sera-core/skills/hallmark/references/genres/modern-minimal.md +24 -0
  104. package/sera-core/skills/hallmark/references/genres/playful.md +24 -0
  105. package/sera-core/skills/hallmark/references/imagery.md +99 -0
  106. package/sera-core/skills/hallmark/references/interaction-and-states.md +89 -0
  107. package/sera-core/skills/hallmark/references/layout.md +104 -0
  108. package/sera-core/skills/hallmark/references/macrostructures/01-bento-grid.md +21 -0
  109. package/sera-core/skills/hallmark/references/macrostructures/02-long-document.md +35 -0
  110. package/sera-core/skills/hallmark/references/macrostructures/03-marquee-hero.md +21 -0
  111. package/sera-core/skills/hallmark/references/macrostructures/04-stat-led.md +21 -0
  112. package/sera-core/skills/hallmark/references/macrostructures/05-workbench.md +21 -0
  113. package/sera-core/skills/hallmark/references/macrostructures/06-conversational-faq.md +28 -0
  114. package/sera-core/skills/hallmark/references/macrostructures/07-manifesto.md +28 -0
  115. package/sera-core/skills/hallmark/references/macrostructures/08-photographic.md +21 -0
  116. package/sera-core/skills/hallmark/references/macrostructures/09-quote-led.md +21 -0
  117. package/sera-core/skills/hallmark/references/macrostructures/10-specimen.md +21 -0
  118. package/sera-core/skills/hallmark/references/macrostructures/11-catalogue.md +21 -0
  119. package/sera-core/skills/hallmark/references/macrostructures/12-letter.md +21 -0
  120. package/sera-core/skills/hallmark/references/macrostructures/13-index-first.md +21 -0
  121. package/sera-core/skills/hallmark/references/macrostructures/14-narrative-workflow.md +21 -0
  122. package/sera-core/skills/hallmark/references/macrostructures/15-split-studio.md +21 -0
  123. package/sera-core/skills/hallmark/references/macrostructures/16-feature-stack.md +23 -0
  124. package/sera-core/skills/hallmark/references/macrostructures/17-type-specimen.md +19 -0
  125. package/sera-core/skills/hallmark/references/macrostructures/18-portfolio-grid.md +21 -0
  126. package/sera-core/skills/hallmark/references/macrostructures/19-map-diagram.md +21 -0
  127. package/sera-core/skills/hallmark/references/macrostructures/20-ecosystem-index.md +19 -0
  128. package/sera-core/skills/hallmark/references/macrostructures/21-component-playground.md +21 -0
  129. package/sera-core/skills/hallmark/references/macrostructures.md +119 -0
  130. package/sera-core/skills/hallmark/references/microinteractions.md +80 -0
  131. package/sera-core/skills/hallmark/references/patterns.md +202 -0
  132. package/sera-core/skills/hallmark/references/redesign.md +88 -0
  133. package/sera-core/skills/hallmark/references/responsive.md +46 -0
  134. package/sera-core/skills/hallmark/references/review-finish.md +19 -0
  135. package/sera-core/skills/hallmark/references/review-hero.md +20 -0
  136. package/sera-core/skills/hallmark/references/scroll-choreography.md +110 -0
  137. package/sera-core/skills/hallmark/references/texture.md +90 -0
  138. package/sera-core/skills/hallmark/references/themes/README.md +58 -0
  139. package/sera-core/skills/hallmark/references/themes/almanac.md +103 -0
  140. package/sera-core/skills/hallmark/references/themes/arcade.md +102 -0
  141. package/sera-core/skills/hallmark/references/themes/atelier.md +98 -0
  142. package/sera-core/skills/hallmark/references/themes/bloom.md +102 -0
  143. package/sera-core/skills/hallmark/references/themes/blueprint.md +103 -0
  144. package/sera-core/skills/hallmark/references/themes/broadside.md +108 -0
  145. package/sera-core/skills/hallmark/references/themes/brutal.md +95 -0
  146. package/sera-core/skills/hallmark/references/themes/carnival.md +104 -0
  147. package/sera-core/skills/hallmark/references/themes/cobalt.md +101 -0
  148. package/sera-core/skills/hallmark/references/themes/console.md +99 -0
  149. package/sera-core/skills/hallmark/references/themes/coral.md +102 -0
  150. package/sera-core/skills/hallmark/references/themes/darkroom.md +99 -0
  151. package/sera-core/skills/hallmark/references/themes/dose.md +98 -0
  152. package/sera-core/skills/hallmark/references/themes/dusk.md +105 -0
  153. package/sera-core/skills/hallmark/references/themes/editorial.md +97 -0
  154. package/sera-core/skills/hallmark/references/themes/formwork.md +107 -0
  155. package/sera-core/skills/hallmark/references/themes/furrow.md +98 -0
  156. package/sera-core/skills/hallmark/references/themes/garden.md +97 -0
  157. package/sera-core/skills/hallmark/references/themes/grid.md +101 -0
  158. package/sera-core/skills/hallmark/references/themes/halftone.md +106 -0
  159. package/sera-core/skills/hallmark/references/themes/hedgerow.md +104 -0
  160. package/sera-core/skills/hallmark/references/themes/hum.md +99 -0
  161. package/sera-core/skills/hallmark/references/themes/ink.md +106 -0
  162. package/sera-core/skills/hallmark/references/themes/kiln.md +108 -0
  163. package/sera-core/skills/hallmark/references/themes/loom.md +106 -0
  164. package/sera-core/skills/hallmark/references/themes/lumen.md +103 -0
  165. package/sera-core/skills/hallmark/references/themes/manifesto.md +101 -0
  166. package/sera-core/skills/hallmark/references/themes/midnight.md +97 -0
  167. package/sera-core/skills/hallmark/references/themes/newsprint.md +102 -0
  168. package/sera-core/skills/hallmark/references/themes/overprint.md +101 -0
  169. package/sera-core/skills/hallmark/references/themes/pasteup.md +100 -0
  170. package/sera-core/skills/hallmark/references/themes/piste.md +99 -0
  171. package/sera-core/skills/hallmark/references/themes/refract.md +101 -0
  172. package/sera-core/skills/hallmark/references/themes/ribbon.md +106 -0
  173. package/sera-core/skills/hallmark/references/themes/rim.md +96 -0
  174. package/sera-core/skills/hallmark/references/themes/riso.md +98 -0
  175. package/sera-core/skills/hallmark/references/themes/solstice.md +104 -0
  176. package/sera-core/skills/hallmark/references/themes/specimen.md +100 -0
  177. package/sera-core/skills/hallmark/references/themes/spore.md +104 -0
  178. package/sera-core/skills/hallmark/references/themes/sport.md +101 -0
  179. package/sera-core/skills/hallmark/references/themes/squeeze.md +99 -0
  180. package/sera-core/skills/hallmark/references/themes/sticker.md +106 -0
  181. package/sera-core/skills/hallmark/references/themes/studio.md +99 -0
  182. package/sera-core/skills/hallmark/references/themes/terminal.md +96 -0
  183. package/sera-core/skills/hallmark/references/themes/terrazzo.md +106 -0
  184. package/sera-core/skills/hallmark/references/themes/ultraviolet.md +106 -0
  185. package/sera-core/skills/hallmark/references/themes/vantage.md +99 -0
  186. package/sera-core/skills/hallmark/references/themes/vellum.md +105 -0
  187. package/sera-core/skills/hallmark/references/themes/wayfind.md +105 -0
  188. package/sera-core/skills/hallmark/references/themes/werkstatt.md +105 -0
  189. package/sera-core/skills/hallmark/scripts/capture.mjs +132 -0
  190. package/sera-core/skills/hallmark/scripts/refcheck.mjs +405 -0
  191. package/sera-core/skills/hallmark/scripts/sloplint-render.mjs +1283 -0
  192. package/sera-core/skills/hallmark/scripts/sloplint.mjs +4426 -0
  193. package/sera-core/skills/hallmark/scripts/theme.mjs +660 -0
  194. package/sera-core/skills/kurum-ici-iletisim/SKILL.md +40 -0
  195. package/sera-core/skills/launch/LICENSE +21 -0
  196. package/sera-core/skills/launch/NOTICE +5 -0
  197. package/sera-core/skills/launch/SKILL.md +385 -0
  198. package/sera-core/skills/launch/references/shipped-changes.md +84 -0
  199. package/sera-core/skills/launch/references/site-launch-qa.md +57 -0
  200. package/sera-core/skills/marka-kimligi/SKILL.md +30 -0
  201. package/sera-core/skills/mcp-yaz/SKILL.md +41 -0
  202. package/sera-core/skills/mobil-arayuz/SKILL.md +12 -0
  203. package/sera-core/skills/mvp-scoping/LICENSE +21 -0
  204. package/sera-core/skills/mvp-scoping/NOTICE +5 -0
  205. package/sera-core/skills/mvp-scoping/SKILL.md +95 -0
  206. package/sera-core/skills/ortak-yazarlik/SKILL.md +32 -0
  207. package/sera-core/skills/oyun-turleri/SKILL.md +176 -0
  208. package/sera-core/skills/paralel-sadelestirme/SKILL.md +33 -0
  209. package/sera-core/skills/phaser-core/LICENSE +201 -0
  210. package/sera-core/skills/phaser-core/NOTICE +5 -0
  211. package/sera-core/skills/phaser-core/NOTICE-UPSTREAM +15 -0
  212. package/sera-core/skills/phaser-core/SKILL.md +245 -0
  213. package/sera-core/skills/phaser-core/references/scene-flow.md +177 -0
  214. package/sera-core/skills/pitch-deck/LICENSE +21 -0
  215. package/sera-core/skills/pitch-deck/NOTICE +5 -0
  216. package/sera-core/skills/pitch-deck/SKILL.md +103 -0
  217. package/sera-core/skills/sera-3d-oyun/NOTICE +1 -0
  218. package/sera-core/skills/sera-3d-oyun/SKILL.md +12 -0
  219. package/sera-core/skills/sera-3d-oyun/sera-3d.js +3697 -0
  220. package/sera-core/skills/sera-diyagram/SKILL.md +43 -0
  221. package/sera-core/skills/sera-ofis-dosya/SKILL.md +3 -0
  222. package/sera-core/skills/sera-ofis-dosya/referanslar/ofis-ileri.md +46 -0
  223. package/sera-core/skills/sera-ui-site/NOTICE +1 -0
  224. package/sera-core/skills/sera-ui-site/SKILL.md +10 -0
  225. package/sera-core/skills/sera-ui-site/sera-ui.js +83 -0
  226. package/sera-core/skills/sera-veri-gorsel/SKILL.md +3 -0
  227. package/sera-core/skills/sera-veri-gorsel/referanslar/palet-dogrula.mjs +80 -0
  228. package/sera-core/skills/sistem-tarama/SKILL.md +49 -0
  229. package/sera-core/skills/sistem-tarama/referanslar/komutlar.md +78 -0
  230. package/sera-core/skills/tasarim-stilleri/SKILL.md +113 -0
  231. package/sera-core/skills/teardown/LICENSE +22 -0
  232. package/sera-core/skills/teardown/NOTICE +3 -0
  233. package/sera-core/skills/teardown/SKILL.md +144 -0
  234. package/sera-core/skills/teardown/package-lock.json +545 -0
  235. package/sera-core/skills/teardown/package.json +18 -0
  236. package/sera-core/skills/teardown/paths.mjs +30 -0
  237. package/sera-core/skills/teardown/run_sfx.py +10 -0
  238. package/sera-core/skills/teardown/sfx/__init__.py +10 -0
  239. package/sera-core/skills/teardown/sfx/__main__.py +64 -0
  240. package/sera-core/skills/teardown/sfx/dsp.py +453 -0
  241. package/sera-core/skills/teardown/sfx/loudness.py +72 -0
  242. package/sera-core/skills/teardown/sfx/mix.py +111 -0
  243. package/sera-core/skills/teardown/sfx/samples/SOURCES.md +23 -0
  244. package/sera-core/skills/teardown/sfx/samples/fs-258269-mouth-pop.ogg +0 -0
  245. package/sera-core/skills/teardown/sfx/samples/fs-323432-typing.ogg +0 -0
  246. package/sera-core/skills/teardown/sfx/samples/fs-329533-room-tone-in-an-apartment-livi.ogg +0 -0
  247. package/sera-core/skills/teardown/sfx/samples/fs-329569-roomtone-bedroom-yew.ogg +0 -0
  248. package/sera-core/skills/teardown/sfx/samples/fs-339521-vhs-rewind-forward-and-eject.ogg +0 -0
  249. package/sera-core/skills/teardown/sfx/samples/fs-349504-triangle-open-04.ogg +0 -0
  250. package/sera-core/skills/teardown/sfx/samples/fs-416777-digital-typing-wav.ogg +0 -0
  251. package/sera-core/skills/teardown/sfx/samples/fs-426767-apartment-room-tone-wav.ogg +0 -0
  252. package/sera-core/skills/teardown/sfx/samples/fs-447909-keyboard-typing.ogg +0 -0
  253. package/sera-core/skills/teardown/sfx/samples/fs-447910-plop.ogg +0 -0
  254. package/sera-core/skills/teardown/sfx/samples/fs-79388-keyboard-typing-wav.ogg +0 -0
  255. package/sera-core/skills/teardown/sfx/samples/fs-824189-pop-in-sfx.ogg +0 -0
  256. package/sera-core/skills/teardown/sfx/score_kit.py +206 -0
  257. package/sera-core/skills/teardown/sfx/synth.py +294 -0
  258. package/sera-core/skills/teardown/sheet.mjs +127 -0
  259. package/sera-core/skills/teardown/sims/beats.py +212 -0
  260. package/sera-core/skills/teardown/sims/build.mjs +141 -0
  261. package/sera-core/skills/teardown/sims/capture.mjs +211 -0
  262. package/sera-core/skills/teardown/sims/cessna-film/main.js +4 -0
  263. package/sera-core/skills/teardown/sims/cessna-film/timeline.json +1 -0
  264. package/sera-core/skills/teardown/sims/cessna-live/main.js +5 -0
  265. package/sera-core/skills/teardown/sims/cessna-shared/console.js +288 -0
  266. package/sera-core/skills/teardown/sims/cessna-shared/film.js +254 -0
  267. package/sera-core/skills/teardown/sims/cessna-shared/flight.js +53 -0
  268. package/sera-core/skills/teardown/sims/cessna-shared/gear.js +364 -0
  269. package/sera-core/skills/teardown/sims/cessna-shared/live.js +351 -0
  270. package/sera-core/skills/teardown/sims/cessna-shared/score.py +41 -0
  271. package/sera-core/skills/teardown/sims/cessna-shared/stage.js +248 -0
  272. package/sera-core/skills/teardown/sims/kit/director.js +300 -0
  273. package/sera-core/skills/teardown/sims/kit/hud.js +194 -0
  274. package/sera-core/skills/teardown/sims/kit/runtime.js +168 -0
  275. package/sera-core/skills/teardown/sims/kit/stage3d.js +114 -0
  276. package/sera-core/skills/teardown/sims/kit/style.css +137 -0
  277. package/sera-core/skills/teardown/sims/kit/util.js +79 -0
  278. package/sera-core/skills/teardown/sims/kit/warm.js +66 -0
  279. package/sera-core/skills/teardown/sims/strandbeest-film/main.js +4 -0
  280. package/sera-core/skills/teardown/sims/strandbeest-film/timeline.json +1 -0
  281. package/sera-core/skills/teardown/sims/strandbeest-live/main.js +5 -0
  282. package/sera-core/skills/teardown/sims/strandbeest-shared/beast.js +419 -0
  283. package/sera-core/skills/teardown/sims/strandbeest-shared/console.js +375 -0
  284. package/sera-core/skills/teardown/sims/strandbeest-shared/film.js +352 -0
  285. package/sera-core/skills/teardown/sims/strandbeest-shared/jansen.js +67 -0
  286. package/sera-core/skills/teardown/sims/strandbeest-shared/live.js +420 -0
  287. package/sera-core/skills/teardown/sims/strandbeest-shared/score.py +85 -0
  288. package/sera-core/skills/teardown/sims/strandbeest-shared/stage.js +463 -0
  289. package/sera-core/skills/teardown/sims/v8-film/main.js +4 -0
  290. package/sera-core/skills/teardown/sims/v8-film/timeline.json +1 -0
  291. package/sera-core/skills/teardown/sims/v8-live/main.js +5 -0
  292. package/sera-core/skills/teardown/sims/v8-shared/console.js +339 -0
  293. package/sera-core/skills/teardown/sims/v8-shared/engine.js +624 -0
  294. package/sera-core/skills/teardown/sims/v8-shared/film.js +239 -0
  295. package/sera-core/skills/teardown/sims/v8-shared/kin.js +86 -0
  296. package/sera-core/skills/teardown/sims/v8-shared/live.js +374 -0
  297. package/sera-core/skills/teardown/sims/v8-shared/score.py +60 -0
  298. package/sera-core/skills/teardown/sims/v8-shared/stage.js +173 -0
  299. package/sera-core/skills/teardown/wave.mjs +67 -0
  300. package/sera-core/skills/toplu-degisiklik/SKILL.md +39 -0
  301. package/sera-core/skills/ui-ux-pro-max/LICENSE +21 -0
  302. package/sera-core/skills/ui-ux-pro-max/NOTICE +5 -0
  303. package/sera-core/skills/ui-ux-pro-max/SKILL.md +13 -0
  304. package/sera-core/skills/ui-ux-pro-max/references/pro-rules.md +117 -0
  305. package/sera-core/skills/ui-ux-pro-max/references/quick-reference.md +266 -0
  306. package/sera-core/skills/unslop/LICENSE.md +410 -0
  307. package/sera-core/skills/unslop/SKILL.md +217 -0
  308. package/sera-core/skills/unslop/references/effects.md +113 -0
  309. package/sera-core/skills/unslop/references/refs/unslop-dashboard-after.webp +0 -0
  310. package/sera-core/skills/unslop/references/refs/unslop-hero-after.webp +0 -0
  311. package/sera-core/skills/unslop/references/refs.md +16 -0
  312. package/sera-core/skills/unslop/references/rtl.md +72 -0
  313. package/sera-core/skills/unslop/references/signs.md +125 -0
  314. package/sera-core/skills/unslop/references/tokens.md +137 -0
  315. package/sera-core/skills/unslop/references/visuals.md +84 -0
  316. package/sera-core/skills/unslop/scripts/snapshot.mjs +197 -0
  317. package/sera-core/skills/uretken-sanat/SKILL.md +42 -0
  318. package/sera-core/skills/verification-before-completion/LICENSE +21 -0
  319. package/sera-core/skills/verification-before-completion/NOTICE +5 -0
  320. package/sera-core/skills/verification-before-completion/SKILL.md +120 -0
  321. package/sera-core/skills/web-yayin-listesi/SKILL.md +3 -0
  322. package/sera-core/src/app-master.ts +2 -2
  323. package/sera-core/src/app-verify.ts +33 -0
  324. package/sera-core/src/auto-memory.ts +249 -0
  325. package/sera-core/src/extension.ts +69 -3
  326. package/sera-core/src/generated/build-rules.ts +81 -17
  327. package/sera-core/src/generated/quality-probe.ts +2 -0
  328. package/sera-core/src/generated/zero-knowledge.ts +36 -9
  329. package/sera-core/src/image-tool.ts +124 -7
  330. package/sera-core/src/link-data-tools.ts +411 -0
  331. package/sera-core/src/skills.ts +54 -18
  332. package/sera-core/src/video-tool.ts +51 -0
  333. package/sera-core/src/zk.ts +7 -3
@@ -0,0 +1,352 @@
1
+ // STRANDBEEST SB-10, the console film: the beast on the dune (stage.js) under the SB-10 engineering sheet
2
+ // (console.js). An operator isolates one leg and letters its eleven bars, traces its foot, lights all twenty loops,
3
+ // opens the wind from 6 to 12.5 m/s and follows the walk from the front, along the spine and from above over the
4
+ // footprints. Wind drives the crank, the crank drives everything: theta(t) is the integral of the wind's crank speed.
5
+ // A pure function of t.
6
+ import {runSim} from '../kit/runtime.js';
7
+ import {CFG, legAt, legZ, phaseOf, S, STRIDE} from './beast.js';
8
+ import {createConsole, LABELS, VIEW_KEYS} from './console.js';
9
+ import {footLift} from './jansen.js';
10
+ import {createBeestStage} from './stage.js';
11
+
12
+ // the foot traces are off in this cut (no trace events); the console keeps the TRACE FEET button for the live page
13
+ export const SCRIPT = [
14
+ {t: 0, view: 'cine'},
15
+ {t: 3.4, iso: 1, view: 'leg'},
16
+ {t: 9.6, iso: 0, view: 'front'},
17
+ {t: 13.0, wind: [6, 12.5, 1.6]},
18
+ {t: 16.8, view: 'side'},
19
+ {t: 21.0, view: 'top'},
20
+ {t: 25.8, view: 'cine'},
21
+ ];
22
+ export const DURATION = 30.7;
23
+ export const DEFAULTS = {duration: DURATION, fps: 60, theme: 'light', hud: {enabled: false, title: 'beestsim', subtitle: ''}, director: {enabled: false}, watermark: ''};
24
+ export const HERO = {st: 0, side: 0};
25
+ const D2R = Math.PI / 180;
26
+ const smoother = (x) => {
27
+ const u = Math.min(1, Math.max(0, x));
28
+ return u * u * u * (u * (u * 6 - 15) + 10);
29
+ };
30
+ const ss = (a, b, t) => smoother((t - a) / (b - a));
31
+
32
+ // ------------------------------------------------------------ wind, crank and the distance the wind has run
33
+ const WIND_EV = SCRIPT.find((e) => e.wind);
34
+ export const windAt = (t) => {
35
+ const [w0, w1, dur] = WIND_EV.wind;
36
+ const base = w0 + (w1 - w0) * ss(WIND_EV.t, WIND_EV.t + dur, t);
37
+ return base + 0.35 * Math.sin(t * 0.9) + 0.2 * Math.sin(t * 2.3 + 1);
38
+ };
39
+ // the crank's turn rate for a wind: 0.42 rev/s at 6 m/s, rising slower than the wind
40
+ export const rpsAt = (w) => 0.42 * Math.pow(Math.max(0.5, w) / 6, 0.75);
41
+ const T0 = -16;
42
+ const DT = 1 / 240;
43
+ const NTAB = Math.ceil((DURATION + 2 - T0) / DT);
44
+ const TH = new Float64Array(NTAB + 1);
45
+ const FLOW = new Float64Array(NTAB + 1);
46
+ {
47
+ // integrate from t = 0 both ways so theta(0) = 0 and the body starts at the origin
48
+ const i0 = Math.round(-T0 / DT);
49
+ for (let i = i0 + 1; i <= NTAB; i++) {
50
+ const t = T0 + (i - 0.5) * DT;
51
+ TH[i] = TH[i - 1] + rpsAt(windAt(t)) * Math.PI * 2 * DT;
52
+ FLOW[i] = FLOW[i - 1] + windAt(t) * DT;
53
+ }
54
+ for (let i = i0 - 1; i >= 0; i--) {
55
+ const t = T0 + (i + 0.5) * DT;
56
+ TH[i] = TH[i + 1] - rpsAt(windAt(t)) * Math.PI * 2 * DT;
57
+ FLOW[i] = FLOW[i + 1] - windAt(t) * DT;
58
+ }
59
+ }
60
+ const lookup = (A, t) => {
61
+ const u = Math.min(NTAB - 1e-6, Math.max(0, (t - T0) / DT));
62
+ const i = Math.floor(u);
63
+ return A[i] + (A[i + 1] - A[i]) * (u - i);
64
+ };
65
+ export const thetaAt = (t) => lookup(TH, t);
66
+ export const flowAt = (t) => lookup(FLOW, t);
67
+
68
+ // ------------------------------------------------------------ operator state
69
+ const evAt = (key, t, init = 0) => {
70
+ let v = init;
71
+ for (const e of SCRIPT) if (e[key] !== undefined) v += (e[key] - v) * ss(e.t, e.t + 0.7, t);
72
+ return v;
73
+ };
74
+ export const isoAt = (t) => evAt('iso', t);
75
+ const TRACE_ON = SCRIPT.find((e) => e.trace === 1)?.t ?? Infinity;
76
+ const TRACE_OFF = SCRIPT.find((e) => e.trace === 0)?.t ?? Infinity;
77
+ // when the hero's foot has drawn one full loop
78
+ const LOOP_DONE = (() => {
79
+ if (!Number.isFinite(TRACE_ON)) return Infinity;
80
+ const th0 = thetaAt(TRACE_ON);
81
+ let t = TRACE_ON;
82
+ while (thetaAt(t) - th0 < Math.PI * 2) t += 0.01;
83
+ return t;
84
+ })();
85
+ export const traceState = (t) => ({
86
+ heroTrace: t < TRACE_ON ? 0 : Math.min(1, (thetaAt(t) - thetaAt(TRACE_ON)) / (Math.PI * 2)),
87
+ trace: ss(LOOP_DONE, LOOP_DONE + 0.9, t),
88
+ traceFade: 1 - ss(TRACE_OFF, TRACE_OFF + 0.7, t),
89
+ on: t >= TRACE_ON && t < TRACE_OFF + 0.2 ? 1 : 0,
90
+ });
91
+ export const ISO_T = SCRIPT.find((e) => e.iso === 1).t;
92
+ // the hero's letters come up one by one, starting 0.9 s after the leg is isolated
93
+ export const labelTimes = (start) => LABELS.map((_, i) => start + 0.9 + i * 0.3);
94
+
95
+ // ------------------------------------------------------------ views
96
+ const heroZ = legZ(HERO.st, HERO.side) * S;
97
+ // each view as a function of u, the seconds since it was switched on, and the body's x
98
+ export const VIEW_FN = {
99
+ cine: (u, bx) => ({tx: bx + 0.05, ty: 1.1, tz: 0.1, az: 319.6 + 1.4 * u, el: 11, d: 9.2, sx: 14, sy: -58}),
100
+ leg: (u, bx) => ({tx: bx - 0.34, ty: 0.74, tz: heroZ, az: 94 + 0.9 * u, el: 4, d: 5.6, sx: 0, sy: -40}),
101
+ front: (u, bx) => ({tx: bx - 0.1, ty: 1.08, tz: 0, az: 196 + 1.1 * u, el: 7, d: 9.6, sx: -6, sy: -50}),
102
+ side: (u, bx) => ({tx: bx + 0.1, ty: 0.95, tz: -0.2, az: 262 - 1.2 * u, el: 11, d: 9.6, sx: -6, sy: -58}),
103
+ top: (u, bx) => ({tx: bx + 1.1, ty: 0.3, tz: 0, az: 192 + 1.6 * u, el: 60, d: 13.5, sx: 0, sy: -40}),
104
+ };
105
+ const VIEWS_LIST = SCRIPT.filter((e) => e.view).map((e) => [e.t, e.view]);
106
+ export const scriptView = (t) => VIEWS_LIST.filter(([t0]) => t0 <= t).pop();
107
+ const lerpDeg = (a, b, k) => a + ((((b - a + 540) % 360) - 180) * k);
108
+ export const viewAt = (t, bx, list = VIEWS_LIST) => {
109
+ let i = 0;
110
+ while (i < list.length - 1 && list[i + 1][0] <= t) i++;
111
+ const cur = VIEW_FN[list[i][1]](t - list[i][0], bx);
112
+ if (i === 0) return cur;
113
+ const prev = VIEW_FN[list[i - 1][1]](t - list[i - 1][0], bx);
114
+ const k = ss(list[i][0], list[i][0] + 1.9, t);
115
+ const o = {};
116
+ for (const key in cur) o[key] = key === 'az' ? lerpDeg(prev.az, cur.az, k) : prev[key] + (cur[key] - prev[key]) * k;
117
+ // a move through a wide swing backs off and climbs so the camera never passes through the beast
118
+ const swing = Math.min(1, Math.abs(((cur.az - prev.az + 540) % 360) - 180) / 90);
119
+ o.el += 8 * Math.sin(Math.PI * k) * swing;
120
+ o.d += Math.max(0, Math.max(prev.d, cur.d) + 2.5 * swing - o.d) * Math.sin(Math.PI * k);
121
+ return o;
122
+ };
123
+ export const toCam = (c) => ({...c, az: c.az * D2R, el: c.el * D2R});
124
+
125
+ // ------------------------------------------------------------ footprints from the walk itself
126
+ export function footprints(bodyPos, t1 = DURATION) {
127
+ const out = [];
128
+ let r = 17;
129
+ const rnd = () => (r = (r * 16807) % 2147483647) / 2147483647;
130
+ for (let st = 0; st < CFG.stations; st++)
131
+ for (let side = 0; side < 2; side++) {
132
+ let on = false;
133
+ let t0 = 0;
134
+ for (let t = T0; t <= t1; t += 1 / 120) {
135
+ const ps = thetaAt(t) + phaseOf(st);
136
+ const lift = footLift(side ? Math.PI - ps : ps);
137
+ if (!on && lift < 0.5) {
138
+ on = true;
139
+ t0 = t;
140
+ } else if (on && lift >= 0.5) {
141
+ on = false;
142
+ const tm = (t0 + t) / 2;
143
+ const th = thetaAt(tm);
144
+ const J = legAt(st, side, th);
145
+ out.push([bodyPos(th).x + J.F[0] * S, legZ(st, side) * S, t0, (rnd() - 0.5) * 0.25]);
146
+ }
147
+ }
148
+ }
149
+ return out;
150
+ }
151
+
152
+ // ------------------------------------------------------------ the operator's pointer
153
+ const REST = [[820, 430], [700, 480], [900, 380], [760, 520], [640, 420]];
154
+ export function makeCursor(ui) {
155
+ const EV = SCRIPT.filter((e) => e.t > 0).map((e) => {
156
+ const key = e.iso !== undefined ? 'iso' : e.trace !== undefined ? 'trace' : e.wind ? 'wind' : e.view;
157
+ return {t: e.t, key, spot: key === 'wind' ? ui.knobAt(e.wind[0]) : ui.spots[key], drag: key === 'wind' ? e.wind[2] : 0};
158
+ });
159
+ const WP = [[0, 840, 560]];
160
+ EV.forEach((e, i) => {
161
+ WP.push([e.t - 0.16, ...e.spot]);
162
+ if (e.drag) {
163
+ for (let k = 0; k <= 12; k++) {
164
+ const tt = e.t + (k / 12) * e.drag;
165
+ WP.push([tt + 0.02, ...ui.knobAt(windAt(tt) - 0.35 * Math.sin(tt * 0.9) - 0.2 * Math.sin(tt * 2.3 + 1))]);
166
+ }
167
+ WP.push([e.t + e.drag + 0.3, ...ui.knobAt(SCRIPT.find((x) => x.wind).wind[1])]);
168
+ } else WP.push([e.t + 0.24, ...e.spot]);
169
+ WP.push([e.t + e.drag + 1.7, ...REST[i % REST.length]]);
170
+ });
171
+ WP.sort((a, b) => a[0] - b[0]);
172
+ return (t) => {
173
+ let i = 0;
174
+ while (i < WP.length - 2 && t > WP[i + 1][0]) i++;
175
+ const [t0, x0, y0] = WP[i];
176
+ const [t1, x1, y1] = WP[i + 1];
177
+ const lin = WP[i + 1][0] - WP[i][0] < 0.2;
178
+ const k = lin ? Math.min(1, Math.max(0, (t - t0) / (t1 - t0))) : ss(t0, t1, t);
179
+ const len = Math.hypot(x1 - x0, y1 - y0);
180
+ const bow = lin ? 0 : Math.sin(Math.PI * k) * Math.min(26, len * 0.07);
181
+ let press = false;
182
+ let drag = false;
183
+ let ring = 0;
184
+ let rx = 0;
185
+ let ry = 0;
186
+ for (const e of EV) {
187
+ if (t >= e.t - 0.07 && t < e.t + Math.max(0.09, e.drag + 0.1)) press = true;
188
+ if (e.drag && t >= e.t && t < e.t + e.drag + 0.1) drag = true;
189
+ if (t >= e.t && t < e.t + 0.55) {
190
+ ring = 1 - (t - e.t) / 0.55;
191
+ [rx, ry] = e.spot;
192
+ }
193
+ }
194
+ return {x: x0 + (x1 - x0) * k + (len ? (-(y1 - y0) / len) * bow : 0), y: y0 + (y1 - y0) * k + (len ? ((x1 - x0) / len) * bow : 0), press, drag, ring, ringX: rx, ringY: ry};
195
+ };
196
+ }
197
+
198
+ // ------------------------------------------------------------ console data for a frame
199
+ const CALLS = [
200
+ {name: 'SAIL ARRAY', sub: '10 SAILS · 0.9 m² EACH', pt: (B) => [6, 66, B.zs(6)]},
201
+ {name: 'CRANKSHAFT', sub: '10 THROWS · 36° APART', pt: (B) => [0, 0, B.zs(8)]},
202
+ {name: 'JANSEN LEG', sub: '11 BARS · 1 CRANK · NO MOTOR', pt: (B, th) => {
203
+ const J = legAt(3, 0, th);
204
+ return [(J.C[0] + J.E[0]) / 2, (J.C[1] + J.E[1]) / 2, legZ(3, 0)];
205
+ }},
206
+ {name: 'RUBBER FOOT', sub: 'ON THE SAND FOR 155° OF CRANK', pt: (B, th) => [legAt(1, 0, th).F[0], legAt(1, 0, th).F[1], legZ(1, 0)]},
207
+ ];
208
+ const CALL_VIEWS = {cine: 1, front: 1, side: 0, leg: 0, top: 0};
209
+ const FILM_SRC = {thetaAt: (t) => thetaAt(t), windAt: (t) => windAt(t)};
210
+
211
+ // src gives the crank angle and the wind at any recent time (the film's integral, or the live page's history);
212
+ // ops.labelStart is when the leg was last isolated, ops.trace whether the TRACE FEET button is lit
213
+ export function makeConsoleFrame(ui, st, src = FILM_SRC) {
214
+ const {thetaAt, windAt} = src;
215
+ const legLift = (s, side, th) => {
216
+ const ps = th + phaseOf(s);
217
+ return footLift(side ? Math.PI - ps : ps);
218
+ };
219
+ return (t, ops) => {
220
+ const th = thetaAt(t);
221
+ const wind = windAt(t);
222
+ const rps = rpsAt(wind);
223
+ const {view, since, iso, cursor} = ops;
224
+ const LABEL_T = labelTimes(ops.labelStart ?? ISO_T);
225
+ // the contact chart: 150 columns over the last 3 s, a run per stance
226
+ const gait = [];
227
+ for (let r = 0; r < 20; r++) {
228
+ const s = r % 10;
229
+ const side = r < 10 ? 0 : 1;
230
+ const runs = [];
231
+ let a = -1;
232
+ for (let c = 0; c <= 150; c++) {
233
+ const on = legLift(s, side, thetaAt(t - 3 + (c / 150) * 3)) < 0.6;
234
+ if (on && a < 0) a = c / 150;
235
+ if ((!on || c === 150) && a >= 0) {
236
+ runs.push([a, c / 150]);
237
+ a = -1;
238
+ }
239
+ }
240
+ gait.push(runs);
241
+ }
242
+ let feetDown = 0;
243
+ for (let r = 0; r < 20; r++) if (legLift(r % 10, r < 10 ? 0 : 1, th) < 0.6) feetDown++;
244
+ const liftHist = [];
245
+ const bodyHist = [];
246
+ let bodyMax = 0;
247
+ for (let i = 0; i <= 120; i++) {
248
+ const tt = t - 4 + (i / 120) * 4;
249
+ const tth = thetaAt(tt);
250
+ liftHist.push(legLift(0, 0, tth) * 12);
251
+ const low = st.bodyPos(tth).y;
252
+ bodyHist.push((low - st.bodyPos(0).y) * 1000);
253
+ bodyMax = Math.max(bodyMax, Math.abs((low - st.bodyPos(0).y) * 1000));
254
+ }
255
+ const windHist = Array.from({length: 97}, (_, i) => windAt(t - 12 + i * 0.125));
256
+ // the holy numbers and the hero's letters
257
+ const rows = {};
258
+ const tags = [];
259
+ const dims = [];
260
+ const J = st.beast.out.heroJ;
261
+ const z = st.beast.out.heroZ;
262
+ const W = (u, v) => st.project(...st.beastWorld(u, v, z));
263
+ LABELS.forEach(([k], i) => {
264
+ const tl = LABEL_T[i];
265
+ if (t >= tl) rows[k] = t - tl < 0.7 ? 2 : 1;
266
+ const o = ss(tl, tl + 0.25, t) * iso * (view === 'leg' ? 1 : 0.0);
267
+ if (o < 0.02 || !J) return;
268
+ let at;
269
+ if (k === 'a') at = W(-19, 0);
270
+ else if (k === 'l') at = W(-38, -3.9);
271
+ else if (k === 'm') at = W(J.A[0] / 2, J.A[1] / 2);
272
+ else {
273
+ const pair = {j: ['A', 'B'], k: ['A', 'C'], b: ['P', 'B'], c: ['P', 'C'], d: ['P', 'D'], e: ['B', 'D'], f: ['D', 'E'], g: ['C', 'E'], h: ['E', 'F'], i: ['C', 'F']}[k];
274
+ at = W((J[pair[0]][0] + J[pair[1]][0]) / 2, (J[pair[0]][1] + J[pair[1]][1]) / 2);
275
+ }
276
+ if (at) tags.push({k, at, o, lit: rows[k] === 2});
277
+ if (k === 'a') {
278
+ const A = W(0, 0);
279
+ const B = W(-38, 0);
280
+ if (A && B) dims.push({a: A, b: B, o});
281
+ }
282
+ if (k === 'l') {
283
+ const A = W(-38, 0);
284
+ const B = W(-38, -7.8);
285
+ if (A && B) dims.push({a: A, b: B, o});
286
+ }
287
+ });
288
+ // callouts on the beast in the wide views
289
+ const vw = (CALL_VIEWS[view] ?? 0) * ss(1.2, 1.9, since) * (1 - iso);
290
+ const callouts = CALLS.map((c) => {
291
+ if (vw < 0.02) return {o: 0};
292
+ const at = st.project(...st.beastWorld(...c.pt(st.beast, th)));
293
+ if (!at || at[0] < 40 || at[0] > 1560 || at[1] < 60 || at[1] > 720 || ui.covered(at[0], at[1])) return {o: 0};
294
+ const dx = at[0] < 790 ? -70 : 70;
295
+ if (ui.covered(at[0] + dx + (dx < 0 ? -170 : 170), at[1] - 64)) return {o: 0};
296
+ return {...c, at, dx, dy: -64, o: vw};
297
+ });
298
+ ui.update({
299
+ wind,
300
+ rpm: rps * 60,
301
+ speed: rps * Math.abs(STRIDE) * S,
302
+ feetDown,
303
+ dist: ops.dist ?? Math.abs(st.bodyPos(th).x - st.bodyPos(0).x),
304
+ crankDeg: (th * 180) / Math.PI,
305
+ leg: legAt(0, 0, th),
306
+ rows,
307
+ gait,
308
+ throws: Array.from({length: 10}, (_, s) => th + phaseOf(s)),
309
+ liftHist,
310
+ bodyHist,
311
+ liftMM: legLift(0, 0, th) * 12,
312
+ bodyMM: Math.max(0.1, bodyMax),
313
+ windHist,
314
+ drag: cursor.drag,
315
+ viewOn: Object.fromEntries(VIEW_KEYS.map((k) => [k, k === view ? 1 : 0])),
316
+ iso,
317
+ trace: ops.trace ?? traceState(t).on,
318
+ tags,
319
+ dims,
320
+ callouts,
321
+ cursor,
322
+ });
323
+ };
324
+ }
325
+
326
+ export function makeFilm() {
327
+ return async ({cfg, canvas, capture}) => {
328
+ const st = createBeestStage({canvas, palette: cfg.palette ?? 'dune', ink: cfg.ink ?? 0.7});
329
+ const resize = () => st.resize(1600, 900, capture ? devicePixelRatio || 1 : Math.min(devicePixelRatio || 1, 2));
330
+ resize();
331
+ st.setPrints(footprints(st.bodyPos));
332
+ const ui = createConsole(document.getElementById('app'));
333
+ const cursorAt = makeCursor(ui);
334
+ const frame = makeConsoleFrame(ui, st);
335
+ window.BEEST = st;
336
+ return {
337
+ resize,
338
+ render(t) {
339
+ const th = thetaAt(t);
340
+ const b = st.bodyPos(th);
341
+ const iso = isoAt(t);
342
+ const ts = traceState(t);
343
+ st.frame(th, t, toCam(viewAt(t, b.x)), {wind: windAt(t), flow: flowAt(t) * 0.35, iso, hero: HERO, ...ts});
344
+ const [t0, view] = scriptView(t);
345
+ frame(t, {view, since: t - t0, iso, cursor: cursorAt(t)});
346
+ return {};
347
+ },
348
+ };
349
+ };
350
+ }
351
+
352
+ export const run = () => runSim(DEFAULTS, makeFilm());
@@ -0,0 +1,67 @@
1
+ // Theo Jansen's linkage, solved exactly. Eleven "holy numbers" (the link lengths Jansen evolved in 1990) plus the
2
+ // crank: turn the crank and every joint follows by circle intersection, no IK, no springs. The foot traces the
3
+ // classic path: a flat bottom for ~155° of crank, then a 22-unit lift back. Units are Jansen's own (≈ cm).
4
+ export const HOLY = {a: 38, b: 41.5, c: 39.3, d: 40.1, e: 55.8, f: 39.4, g: 36.7, h: 65.7, i: 49, j: 50, k: 61.9, l: 7.8, m: 15};
5
+ const {a, b, c, d, e, f, g, h, i, j, k, l, m} = HOLY;
6
+ export const PIVOT = [-a, -l];
7
+
8
+ // the two points at distance r0 from p0 and r1 from p1; pick chooses one
9
+ const cc = (p0, r0, p1, r1, pick) => {
10
+ const dx = p1[0] - p0[0];
11
+ const dy = p1[1] - p0[1];
12
+ const D = Math.hypot(dx, dy);
13
+ const A = (r0 * r0 - r1 * r1 + D * D) / (2 * D);
14
+ const H = Math.sqrt(Math.max(0, r0 * r0 - A * A));
15
+ const mx = p0[0] + (A * dx) / D;
16
+ const my = p0[1] + (A * dy) / D;
17
+ return pick([mx + (H * dy) / D, my - (H * dx) / D], [mx - (H * dy) / D, my + (H * dx) / D]);
18
+ };
19
+ const hiY = (s, t) => (s[1] > t[1] ? s : t);
20
+ const loY = (s, t) => (s[1] < t[1] ? s : t);
21
+ const loX = (s, t) => (s[0] < t[0] ? s : t);
22
+
23
+ /** Every joint of one leg for crank angle th (radians), crank axle at the origin, foot toward -x. */
24
+ export function solveLeg(th) {
25
+ const A = [m * Math.cos(th), m * Math.sin(th)];
26
+ const B = cc(A, j, PIVOT, b, hiY);
27
+ const C = cc(A, k, PIVOT, c, loY);
28
+ const D = cc(B, e, PIVOT, d, loX);
29
+ const E = cc(D, f, C, g, loX);
30
+ const F = cc(E, h, C, i, loY);
31
+ return {O: [0, 0], P: PIVOT, A, B, C, D, E, F};
32
+ }
33
+ /** The mirrored leg on the same crank pin: foot toward +x, pushing the same way. */
34
+ export function solveMirror(th) {
35
+ const s = solveLeg(Math.PI - th);
36
+ const out = {};
37
+ for (const key in s) out[key] = [-s[key][0], s[key][1]];
38
+ return out;
39
+ }
40
+ // the links of one leg as joint pairs, with the holy number each one carries
41
+ export const LINKS = [
42
+ ['A', 'B', 'j'],
43
+ ['A', 'C', 'k'],
44
+ ['P', 'B', 'b'],
45
+ ['P', 'C', 'c'],
46
+ ['P', 'D', 'd'],
47
+ ['B', 'D', 'e'],
48
+ ['D', 'E', 'f'],
49
+ ['C', 'E', 'g'],
50
+ ['E', 'F', 'h'],
51
+ ['C', 'F', 'i'],
52
+ ];
53
+ export const JOINTS = ['B', 'C', 'D', 'E', 'P'];
54
+
55
+ // the foot path sampled once: its floor, its stride, and the stance velocity used to move the body without slip
56
+ const N = 720;
57
+ export const PATH = Array.from({length: N}, (_, n) => solveLeg((n / N) * Math.PI * 2).F);
58
+ export const FOOT_MIN = Math.min(...PATH.map((p) => p[1]));
59
+ export const FOOT_MAX = Math.max(...PATH.map((p) => p[1]));
60
+ /** How far above its lowest point the foot is at crank angle th (0 = planted). */
61
+ export const footLift = (th) => {
62
+ const u = ((((th / (Math.PI * 2)) % 1) + 1) % 1) * N;
63
+ const n = Math.floor(u);
64
+ const p0 = PATH[n % N][1];
65
+ const p1 = PATH[(n + 1) % N][1];
66
+ return p0 + (p1 - p0) * (u - n) - FOOT_MIN;
67
+ };