kasaframe 0.0.0-stage → 0.1.1

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 (338) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +146 -0
  3. package/README.md +77 -2
  4. package/app/package.json +12 -0
  5. package/app/server/engine.ts +415 -0
  6. package/app/server/main.ts +205 -0
  7. package/app/web/env.d.ts +2 -0
  8. package/app/web/icons.ts +31 -0
  9. package/app/web/index.html +21 -0
  10. package/app/web/main.ts +1013 -0
  11. package/app/web/style.css +430 -0
  12. package/bin/hooks.mjs +51 -0
  13. package/bin/kf.mjs +14 -0
  14. package/docs/AGENTS.md +238 -0
  15. package/music/README.md +13 -0
  16. package/package.json +44 -4
  17. package/packages/adapters/package.json +36 -0
  18. package/packages/adapters/src/css.ts +11 -0
  19. package/packages/adapters/src/gsap.ts +26 -0
  20. package/packages/adapters/src/index.ts +9 -0
  21. package/packages/adapters/src/lottie.ts +22 -0
  22. package/packages/adapters/src/media.ts +59 -0
  23. package/packages/adapters/src/page.ts +229 -0
  24. package/packages/adapters/src/project.ts +214 -0
  25. package/packages/adapters/src/react.ts +36 -0
  26. package/packages/adapters/src/svelte.ts +22 -0
  27. package/packages/adapters/src/three.ts +18 -0
  28. package/packages/adapters/src/vue.ts +27 -0
  29. package/packages/check/package.json +19 -0
  30. package/packages/check/src/check.ts +273 -0
  31. package/packages/check/src/cli.ts +70 -0
  32. package/packages/check/src/image.ts +146 -0
  33. package/packages/check/src/index.ts +9 -0
  34. package/packages/check/src/ocr.swift +37 -0
  35. package/packages/check/src/probe.ts +328 -0
  36. package/packages/check/src/report.ts +44 -0
  37. package/packages/check/src/rules/assets.ts +42 -0
  38. package/packages/check/src/rules/beats.ts +212 -0
  39. package/packages/check/src/rules/camera.ts +217 -0
  40. package/packages/check/src/rules/captions.ts +49 -0
  41. package/packages/check/src/rules/flash.ts +235 -0
  42. package/packages/check/src/rules/frames.ts +135 -0
  43. package/packages/check/src/rules/layout.ts +257 -0
  44. package/packages/check/src/rules/page.ts +87 -0
  45. package/packages/check/src/rules/runs.ts +20 -0
  46. package/packages/check/src/rules/text.ts +326 -0
  47. package/packages/check/src/scan.ts +240 -0
  48. package/packages/check/src/serve.ts +67 -0
  49. package/packages/check/src/types.ts +80 -0
  50. package/packages/check/src/video.ts +137 -0
  51. package/packages/cli/package.json +29 -0
  52. package/packages/cli/src/blur.ts +68 -0
  53. package/packages/cli/src/browser.ts +203 -0
  54. package/packages/cli/src/command.ts +44 -0
  55. package/packages/cli/src/commands/app.ts +25 -0
  56. package/packages/cli/src/commands/beats.ts +36 -0
  57. package/packages/cli/src/commands/blender.ts +270 -0
  58. package/packages/cli/src/commands/check.ts +25 -0
  59. package/packages/cli/src/commands/doctor.ts +22 -0
  60. package/packages/cli/src/commands/gen.ts +173 -0
  61. package/packages/cli/src/commands/look.ts +39 -0
  62. package/packages/cli/src/commands/lyrics.ts +111 -0
  63. package/packages/cli/src/commands/make.ts +542 -0
  64. package/packages/cli/src/commands/new.ts +176 -0
  65. package/packages/cli/src/commands/preview.ts +43 -0
  66. package/packages/cli/src/commands/render.ts +216 -0
  67. package/packages/cli/src/commands/setup.ts +63 -0
  68. package/packages/cli/src/commands/sheet.ts +114 -0
  69. package/packages/cli/src/commands/skill.ts +43 -0
  70. package/packages/cli/src/commands/still.ts +40 -0
  71. package/packages/cli/src/commands/theme.ts +85 -0
  72. package/packages/cli/src/commands/transitions.ts +40 -0
  73. package/packages/cli/src/deps.ts +122 -0
  74. package/packages/cli/src/ffmpeg.ts +81 -0
  75. package/packages/cli/src/index.ts +8 -0
  76. package/packages/cli/src/kf.ts +53 -0
  77. package/packages/cli/src/lock.ts +72 -0
  78. package/packages/cli/src/out.ts +13 -0
  79. package/packages/cli/src/serve.ts +124 -0
  80. package/packages/clock/package.json +14 -0
  81. package/packages/clock/src/index.ts +25 -0
  82. package/packages/clock/src/install.ts +351 -0
  83. package/packages/clock/src/types.ts +45 -0
  84. package/packages/core/package.json +9 -0
  85. package/packages/core/src/beats.ts +283 -0
  86. package/packages/core/src/ease.ts +87 -0
  87. package/packages/core/src/frame.ts +99 -0
  88. package/packages/core/src/index.ts +27 -0
  89. package/packages/core/src/project.ts +146 -0
  90. package/packages/core/src/rand.ts +56 -0
  91. package/packages/core/src/spring.ts +52 -0
  92. package/packages/core/src/style.ts +100 -0
  93. package/packages/core/src/time.ts +88 -0
  94. package/packages/gen/PROVIDERS.md +55 -0
  95. package/packages/gen/package.json +9 -0
  96. package/packages/gen/src/generate.ts +204 -0
  97. package/packages/gen/src/image/og.ts +133 -0
  98. package/packages/gen/src/index.ts +18 -0
  99. package/packages/gen/src/keys.ts +60 -0
  100. package/packages/gen/src/media.ts +150 -0
  101. package/packages/gen/src/plan.ts +106 -0
  102. package/packages/gen/src/registry.ts +51 -0
  103. package/packages/gen/src/seam.ts +103 -0
  104. package/packages/gen/src/types.ts +86 -0
  105. package/packages/gen/src/video/fal.ts +140 -0
  106. package/packages/gen/src/video/h3.ts +107 -0
  107. package/packages/gen/src/video/http.ts +44 -0
  108. package/packages/gen/src/video/ltx.ts +60 -0
  109. package/packages/gen/src/video/minimax.ts +55 -0
  110. package/packages/gen/src/video/veo.ts +71 -0
  111. package/packages/jizura/package.json +16 -0
  112. package/packages/jizura/src/deny.ts +73 -0
  113. package/packages/jizura/src/index.ts +7 -0
  114. package/packages/jizura/src/install.ts +226 -0
  115. package/packages/jizura/src/layer.ts +282 -0
  116. package/packages/jizura/src/lyrics.ts +81 -0
  117. package/packages/jizura/src/pin.ts +5 -0
  118. package/packages/jizura/src/vite.ts +36 -0
  119. package/packages/motion/README.md +142 -0
  120. package/packages/motion/package.json +29 -0
  121. package/packages/motion/src/camera.ts +97 -0
  122. package/packages/motion/src/captions.ts +479 -0
  123. package/packages/motion/src/enter.ts +128 -0
  124. package/packages/motion/src/hangul.ts +129 -0
  125. package/packages/motion/src/impact.ts +100 -0
  126. package/packages/motion/src/index.ts +17 -0
  127. package/packages/motion/src/moves/brushWipe.ts +90 -0
  128. package/packages/motion/src/moves/cloneArray.ts +111 -0
  129. package/packages/motion/src/moves/curtains.ts +81 -0
  130. package/packages/motion/src/moves/echoStack.ts +70 -0
  131. package/packages/motion/src/moves/fit.ts +34 -0
  132. package/packages/motion/src/moves/flood.ts +61 -0
  133. package/packages/motion/src/moves/ghostStack.ts +79 -0
  134. package/packages/motion/src/moves/gridFloor.ts +100 -0
  135. package/packages/motion/src/moves/imageSwarm.ts +109 -0
  136. package/packages/motion/src/moves/index.ts +19 -0
  137. package/packages/motion/src/moves/irisBlades.ts +113 -0
  138. package/packages/motion/src/moves/karaokeLine.ts +94 -0
  139. package/packages/motion/src/moves/ledBoard.ts +94 -0
  140. package/packages/motion/src/moves/liquidTab.ts +72 -0
  141. package/packages/motion/src/moves/markerWrite.ts +63 -0
  142. package/packages/motion/src/moves/morphBox.ts +96 -0
  143. package/packages/motion/src/moves/neonSign.ts +77 -0
  144. package/packages/motion/src/moves/panelPop.ts +78 -0
  145. package/packages/motion/src/moves/paperTear.ts +75 -0
  146. package/packages/motion/src/moves/path.ts +64 -0
  147. package/packages/motion/src/moves/pathText.ts +107 -0
  148. package/packages/motion/src/moves/pointSphere.ts +109 -0
  149. package/packages/motion/src/moves/ransomLetters.ts +73 -0
  150. package/packages/motion/src/moves/shapeMorph.ts +143 -0
  151. package/packages/motion/src/moves/slamWords.ts +89 -0
  152. package/packages/motion/src/moves/sparkTrail.ts +114 -0
  153. package/packages/motion/src/moves/speedLines.ts +91 -0
  154. package/packages/motion/src/moves/splitFlap.ts +147 -0
  155. package/packages/motion/src/moves/stepWords.ts +117 -0
  156. package/packages/motion/src/moves/strikeOut.ts +98 -0
  157. package/packages/motion/src/moves/sunburst.ts +58 -0
  158. package/packages/motion/src/moves/tickerRows.ts +87 -0
  159. package/packages/motion/src/moves/tokenPicker.ts +114 -0
  160. package/packages/motion/src/moves/truchet.ts +85 -0
  161. package/packages/motion/src/moves/wordWall.ts +76 -0
  162. package/packages/motion/src/moves/worldRoll.ts +31 -0
  163. package/packages/motion/src/particles.ts +102 -0
  164. package/packages/motion/src/react/index.tsx +21 -0
  165. package/packages/motion/src/react/parts.tsx +431 -0
  166. package/packages/motion/src/react/time.tsx +97 -0
  167. package/packages/motion/src/text.ts +103 -0
  168. package/packages/motion/src/transition.ts +82 -0
  169. package/packages/motion/src/transition3d/cards.ts +65 -0
  170. package/packages/motion/src/transition3d/chain.ts +84 -0
  171. package/packages/motion/src/transition3d/dive.ts +181 -0
  172. package/packages/motion/src/transition3d/fold.ts +110 -0
  173. package/packages/motion/src/transition3d/gl.ts +219 -0
  174. package/packages/motion/src/transition3d/index.ts +228 -0
  175. package/packages/motion/src/transition3d/live.ts +70 -0
  176. package/packages/motion/src/transition3d/portal.ts +115 -0
  177. package/packages/motion/src/transition3d/react.tsx +29 -0
  178. package/packages/motion/src/transition3d/rig.ts +502 -0
  179. package/packages/motion/src/transition3d/shatter.ts +101 -0
  180. package/packages/motion/src/transition3d/whip.ts +65 -0
  181. package/packages/motion/src/transition3d/world.ts +683 -0
  182. package/packages/motion/src/transition3d/zoomOut.ts +114 -0
  183. package/packages/motion/src/transitions2d/catalog.ts +127 -0
  184. package/packages/motion/src/transitions2d/css.d.ts +2 -0
  185. package/packages/motion/src/transitions2d/cult-ui/LICENSE.md +9 -0
  186. package/packages/motion/src/transitions2d/cult-ui/RollingNumber.tsx +43 -0
  187. package/packages/motion/src/transitions2d/gl-transitions/LICENSE +25 -0
  188. package/packages/motion/src/transitions2d/gl-transitions/shaders.ts +1931 -0
  189. package/packages/motion/src/transitions2d/index.ts +2 -0
  190. package/packages/motion/src/transitions2d/kokonutui/LICENSE +21 -0
  191. package/packages/motion/src/transitions2d/kokonutui/MatrixText.css +16 -0
  192. package/packages/motion/src/transitions2d/kokonutui/MatrixText.tsx +94 -0
  193. package/packages/motion/src/transitions2d/magicui/HyperText.css +15 -0
  194. package/packages/motion/src/transitions2d/magicui/HyperText.tsx +115 -0
  195. package/packages/motion/src/transitions2d/magicui/LICENSE.md +21 -0
  196. package/packages/motion/src/transitions2d/magicui/MorphingText.css +25 -0
  197. package/packages/motion/src/transitions2d/magicui/MorphingText.tsx +130 -0
  198. package/packages/motion/src/transitions2d/magicui/WordRotate.tsx +42 -0
  199. package/packages/motion/src/transitions2d/react.ts +13 -0
  200. package/packages/motion/src/transitions2d/skiper-ui/ClipDiv.css +39 -0
  201. package/packages/motion/src/transitions2d/skiper-ui/ClipDiv.tsx +32 -0
  202. package/packages/motion/src/transitions2d/smoothui/LICENSE +21 -0
  203. package/packages/motion/src/transitions2d/smoothui/SharedAxisY.tsx +50 -0
  204. package/packages/motion/src/transitions2d/smoothui/TextMorph.tsx +90 -0
  205. package/packages/motion/src/transitions2d/smoothui/shaders.ts +223 -0
  206. package/packages/motion/src/transitions2d/unlumen/LICENSE +21 -0
  207. package/packages/motion/src/transitions2d/unlumen/ScrambleText.tsx +114 -0
  208. package/packages/motion/src/transitions2d/vengeance-ui/LICENSE +21 -0
  209. package/packages/motion/src/transitions2d/vengeance-ui/MorphText.css +69 -0
  210. package/packages/motion/src/transitions2d/vengeance-ui/MorphText.tsx +45 -0
  211. package/packages/motion/src/type.ts +131 -0
  212. package/packages/motion/src/ui.ts +172 -0
  213. package/packages/plan/package.json +15 -0
  214. package/packages/plan/src/brief.ts +254 -0
  215. package/packages/plan/src/captions.ts +75 -0
  216. package/packages/plan/src/detect.ts +93 -0
  217. package/packages/plan/src/index.ts +23 -0
  218. package/packages/plan/src/layout.ts +176 -0
  219. package/packages/plan/src/llm.ts +110 -0
  220. package/packages/plan/src/look.ts +220 -0
  221. package/packages/plan/src/plan.ts +125 -0
  222. package/packages/plan/src/request.ts +55 -0
  223. package/packages/plan/src/studio.ts +53 -0
  224. package/packages/plan/src/templates.ts +42 -0
  225. package/packages/plan/src/themes.ts +48 -0
  226. package/packages/plan/src/types.ts +106 -0
  227. package/packages/studio/package.json +12 -0
  228. package/packages/studio/src/index.ts +1 -0
  229. package/packages/studio/src/plugin.ts +236 -0
  230. package/packages/studio/src/ui/main.ts +503 -0
  231. package/packages/studio/src/ui/studio.css +165 -0
  232. package/packages/studio/src/ui/timeline.ts +317 -0
  233. package/packages/themes/kit/THEME-MAKE.md +68 -0
  234. package/packages/themes/kit/THEME.md +30 -0
  235. package/packages/themes/kit/briefs/og-intro-15s/brief.json +16 -0
  236. package/packages/themes/kit/briefs/og-intro-15s/facts.ts +29 -0
  237. package/packages/themes/kit/briefs/og-intro-15s/logo.svg +12 -0
  238. package/packages/themes/kit/effects.ts +5 -0
  239. package/packages/themes/kit/sample/index.html +11 -0
  240. package/packages/themes/kit/sample/main.ts +9 -0
  241. package/packages/themes/kit/sample/scenes/scene.ts +15 -0
  242. package/packages/themes/package.json +16 -0
  243. package/packages/themes/src/factory.ts +296 -0
  244. package/packages/themes/src/fx.ts +14 -0
  245. package/packages/themes/src/index.ts +105 -0
  246. package/packages/themes/src/stage3d.ts +177 -0
  247. package/packages/themes/src/types.ts +58 -0
  248. package/presets/kawaii-pastel.json +94 -0
  249. package/presets/neutral-dark.json +82 -0
  250. package/presets/og.json +98 -0
  251. package/skills/kasaframe/SKILL.md +32 -0
  252. package/templates/_shared/project/index.html +11 -0
  253. package/templates/_shared/project/lib/react.ts +22 -0
  254. package/templates/_shared/project/lib/stage.ts +272 -0
  255. package/templates/_shared/project/main.ts +9 -0
  256. package/templates/_shared/scenes/default.ts +18 -0
  257. package/templates/_shared/scenes/drop.ts +30 -0
  258. package/templates/_shared/scenes/end.ts +23 -0
  259. package/templates/_shared/scenes/hook.ts +16 -0
  260. package/templates/_shared/scenes/seam.ts +41 -0
  261. package/templates/_shared/scenes/step.ts +40 -0
  262. package/templates/ad/preview.png +0 -0
  263. package/templates/ad/template.json +132 -0
  264. package/templates/demo/preview.png +0 -0
  265. package/templates/demo/template.json +130 -0
  266. package/templates/explainer/preview.png +0 -0
  267. package/templates/explainer/template.json +142 -0
  268. package/templates/launch/preview.png +0 -0
  269. package/templates/launch/template.json +130 -0
  270. package/templates/mv/preview.png +0 -0
  271. package/templates/mv/scenes/default.ts +95 -0
  272. package/templates/mv/template.json +176 -0
  273. package/templates/promo/preview.png +0 -0
  274. package/templates/promo/template.json +144 -0
  275. package/templates/shorts/preview.png +0 -0
  276. package/templates/shorts/scenes/hook.ts +34 -0
  277. package/templates/shorts/template.json +127 -0
  278. package/templates/square/preview.png +0 -0
  279. package/templates/square/template.json +113 -0
  280. package/themes/debug-hud/THEME.md +39 -0
  281. package/themes/debug-hud/effects.ts +389 -0
  282. package/themes/debug-hud/sample/assets/og/logo.svg +12 -0
  283. package/themes/debug-hud/sample/beats.json +1 -0
  284. package/themes/debug-hud/sample/index.html +11 -0
  285. package/themes/debug-hud/sample/kf.json +59 -0
  286. package/themes/debug-hud/sample/lib/hudkit.ts +49 -0
  287. package/themes/debug-hud/sample/lib/og.ts +29 -0
  288. package/themes/debug-hud/sample/main.ts +9 -0
  289. package/themes/debug-hud/sample/scenes/end.ts +62 -0
  290. package/themes/debug-hud/sample/scenes/gather.ts +67 -0
  291. package/themes/debug-hud/sample/scenes/models.ts +70 -0
  292. package/themes/debug-hud/sample/scenes/price.ts +79 -0
  293. package/themes/debug-hud/sample/style.json +91 -0
  294. package/themes/debug-hud/still.png +0 -0
  295. package/themes/debug-hud/style.json +91 -0
  296. package/themes/debug-hud/theme.json +68 -0
  297. package/themes/og-measure/THEME.md +47 -0
  298. package/themes/og-measure/effects.ts +432 -0
  299. package/themes/og-measure/sample/assets/brand/og-logo-full.svg +12 -0
  300. package/themes/og-measure/sample/assets/brand/og-logo.svg +12 -0
  301. package/themes/og-measure/sample/assets/data/measure.json +353 -0
  302. package/themes/og-measure/sample/beats.json +1 -0
  303. package/themes/og-measure/sample/index.html +11 -0
  304. package/themes/og-measure/sample/kf.json +66 -0
  305. package/themes/og-measure/sample/lib/data.ts +62 -0
  306. package/themes/og-measure/sample/main.ts +9 -0
  307. package/themes/og-measure/sample/measure.ts +78 -0
  308. package/themes/og-measure/sample/scenes/end.ts +47 -0
  309. package/themes/og-measure/sample/scenes/gather.ts +51 -0
  310. package/themes/og-measure/sample/scenes/models.ts +34 -0
  311. package/themes/og-measure/sample/scenes/one.ts +39 -0
  312. package/themes/og-measure/sample/scenes/price.ts +56 -0
  313. package/themes/og-measure/sample/style.json +97 -0
  314. package/themes/og-measure/still.png +0 -0
  315. package/themes/og-measure/style.json +97 -0
  316. package/themes/og-measure/theme.json +79 -0
  317. package/themes/riso-zine/THEME.md +43 -0
  318. package/themes/riso-zine/effects.ts +321 -0
  319. package/themes/riso-zine/sample/assets/og/logo.svg +12 -0
  320. package/themes/riso-zine/sample/beats.json +1 -0
  321. package/themes/riso-zine/sample/index.html +11 -0
  322. package/themes/riso-zine/sample/kf.json +59 -0
  323. package/themes/riso-zine/sample/lib/og.ts +29 -0
  324. package/themes/riso-zine/sample/lib/shot.ts +86 -0
  325. package/themes/riso-zine/sample/lib/zine.ts +42 -0
  326. package/themes/riso-zine/sample/main.ts +9 -0
  327. package/themes/riso-zine/sample/scenes/end.ts +61 -0
  328. package/themes/riso-zine/sample/scenes/gather.ts +62 -0
  329. package/themes/riso-zine/sample/scenes/models.ts +52 -0
  330. package/themes/riso-zine/sample/scenes/price.ts +82 -0
  331. package/themes/riso-zine/sample/style.json +99 -0
  332. package/themes/riso-zine/still.png +0 -0
  333. package/themes/riso-zine/style.json +99 -0
  334. package/themes/riso-zine/theme.json +75 -0
  335. package/tools/beats/beats.py +372 -0
  336. package/tools/beats/requirements.txt +3 -0
  337. package/tools/lyrics/align.py +164 -0
  338. package/tools/lyrics/requirements.txt +9 -0
@@ -0,0 +1,321 @@
1
+ import { applyStyle, clamp, rand, randRange, type SceneCtx, type Style } from "@kasaframe/core";
2
+ import { beatPulse, dropBurst, type DropBurstState } from "@kasaframe/motion";
3
+
4
+ // 리소는 판을 한 장씩 찍어 넘기는 인쇄라 움직임도 초당 12장으로 끊는다 — 60fps 보간이 들어가면 화면이 아니라 영상처럼 보인다
5
+ const FPS = 12;
6
+
7
+ const ink = (ctx: SceneCtx, key: string): string => ctx.style.colors[key] ?? key;
8
+
9
+ type Area = [x: number, y: number, w: number, h: number];
10
+ const areas = new WeakMap<CanvasRenderingContext2D, Area>();
11
+
12
+ // 판면을 마디마다 갈아 끼우면 한 장면에 망점 판이 열 개 넘게 — 화면 전체 캔버스를 다 잡지 않고 그리는 자리만큼만, 좌표는 화면 기준 그대로
13
+ function canvas(el: HTMLElement, ctx: SceneCtx, blend = "multiply", area?: Area): CanvasRenderingContext2D {
14
+ const [x, y, w, h] = (area ?? [0, 0, ctx.meta.width, ctx.meta.height]).map((v, i) => (i < 2 ? Math.floor(v) : Math.ceil(v))) as Area;
15
+ const c = document.createElement("canvas");
16
+ c.width = Math.max(1, w);
17
+ c.height = Math.max(1, h);
18
+ c.style.cssText = `position:absolute;left:${x}px;top:${y}px;width:${w}px;height:${h}px;pointer-events:none;mix-blend-mode:${blend};`;
19
+ el.append(c);
20
+ const g = c.getContext("2d")!;
21
+ g.translate(-x, -y);
22
+ areas.set(g, [x, y, w, h]);
23
+ return g;
24
+ }
25
+
26
+ const clear = (g: CanvasRenderingContext2D): void => {
27
+ const [x, y, w, h] = areas.get(g)!;
28
+ g.clearRect(x, y, w, h);
29
+ };
30
+
31
+ /** t 를 초당 fps 장으로 끊는다(on twos). 다른 효과도 이걸 거쳐 같은 박자로 끊긴다 */
32
+ export function printFrames(t: number, fps = FPS): number {
33
+ return Math.floor(t * fps + 1e-6) / fps;
34
+ }
35
+
36
+ /**
37
+ * 판 어긋남. 판마다 시드로 정한 어긋남(±px)에 머물고, 찍히는 순간 두 장은 더 크게 어긋났다가 앉는다.
38
+ * 앉은 뒤에도 초당 12번 0.6px 안팎으로 끓는다 — 흔들림이 아니라 인쇄 결이라 검사가 세는 shake 가 아니다
39
+ */
40
+ export function misregister(t: number, o: { seed: string | number; px?: number; at?: number; boil?: number } = { seed: 0 }): Style {
41
+ const px = o.px ?? 3;
42
+ const bx = randRange(o.seed, 0, -px, px);
43
+ const by = randRange(o.seed, 1, -px, px);
44
+ const f = Math.floor((t - (o.at ?? 0)) * FPS + 1e-6);
45
+ const land = f <= 0 ? 3 : f === 1 ? 1.7 : 1;
46
+ const k = Math.floor(t * FPS + 1e-6);
47
+ const boil = o.boil ?? 0.6;
48
+ return { x: bx * land + randRange(o.seed, 10 + k * 2, -boil, boil), y: by * land + randRange(o.seed, 11 + k * 2, -boil, boil) };
49
+ }
50
+
51
+ export interface PlateOpts {
52
+ ctx: SceneCtx;
53
+ /** 판마다 잉크(style.colors 키나 색)·찍는 시각 */
54
+ plates: { ink: string; at: number; px?: number; seed?: string | number }[];
55
+ /** 판 하나에 들어갈 내용을 짓는다 — 글·SVG 는 currentColor 로 칠하면 판 잉크가 된다 */
56
+ build(plate: HTMLElement, ink: string, i: number): void;
57
+ /** 판 위에서 다른 효과가 고칠 여지(드럼 지나가기 clip 따위) */
58
+ style?(t: number, i: number): Style;
59
+ }
60
+
61
+ /** 같은 그림을 잉크 판 여러 장으로 찍는다. 판은 곱하기로 겹쳐 블루+핑크가 보라가 되고, 어긋난 가장자리에 두 색이 비친다 */
62
+ export function plateStamp(el: HTMLElement, o: PlateOpts): (t: number) => void {
63
+ const plates = o.plates.map((p, i) => {
64
+ const div = document.createElement("div");
65
+ const color = ink(o.ctx, p.ink);
66
+ div.style.cssText = `position:absolute;inset:0;mix-blend-mode:multiply;color:${color};`;
67
+ o.build(div, color, i);
68
+ el.append(div);
69
+ return { div, p, seed: p.seed ?? `${o.ctx.id}:${p.ink}:${i}` };
70
+ });
71
+ return (t) => {
72
+ plates.forEach(({ div, p, seed }, i) => {
73
+ const on = t >= p.at;
74
+ div.style.visibility = on ? "visible" : "hidden";
75
+ if (!on) return;
76
+ const m = misregister(t, { seed, px: p.px, at: p.at });
77
+ const extra = o.style?.(t, i) ?? {};
78
+ applyStyle(div, { ...extra, x: (m.x ?? 0) + (extra.x ?? 0), y: (m.y ?? 0) + (extra.y ?? 0) });
79
+ });
80
+ };
81
+ }
82
+
83
+ export interface HalftoneOpts {
84
+ ctx: SceneCtx;
85
+ x: number;
86
+ y: number;
87
+ w: number;
88
+ h: number;
89
+ ink: string;
90
+ /** 0..1 잉크 양 — (u, v) 는 상자 안 0..1. 그림을 쓰려면 src */
91
+ value?: (u: number, v: number) => number;
92
+ src?: string;
93
+ /** 망 각도. 리소 관례 블루 15° · 핑크 75° */
94
+ angle?: number;
95
+ /** 망점 간격(px) */
96
+ pitch?: number;
97
+ at?: number;
98
+ dur?: number;
99
+ /** grow: 망점이 끊어 자란다 · sweep: 드럼이 지나간 줄부터 찍힌다(dir 방향) */
100
+ reveal?: "grow" | "sweep";
101
+ dir?: "down" | "right";
102
+ /** 드롭 구간에서 박마다 망점이 부푼다(style.json beatPulse) */
103
+ pulse?: boolean;
104
+ }
105
+
106
+ /** 망점 판. 값이 큰 곳일수록 점이 크다 — 그라데이션은 이것으로만 */
107
+ export function halftone(el: HTMLElement, o: HalftoneOpts): (t: number) => void {
108
+ const { ctx } = o;
109
+ const g = canvas(el, ctx, "multiply", [o.x - 20, o.y - 20, o.w + 40, o.h + 40]);
110
+ const pitch = o.pitch ?? 14;
111
+ const a = ((o.angle ?? 15) * Math.PI) / 180;
112
+ const cx = o.x + o.w / 2;
113
+ const cy = o.y + o.h / 2;
114
+ const half = Math.hypot(o.w, o.h) / 2;
115
+ const n = Math.ceil(half / pitch);
116
+ const pts: { x: number; y: number; u: number; v: number }[] = [];
117
+ for (let j = -n; j <= n; j++) {
118
+ for (let i = -n; i <= n; i++) {
119
+ const x = cx + Math.cos(a) * i * pitch - Math.sin(a) * j * pitch;
120
+ const y = cy + Math.sin(a) * i * pitch + Math.cos(a) * j * pitch;
121
+ if (x < o.x || x > o.x + o.w || y < o.y || y > o.y + o.h) continue;
122
+ pts.push({ x, y, u: (x - o.x) / o.w, v: (y - o.y) / o.h });
123
+ }
124
+ }
125
+ let vals: number[] | null = o.value ? pts.map((p) => clamp(o.value!(p.u, p.v))) : null;
126
+ let img: HTMLImageElement | null = null;
127
+ if (o.src) {
128
+ img = document.createElement("img");
129
+ img.src = o.src;
130
+ img.style.cssText = "position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;";
131
+ el.append(img);
132
+ }
133
+ const fromImage = (): number[] | null => {
134
+ if (!img || !img.complete || !img.naturalWidth) return null;
135
+ const off = document.createElement("canvas");
136
+ off.width = Math.ceil(o.w / 4);
137
+ off.height = Math.ceil(o.h / 4);
138
+ const s = off.getContext("2d", { willReadFrequently: true })!;
139
+ const k = Math.min(off.width / img.naturalWidth, off.height / img.naturalHeight);
140
+ s.drawImage(img, (off.width - img.naturalWidth * k) / 2, (off.height - img.naturalHeight * k) / 2, img.naturalWidth * k, img.naturalHeight * k);
141
+ const px = s.getImageData(0, 0, off.width, off.height).data;
142
+ return pts.map((p) => {
143
+ const q = (Math.min(off.height - 1, Math.floor(p.v * off.height)) * off.width + Math.min(off.width - 1, Math.floor(p.u * off.width))) * 4;
144
+ const lum = (0.2126 * px[q] + 0.7152 * px[q + 1] + 0.0722 * px[q + 2]) / 255;
145
+ return (1 - lum) * (px[q + 3] / 255);
146
+ });
147
+ };
148
+ const at = o.at ?? 0;
149
+ const dur = o.dur ?? 0.33;
150
+ const color = ink(ctx, o.ink);
151
+ return (t) => {
152
+ clear(g);
153
+ if (t < at) return;
154
+ vals ??= fromImage();
155
+ if (!vals) return;
156
+ const p = clamp(printFrames(t - at) / dur);
157
+ const swell = o.pulse ? 1 + 0.35 * beatPulse(t, { beats: ctx.beats, rules: ctx.style.motion, scene: ctx.id, source: "halftone" }).v : 1;
158
+ const grow = (o.reveal ?? "grow") === "grow" ? p : 1;
159
+ g.fillStyle = color;
160
+ g.beginPath();
161
+ for (let i = 0; i < pts.length; i++) {
162
+ const q = pts[i];
163
+ if (o.reveal === "sweep" && (o.dir === "right" ? q.u : q.v) > p) continue;
164
+ const r = Math.min(pitch * 0.75, pitch * 0.58 * Math.sqrt(vals[i]) * grow * swell);
165
+ if (r < 0.4) continue;
166
+ g.moveTo(q.x + r, q.y);
167
+ g.arc(q.x, q.y, r, 0, Math.PI * 2);
168
+ }
169
+ g.fill();
170
+ };
171
+ }
172
+
173
+ /**
174
+ * 종이결. paper: 종이 바탕 + 섬유·얼룩(맨 아래) · mottle: 잉크 위에 흰 반점(맨 위, screen) — 잉크가 고르게 안 먹은 리소 면.
175
+ * 결은 초당 12번 바뀌어 끓는다
176
+ */
177
+ export function paperGrain(el: HTMLElement, o: { ctx: SceneCtx; mode?: "paper" | "mottle"; fps?: number; seed?: string | number; strength?: number }): (t: number) => void {
178
+ const { ctx } = o;
179
+ const mode = o.mode ?? "paper";
180
+ const g = canvas(el, ctx, mode === "paper" ? "normal" : "screen");
181
+ const W = ctx.meta.width;
182
+ const H = ctx.meta.height;
183
+ const seed = o.seed ?? `grain:${mode}`;
184
+ const strength = o.strength ?? 1;
185
+ const tiles = [0, 1, 2, 3].map((f) => {
186
+ const off = document.createElement("canvas");
187
+ off.width = Math.ceil(W / 4);
188
+ off.height = Math.ceil(H / 4);
189
+ const s = off.getContext("2d")!;
190
+ const im = s.createImageData(off.width, off.height);
191
+ for (let i = 0; i < off.width * off.height; i++) {
192
+ const v = rand(`${seed}:${f}`, i);
193
+ const p = i * 4;
194
+ if (mode === "paper") {
195
+ // 어두운 티끌만 — 종이를 밝게 덮지 않는다
196
+ const d = v < 0.5 ? 0 : (v - 0.5) * 2;
197
+ im.data[p] = 120;
198
+ im.data[p + 1] = 105;
199
+ im.data[p + 2] = 80;
200
+ im.data[p + 3] = Math.round(d * d * 34 * strength);
201
+ } else {
202
+ const d = v > 0.82 ? (v - 0.82) / 0.18 : 0;
203
+ im.data[p] = im.data[p + 1] = im.data[p + 2] = 255;
204
+ im.data[p + 3] = Math.round(d * 120 * strength);
205
+ }
206
+ }
207
+ s.putImageData(im, 0, 0);
208
+ return off;
209
+ });
210
+ const fibers = Array.from({ length: mode === "paper" ? 260 : 0 }, (_, i) => ({
211
+ x: rand(seed, i * 5) * W,
212
+ y: rand(seed, i * 5 + 1) * H,
213
+ len: 12 + rand(seed, i * 5 + 2) * 40,
214
+ a: rand(seed, i * 5 + 3) * Math.PI,
215
+ bend: (rand(seed, i * 5 + 4) - 0.5) * 18,
216
+ }));
217
+ const paper = ink(ctx, "bg");
218
+ const line = ink(ctx, "line");
219
+ return (t) => {
220
+ const f = Math.floor(t * (o.fps ?? FPS) + 1e-6) % tiles.length;
221
+ clear(g);
222
+ if (mode === "paper") {
223
+ g.fillStyle = paper;
224
+ g.fillRect(0, 0, W, H);
225
+ g.globalAlpha = 0.55;
226
+ g.strokeStyle = line;
227
+ g.lineWidth = 1.2;
228
+ g.beginPath();
229
+ for (const q of fibers) {
230
+ const ex = q.x + Math.cos(q.a) * q.len;
231
+ const ey = q.y + Math.sin(q.a) * q.len;
232
+ g.moveTo(q.x, q.y);
233
+ g.quadraticCurveTo((q.x + ex) / 2 + q.bend, (q.y + ey) / 2 - q.bend, ex, ey);
234
+ }
235
+ g.stroke();
236
+ g.globalAlpha = 1;
237
+ }
238
+ g.imageSmoothingEnabled = true;
239
+ g.drawImage(tiles[f], 0, 0, W, H);
240
+ };
241
+ }
242
+
243
+ /**
244
+ * 종이 밀림 — 판면이 드럼에 물려 한 방향으로 끌려가며 조금 돈다. 초당 12장으로 끊어 0.1초 안에 늘 몇 px 씩 옮겨
245
+ * 판이 다 찍힌 뒤에도 화면이 쉬지 않는다. 방향·도는 쪽은 시드로
246
+ */
247
+ export function sheetDrift(t: number, o: { from: number; seed: string | number; px?: number; deg?: number; dur?: number }): Style {
248
+ const k = clamp(printFrames(t - o.from) / (o.dur ?? 1.4));
249
+ const a = rand(o.seed, 0) * Math.PI * 2;
250
+ const px = o.px ?? 70;
251
+ const deg = (rand(o.seed, 1) - 0.5) * 2 * (o.deg ?? 1.6);
252
+ return { x: Math.cos(a) * px * (k - 0.5), y: Math.sin(a) * px * 0.6 * (k - 0.5), rotate: deg * (k - 0.5) };
253
+ }
254
+
255
+ /** 드럼이 종이 위를 지나가며 판이 찍힌다 — 지나간 쪽만 보이는 clip. 초당 24장으로 끊는다 */
256
+ export function drumPass(t: number, o: { at: number; dur?: number; dir?: "down" | "right" | "up" }): Style {
257
+ const p = clamp(printFrames(t - o.at, 24) / (o.dur ?? 0.33));
258
+ const rest = 1 - p;
259
+ if (o.dir === "right") return { clip: { right: rest } };
260
+ if (o.dir === "up") return { clip: { top: rest } };
261
+ return { clip: { bottom: rest } };
262
+ }
263
+
264
+ /** 새 종이가 들어와 앞 장을 덮는다(장면 끝). 다음 장면은 빈 종이에서 판을 찍기 시작하면 이어진다 */
265
+ export function sheetFeed(el: HTMLElement, o: { ctx: SceneCtx; at: number; dur?: number; from?: "right" | "bottom" }): (t: number) => void {
266
+ const { ctx } = o;
267
+ const sheet = document.createElement("div");
268
+ sheet.style.cssText = `position:absolute;left:-40px;top:-40px;width:${ctx.meta.width + 80}px;height:${ctx.meta.height + 80}px;background:${ink(ctx, "bg")};border-left:3px solid ${ink(ctx, "line")};border-top:3px solid ${ink(ctx, "line")};visibility:hidden;`;
269
+ el.append(sheet);
270
+ const dur = o.dur ?? 0.42;
271
+ return (t) => {
272
+ if (t < o.at) {
273
+ sheet.style.visibility = "hidden";
274
+ return;
275
+ }
276
+ sheet.style.visibility = "visible";
277
+ const p = clamp(printFrames(t - o.at) / dur);
278
+ const e = 1 - (1 - p) ** 3;
279
+ const off = 1 - e;
280
+ const s: Style = o.from === "bottom" ? { y: off * (ctx.meta.height + 80), rotate: off * 3 } : { x: off * (ctx.meta.width + 80), rotate: -off * 4 };
281
+ applyStyle(sheet, s);
282
+ };
283
+ }
284
+
285
+ /** 드롭 — 화면 전체에 핑크 판이 한 번 통째로 찍혔다 걷히고 망점 고리가 퍼진다. 반환한 흔들림을 판들 틀에 건다 */
286
+ export function dropPlate(el: HTMLElement, o: { ctx: SceneCtx; drop?: number; ink?: string; origin?: [number, number] }): (t: number) => DropBurstState {
287
+ const { ctx } = o;
288
+ const flood = document.createElement("div");
289
+ flood.style.cssText = `position:absolute;inset:0;background:${ink(ctx, o.ink ?? "accent")};mix-blend-mode:multiply;opacity:0;`;
290
+ el.append(flood);
291
+ const g = canvas(el, ctx);
292
+ const [ox, oy] = o.origin ?? [ctx.meta.width / 2, ctx.meta.height / 2];
293
+ const far = Math.hypot(Math.max(ox, ctx.meta.width - ox), Math.max(oy, ctx.meta.height - oy));
294
+ const color = ink(ctx, o.ink ?? "accent");
295
+ const pitch = 22;
296
+ return (t) => {
297
+ const s = dropBurst(t, { beats: ctx.beats, drop: o.drop ?? 0, rules: ctx.style.motion, scene: ctx.id, source: "dropPlate" });
298
+ // 섬광도 끊어 — 한 장 통째로 찍히고 다음 장들에 걷힌다
299
+ const tq = printFrames(t);
300
+ const sq = dropBurst(tq, { beats: ctx.beats, drop: o.drop ?? 0, scene: ctx.id, emit: false });
301
+ flood.style.opacity = String(Math.round(sq.flash * 100) / 100);
302
+ clear(g);
303
+ if (sq.ring.opacity > 0.02) {
304
+ const R = (sq.ring.scale / 2.8) * far;
305
+ g.fillStyle = color;
306
+ g.beginPath();
307
+ for (let y = oy - R - 80; y <= oy + R + 80; y += pitch) {
308
+ for (let x = ox - R - 80; x <= ox + R + 80; x += pitch) {
309
+ const d = Math.abs(Math.hypot(x - ox, y - oy) - R);
310
+ if (d > 70) continue;
311
+ const r = (pitch * 0.55 * (1 - d / 70)) * sq.ring.opacity;
312
+ if (r < 0.5) continue;
313
+ g.moveTo(x + r, y);
314
+ g.arc(x, y, r, 0, Math.PI * 2);
315
+ }
316
+ }
317
+ g.fill();
318
+ }
319
+ return s;
320
+ };
321
+ }
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1140 650" width="1140" height="650" fill="none" role="img" aria-label="OpenGateway">
2
+ <title>OpenGateway</title>
3
+ <g id="logo" stroke="currentColor" fill="currentColor">
4
+ <rect id="node-in" x="36" y="36" width="420" height="578" rx="89" fill="none" stroke-width="72"/>
5
+ <rect id="bar-in" x="72" y="272" width="277" height="106" stroke="none"/>
6
+ <path id="node-out" d="M684 213 L684 125 A89 89 0 0 1 773 36 L1015 36 A89 89 0 0 1 1104 125 L1104 525 A89 89 0 0 1 1015 614 L773 614 A89 89 0 0 1 684 525 L684 436" fill="none" stroke-width="72" stroke-linecap="butt"/>
7
+ <g id="arrow">
8
+ <rect id="arrow-shaft" x="420" y="272" width="394" height="106" stroke="none"/>
9
+ <path id="arrow-head" d="M833 220 L970 325 L833 430 Z" stroke-width="38" stroke-linejoin="round"/>
10
+ </g>
11
+ </g>
12
+ </svg>
@@ -0,0 +1 @@
1
+ {"source": "assets/music/kawaii-friends-0400.mp3", "from": 0, "duration": 15.0, "bpm": 170.0, "beats": [0.2899, 0.6382, 0.9923, 1.3464, 1.6947, 2.0546, 2.4029, 2.757, 3.1169, 3.4652, 3.8251, 4.1734, 4.5275, 4.8758, 5.2299, 5.584, 5.9381, 6.2922, 6.6463, 6.9946, 7.336, 7.6971, 8.0628, 8.4053, 8.7478, 9.1135, 9.4676, 9.8159, 10.1816, 10.5241, 10.8782, 11.2265, 11.5748, 11.9405, 12.3004, 12.6487, 12.997, 13.3453, 13.7052, 14.0477, 14.396, 14.7617], "downbeats": [0.2899, 1.6947, 3.1169, 4.5275, 5.9381, 7.336, 8.7478, 10.1816, 11.5748, 12.997, 14.396], "bars": [0.2899, 1.6947, 3.1169, 4.5275, 5.9381, 7.336, 8.7478, 10.1816, 11.5748, 12.997, 14.396], "phrases": [0.0, 1.6947, 7.336, 12.997], "sections": [{"t": 0.0, "kind": "intro"}, {"t": 7.336, "kind": "drop", "strength": 0.99}], "drops": [7.336], "energy": {"hz": 20, "low": [0.0, 0.144, 0.183, 0.0, 0.0, 0.001, 0.0, 0.0, 0.208, 0.21, 0.0, 0.0, 0.0, 0.0, 0.0, 0.226, 0.241, 0.0, 0.0, 0.394, 0.25, 0.0, 0.131, 0.19, 0.033, 0.024, 0.245, 0.101, 0.009, 0.0, 0.0, 0.016, 0.134, 0.285, 0.097, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.371, 0.335, 0.0, 0.0, 0.148, 0.0, 0.0, 0.265, 0.171, 0.0, 0.0, 0.184, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.249, 0.015, 0.0, 0.0, 0.0, 0.0, 0.072, 0.297, 0.092, 0.009, 0.312, 0.389, 0.096, 0.031, 0.133, 0.021, 0.112, 0.0, 0.0, 0.074, 0.0, 0.227, 0.089, 0.018, 0.0, 0.091, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.022, 0.0, 0.0, 0.026, 0.02, 0.006, 0.184, 0.411, 0.068, 0.0, 0.156, 0.083, 0.0, 0.055, 0.182, 0.074, 0.0, 0.288, 0.232, 0.072, 0.022, 0.0, 0.0, 0.0, 0.0, 0.0, 0.015, 0.018, 0.053, 0.0, 0.03, 0.0, 0.0, 0.004, 0.094, 0.461, 0.453, 0.505, 0.55, 0.588, 0.627, 0.672, 0.72, 0.752, 0.759, 0.767, 0.772, 0.761, 0.724, 0.896, 0.998, 0.973, 0.838, 0.624, 0.667, 0.733, 0.796, 0.819, 0.8, 0.747, 0.833, 0.811, 0.816, 0.733, 0.507, 0.341, 0.066, 0.062, 0.0, 0.0, 0.798, 0.981, 1.0, 0.943, 0.813, 0.803, 0.799, 0.747, 0.606, 0.6, 0.606, 0.622, 0.649, 0.684, 0.812, 0.992, 0.986, 0.92, 0.668, 0.628, 0.572, 0.479, 0.365, 0.0, 0.0, 0.075, 0.0, 0.0, 0.758, 1.0, 1.0, 0.979, 0.876, 0.899, 0.9, 0.844, 0.772, 0.805, 0.811, 0.83, 0.858, 0.897, 0.945, 1.0, 0.961, 0.898, 0.862, 0.911, 0.902, 0.822, 0.611, 0.352, 0.0, 0.083, 0.0, 0.0, 0.682, 0.999, 0.985, 0.983, 0.897, 0.871, 0.869, 0.855, 0.74, 0.678, 0.686, 0.705, 0.733, 0.771, 0.793, 0.956, 0.999, 0.955, 0.815, 0.738, 0.75, 0.757, 0.672, 0.597, 0.618, 0.761, 0.977, 0.994, 0.935, 0.8, 0.8, 0.792, 0.782, 0.743, 0.643, 0.522, 0.898, 0.996, 0.975, 0.829, 0.577, 0.615, 0.683, 0.739, 0.765, 0.748, 0.703, 0.763, 0.752, 0.757, 0.68, 0.478, 0.287, 0.03, 0.055, 0.0, 0.022, 0.832, 0.99, 0.967, 0.886, 0.739, 0.749, 0.76, 0.719, 0.607, 0.613, 0.628, 0.645, 0.669, 0.713, 0.823, 1.0, 0.989, 0.916, 0.754, 0.736], "mid": [0.625, 0.806, 0.843, 0.738, 0.642, 0.71, 0.726, 0.582, 0.708, 0.759, 0.668, 0.544, 0.611, 0.572, 0.451, 0.785, 0.835, 0.629, 0.607, 0.911, 0.834, 0.737, 0.856, 0.806, 0.755, 0.566, 0.739, 0.759, 0.685, 0.742, 0.708, 0.66, 0.649, 0.834, 0.819, 0.654, 0.626, 0.747, 0.713, 0.526, 0.65, 0.711, 0.616, 0.518, 0.679, 0.644, 0.437, 0.861, 0.792, 0.499, 0.6, 0.773, 0.665, 0.541, 0.865, 0.918, 0.817, 0.666, 0.852, 0.772, 0.629, 0.697, 0.756, 0.683, 0.585, 0.767, 0.706, 0.55, 0.633, 0.706, 0.632, 0.595, 0.805, 0.726, 0.689, 0.822, 0.841, 0.661, 0.738, 0.746, 0.585, 0.553, 0.588, 0.601, 0.599, 0.566, 0.831, 0.755, 0.6, 0.698, 0.863, 0.782, 0.543, 0.66, 0.617, 0.593, 0.647, 0.707, 0.746, 0.728, 0.746, 0.741, 0.665, 0.748, 0.881, 0.656, 0.472, 0.682, 0.66, 0.618, 0.719, 0.915, 0.852, 0.797, 0.899, 0.862, 0.789, 0.769, 0.7, 0.637, 0.575, 0.608, 0.638, 0.653, 0.664, 0.714, 0.763, 0.732, 0.705, 0.722, 0.722, 0.794, 0.908, 0.714, 0.575, 0.602, 0.584, 0.615, 0.628, 0.732, 0.814, 0.826, 0.779, 0.756, 0.718, 0.641, 0.947, 0.785, 0.711, 0.7, 0.742, 0.817, 0.844, 0.879, 0.896, 0.888, 0.878, 0.878, 0.864, 0.82, 0.876, 0.775, 0.496, 0.503, 0.591, 0.607, 0.65, 0.945, 0.901, 0.821, 0.799, 0.845, 0.875, 0.891, 0.863, 0.757, 0.747, 0.77, 0.796, 0.821, 0.837, 0.935, 0.898, 0.746, 0.732, 0.823, 0.791, 0.805, 0.854, 0.843, 0.515, 0.434, 0.63, 0.711, 0.701, 0.893, 0.92, 0.775, 0.78, 0.834, 0.793, 0.723, 0.708, 0.777, 0.773, 0.82, 0.845, 0.876, 0.918, 0.993, 1.0, 1.0, 0.9, 0.954, 0.887, 0.84, 0.841, 0.888, 0.601, 0.394, 0.659, 0.815, 0.862, 0.939, 1.0, 0.974, 0.953, 0.891, 0.902, 0.903, 0.91, 0.818, 0.778, 0.724, 0.712, 0.78, 0.789, 0.831, 0.966, 0.839, 0.816, 0.822, 0.822, 0.823, 0.843, 0.891, 0.736, 0.674, 0.871, 0.882, 0.8, 0.831, 0.886, 0.902, 0.898, 0.884, 0.909, 0.859, 0.787, 0.949, 0.796, 0.732, 0.753, 0.82, 0.825, 0.862, 0.904, 0.887, 0.883, 0.891, 0.89, 0.876, 0.789, 0.877, 0.733, 0.36, 0.504, 0.736, 0.773, 0.788, 0.977, 0.945, 0.924, 0.905, 0.866, 0.864, 0.867, 0.828, 0.737, 0.731, 0.776, 0.775, 0.75, 0.804, 0.959, 0.923, 0.796, 0.789, 0.85, 0.849], "high": [0.498, 0.853, 0.762, 0.559, 0.557, 0.552, 0.53, 0.517, 0.82, 0.775, 0.541, 0.543, 0.521, 0.483, 0.506, 0.845, 0.835, 0.601, 0.653, 0.952, 0.836, 0.629, 0.85, 0.779, 0.549, 0.583, 0.814, 0.62, 0.566, 0.76, 0.644, 0.544, 0.692, 0.884, 0.66, 0.547, 0.555, 0.615, 0.504, 0.5, 0.528, 0.522, 0.522, 0.513, 0.482, 0.507, 0.549, 0.923, 0.885, 0.563, 0.615, 0.731, 0.497, 0.47, 0.745, 0.681, 0.508, 0.594, 0.784, 0.576, 0.546, 0.547, 0.52, 0.543, 0.638, 0.806, 0.585, 0.587, 0.633, 0.633, 0.643, 0.713, 0.881, 0.809, 0.828, 0.905, 0.936, 0.696, 0.726, 0.85, 0.646, 0.663, 0.682, 0.705, 0.706, 0.728, 0.892, 0.764, 0.738, 0.731, 0.693, 0.645, 0.625, 0.653, 0.654, 0.695, 0.751, 0.773, 0.773, 0.782, 0.837, 0.836, 0.832, 0.884, 0.96, 0.761, 0.678, 0.85, 0.793, 0.786, 0.871, 0.962, 0.906, 0.882, 0.903, 0.888, 0.891, 0.864, 0.758, 0.674, 0.697, 0.712, 0.726, 0.752, 0.807, 0.838, 0.836, 0.848, 0.85, 0.868, 0.897, 0.907, 0.977, 0.839, 0.709, 0.726, 0.751, 0.78, 0.825, 0.863, 0.856, 0.857, 0.864, 0.875, 0.874, 1.0, 1.0, 0.811, 0.806, 0.793, 0.789, 0.826, 0.86, 0.895, 0.892, 0.888, 0.883, 0.879, 0.87, 0.847, 0.948, 0.885, 0.649, 0.574, 0.654, 0.671, 0.696, 0.831, 0.804, 0.843, 0.812, 0.839, 0.899, 0.906, 0.845, 0.707, 0.727, 0.774, 0.771, 0.783, 0.813, 0.877, 0.77, 0.659, 0.672, 0.81, 0.843, 0.864, 0.932, 0.928, 0.637, 0.439, 0.61, 0.671, 0.644, 0.802, 0.77, 0.736, 0.728, 0.714, 0.616, 0.503, 0.548, 0.683, 0.71, 0.714, 0.705, 0.758, 0.831, 0.872, 0.872, 0.875, 0.885, 0.89, 0.854, 0.82, 0.892, 0.961, 0.726, 0.496, 0.603, 0.74, 0.744, 0.828, 0.847, 0.846, 0.831, 0.786, 0.846, 0.859, 0.837, 0.747, 0.713, 0.673, 0.715, 0.84, 0.868, 0.829, 0.848, 0.796, 0.803, 0.838, 0.921, 0.944, 0.927, 0.968, 0.831, 0.699, 0.812, 0.798, 0.799, 0.863, 0.888, 0.847, 0.839, 0.861, 0.884, 0.834, 0.78, 0.832, 0.689, 0.707, 0.686, 0.702, 0.801, 0.858, 0.88, 0.871, 0.862, 0.852, 0.882, 0.867, 0.806, 0.946, 0.851, 0.52, 0.458, 0.679, 0.739, 0.75, 0.862, 0.857, 0.873, 0.821, 0.899, 0.924, 0.921, 0.846, 0.77, 0.781, 0.774, 0.783, 0.81, 0.867, 0.948, 0.824, 0.734, 0.722, 0.894, 0.935]}}
@@ -0,0 +1,11 @@
1
+ <!doctype html>
2
+ <html lang="ko">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>riso-zine 견본</title>
6
+ </head>
7
+ <body>
8
+ <div id="stage"></div>
9
+ <script type="module" src="./main.ts"></script>
10
+ </body>
11
+ </html>
@@ -0,0 +1,59 @@
1
+ {
2
+ "template": "promo",
3
+ "title": "riso-zine · OpenGateway 15초",
4
+ "theme": "riso-zine",
5
+ "fps": 60,
6
+ "width": 1920,
7
+ "height": 1080,
8
+ "duration": 15.0,
9
+ "mode": "seek",
10
+ "style": "style.json",
11
+ "music": "assets/music/kawaii-friends-0400.mp3",
12
+ "beats": "beats.json",
13
+ "captions": "none",
14
+ "safeArea": {
15
+ "top": 60,
16
+ "bottom": 60,
17
+ "left": 80,
18
+ "right": 80
19
+ },
20
+ "text": {
21
+ "policy": "terms-only",
22
+ "maxOnScreen": 0,
23
+ "minPx": 0
24
+ },
25
+ "scenes": [
26
+ {
27
+ "id": "gather",
28
+ "from": 0,
29
+ "dur": 3.1169,
30
+ "file": "scenes/gather.ts",
31
+ "role": "hook",
32
+ "idea": "회사 아홉이 박마다 셋씩 흩어져 찍히고 핑크로 겹친다, 다음 판면에 회사별 모델 수가 줄마다"
33
+ },
34
+ {
35
+ "id": "models",
36
+ "from": 3.1169,
37
+ "dur": 4.2191,
38
+ "file": "scenes/models.ts",
39
+ "role": "explain",
40
+ "idea": "한 주소와 /v1 이 판으로, 같은 주소에 모델 ID 만 박마다 새 판으로 바뀌고, OpenAI·Anthropic 두 형식이 겹친다"
41
+ },
42
+ {
43
+ "id": "price",
44
+ "from": 7.336,
45
+ "dur": 4.2388,
46
+ "file": "scenes/price.ts",
47
+ "role": "drop",
48
+ "idea": "드롭에 102 가 핑크 판 통째로 찍히고, 하루 시계에서 00–10시 창이 진하고 -90%, deepseek 정가에 핑크 줄"
49
+ },
50
+ {
51
+ "id": "end",
52
+ "from": 11.5748,
53
+ "dur": 3.4252,
54
+ "file": "scenes/end.ts",
55
+ "role": "end",
56
+ "idea": "첫 토큰 실측 셋과 막대, OG 로고 두 판 겹침과 opengateway.ai"
57
+ }
58
+ ]
59
+ }
@@ -0,0 +1,29 @@
1
+ // OpenGateway 사실 — docs/briefs/og-intro-15s.md 에 적힌 것만. 숫자를 여기서 새로 만들지 않는다
2
+ export const OG = {
3
+ url: "https://apis.opengateway.ai/v1",
4
+ host: "apis.opengateway.ai/v1",
5
+ site: "opengateway.ai",
6
+ models: 102,
7
+ endpoints: ["/chat/completions", "/responses", "/messages", "/images/generations"],
8
+ providers: [
9
+ ["OpenAI", 41],
10
+ ["Anthropic", 15],
11
+ ["Google", 15],
12
+ ["Z.ai", 7],
13
+ ["xAI", 6],
14
+ ["Qwen", 5],
15
+ ["Moonshot", 4],
16
+ ["DeepSeek", 4],
17
+ ["MiniMax", 3],
18
+ ] as [string, number][],
19
+ ids: ["openai/gpt-6.1-sol", "anthropic/claude-opus-5-5", "google/gemini-3.5-flash-lite", "deepseek/deepseek-v4.1-flash-ultrafast", "z-ai/glm-5.3-flash-ultrafast"],
20
+ night: { from: 0, to: 10, tz: "KST" },
21
+ deepseek: { id: "deepseek-v4.1-flash-ultrafast", input: ["$0.30", "$0.03"], output: ["$1.20", "$0.12"], off: "-90%" },
22
+ glm: { id: "glm-5.3-flash-ultrafast", off: "-70%" },
23
+ ttft: [
24
+ ["gpt-5.4-nano", "612.5ms", 612.5],
25
+ ["gemini-3.5-flash-lite", "693.0ms", 693.0],
26
+ ["claude-haiku-5-5", "760.5ms", 760.5],
27
+ ] as [string, string, number][],
28
+ calls: "18번 합 $0.0004",
29
+ };
@@ -0,0 +1,86 @@
1
+ import { applyStyle, type SceneCtx } from "@kasaframe/core";
2
+ import { drumPass, halftone, plateStamp, sheetDrift, type HalftoneOpts } from "../../effects.ts";
3
+ import { layer, text } from "./zine.ts";
4
+
5
+ export interface Word {
6
+ text: string;
7
+ size: number;
8
+ y: number;
9
+ /** 없으면 가운데 */
10
+ x?: number;
11
+ font?: "display" | "sans" | "mono";
12
+ weight?: number;
13
+ }
14
+
15
+ /** 판 한 장 — 그 마디의 몇째 박(0–3)에 찍고, until 박에 걷는다 */
16
+ export interface Plate {
17
+ beat: number;
18
+ ink: "blue" | "pink";
19
+ words?: Word[];
20
+ build?(plate: HTMLElement, ctx: SceneCtx): void;
21
+ px?: number;
22
+ until?: number;
23
+ }
24
+
25
+ export interface Tone extends Omit<HalftoneOpts, "ctx" | "at"> {
26
+ beat: number;
27
+ }
28
+
29
+ /** 판면 하나 = 마디 하나 */
30
+ export interface Sheet {
31
+ plates: Plate[];
32
+ tones?: Tone[];
33
+ }
34
+
35
+ const DIRS = ["down", "right", "up", "right"] as const;
36
+
37
+ export function place(p: HTMLElement, ctx: SceneCtx, w: Word) {
38
+ const f = ctx.style.fonts[w.font ?? "display"];
39
+ const where = w.x === undefined ? "left:0;width:1920px;text-align:center;" : `left:${w.x}px;`;
40
+ text(p, w.text, `${where}top:${w.y}px;font:${w.weight ?? (w.font === "display" || !w.font ? 400 : 700)} ${w.size}px ${f};`);
41
+ }
42
+
43
+ /** 장면을 마디마다 판면 하나로. 새 판면은 드럼이 지나가며 드러나고, 그동안 판면은 늘 끌려간다 */
44
+ export function sheets(parent: HTMLElement, ctx: SceneCtx, list: Sheet[], o: { pulse?: boolean } = {}) {
45
+ const bars = ctx.beats.bars.filter((x) => x >= -1e-6 && x < ctx.dur - 1e-6);
46
+ const beats = ctx.beats.beats;
47
+ const edge = (i: number) => (i === 0 ? 0 : i >= list.length ? ctx.dur + 1 : (bars[i] ?? (ctx.dur * i) / list.length));
48
+ return list.map((s, i) => {
49
+ const from = edge(i);
50
+ const to = edge(i + 1);
51
+ // 첫 판면은 장면 처음(0초)부터 — 마디 첫 박이 조금 뒤에 올 수 있다
52
+ const first = beats.find((x) => x >= (i === 0 ? 0 : from) - 0.05) ?? from;
53
+ const bb = [0, 1, 2, 3, 4].map((k) => (k === 0 ? from : (beats.find((x) => x >= first + k * 0.3 - 0.05) ?? from + k * 0.35)));
54
+ const box = layer(parent);
55
+ const sheet = layer(box);
56
+ const seed = `${ctx.id}:${i}`;
57
+ const tones = (s.tones ?? []).map((tn) => halftone(sheet, { ctx, ...tn, at: bb[tn.beat], pulse: o.pulse ?? tn.pulse }));
58
+ const plates = s.plates.map((pl, k) => {
59
+ const holder = layer(sheet);
60
+ const draw = plateStamp(holder, {
61
+ ctx,
62
+ plates: [{ ink: pl.ink, at: bb[pl.beat], px: pl.px, seed: `${seed}:${k}` }],
63
+ build: (p) => {
64
+ for (const w of pl.words ?? []) place(p, ctx, w);
65
+ pl.build?.(p, ctx);
66
+ },
67
+ });
68
+ const until = pl.until === undefined ? Infinity : bb[pl.until];
69
+ return (t: number) => {
70
+ const on = t < until;
71
+ holder.style.display = on ? "" : "none";
72
+ if (on) draw(t);
73
+ };
74
+ });
75
+ return (t: number) => {
76
+ const on = t >= from && t < to;
77
+ // visibility 로 숨기면 판(plateStamp)이 visible 을 줄 때 부모를 뚫고 보인다 — display 로 통째로 뺀다
78
+ box.style.display = on ? "" : "none";
79
+ if (!on) return;
80
+ applyStyle(box, drumPass(t, { at: from, dir: DIRS[i % DIRS.length], dur: 0.25 }));
81
+ applyStyle(sheet, sheetDrift(t, { from, seed, dur: to - from }));
82
+ for (const tn of tones) tn(t);
83
+ for (const p of plates) p(t);
84
+ };
85
+ });
86
+ }
@@ -0,0 +1,42 @@
1
+ import type { SceneCtx } from "@kasaframe/core";
2
+
3
+ export const barsFrom0 = (ctx: SceneCtx): number[] => ctx.beats.bars.filter((b) => b >= -1e-6 && b < ctx.dur - 1e-6);
4
+
5
+ export function layer(parent: HTMLElement, css = ""): HTMLElement {
6
+ const el = document.createElement("div");
7
+ el.style.cssText = `position:absolute;inset:0;${css}`;
8
+ parent.append(el);
9
+ return el;
10
+ }
11
+
12
+ /** 판 안에 글 한 덩어리 — 자리는 px, 색은 판 잉크(currentColor) */
13
+ export function text(plate: HTMLElement, s: string, css: string): HTMLElement {
14
+ const el = document.createElement("div");
15
+ el.textContent = s;
16
+ el.style.cssText = `position:absolute;white-space:pre;line-height:0.9;${css}`;
17
+ plate.append(el);
18
+ return el;
19
+ }
20
+
21
+ /** OG 로고(currentColor SVG) 를 판에 — 판 잉크로 칠해진다 */
22
+ export function logo(plate: HTMLElement, svg: string, x: number, y: number, w: number) {
23
+ const el = document.createElement("div");
24
+ el.style.cssText = `position:absolute;left:${x}px;top:${y}px;width:${w}px;`;
25
+ el.innerHTML = svg.replace(/ width="\d+" height="\d+"/, ' width="100%" style="display:block"');
26
+ plate.append(el);
27
+ }
28
+
29
+ /** 망점 값 — 원판 몇 개(가운데 진하고 가장자리 옅게) */
30
+ export const blobs = (spots: [number, number, number][]) => (u: number, v: number) => {
31
+ let best = 0;
32
+ for (const [cx, cy, r] of spots) {
33
+ const d = Math.hypot((u - cx) * 1.78, v - cy);
34
+ if (d < r) best = Math.max(best, 0.25 + 0.65 * (1 - d / r));
35
+ }
36
+ return best;
37
+ };
38
+
39
+ export const rings = (cx: number, n: number) => (u: number, v: number) => {
40
+ const d = Math.hypot((u - cx) * 1.78, v - 0.5);
41
+ return d > 1.1 ? 0 : 0.14 + 0.34 * (0.5 + 0.5 * Math.cos(d * Math.PI * n));
42
+ };
@@ -0,0 +1,9 @@
1
+ import { mountProject } from "@kasaframe/adapters";
2
+ import kf from "./kf.json";
3
+ import style from "./style.json";
4
+
5
+ // 장면 파일을 늘리거나 빼도 이 파일은 그대로 — 시간표는 kf.json 한 곳. 글꼴·색 변수는 mountProject 가 건다
6
+ const scenes = import.meta.glob("./scenes/*.ts", { eager: true });
7
+ const beats = Object.values(import.meta.glob("./beats.json", { eager: true, import: "default" }))[0] ?? null;
8
+
9
+ mountProject({ kf, scenes, beats, style, stage: document.getElementById("stage")! });
@@ -0,0 +1,61 @@
1
+ import type { SceneCtx } from "@kasaframe/core";
2
+ import { paperGrain } from "../../effects.ts";
3
+ import svg from "../assets/og/logo.svg?raw";
4
+ import { OG } from "../lib/og.ts";
5
+ import { sheets } from "../lib/shot.ts";
6
+ import { layer, logo, rings } from "../lib/zine.ts";
7
+
8
+ export default {
9
+ build(root: HTMLElement, ctx: SceneCtx) {
10
+ const paper = paperGrain(layer(root), { ctx, seed: "end" });
11
+ const art = layer(root);
12
+ const FULL = { x: 0, y: 0, w: 1920, h: 1080 };
13
+ const max = Math.max(...OG.ttft.map(([, , ms]) => ms));
14
+ const pages = sheets(
15
+ art,
16
+ ctx,
17
+ [
18
+ {
19
+ // 첫 토큰 가운데값 셋 — 줄마다 한 박, ms 만큼 핑크 막대
20
+ plates: [
21
+ ...OG.ttft.map(([id, label], k) => ({
22
+ beat: k,
23
+ ink: "blue" as const,
24
+ words: [
25
+ { text: id, x: 120, y: 70 + k * 290, size: 48, font: "mono" as const, weight: 600 },
26
+ { text: label, x: 120, y: 125 + k * 290, size: 160 },
27
+ ],
28
+ })),
29
+ { beat: 3, ink: "blue", words: [{ text: OG.calls, x: 1180, y: 940, size: 60, font: "sans", weight: 800 }] },
30
+ ],
31
+ tones: OG.ttft.map(([, , ms], k) => ({ beat: k, x: 960, y: 140 + k * 290, w: (840 * ms) / max, h: 130, ink: "pink" as const, angle: 75, pitch: 14, reveal: "sweep" as const, dir: "right" as const, dur: 0.2, value: () => 0.7 })),
32
+ },
33
+ {
34
+ plates: [
35
+ { beat: 0, ink: "blue", build: (p) => logo(p, svg, 560, 80, 800) },
36
+ { beat: 1, ink: "pink", build: (p) => logo(p, svg, 560, 80, 800), px: 10 },
37
+ { beat: 2, ink: "blue", words: [{ text: OG.site, size: 150, y: 640 }] },
38
+ { beat: 3, ink: "blue", words: [{ text: OG.url, size: 48, y: 860, font: "mono", weight: 600 }] },
39
+ ],
40
+ tones: [{ beat: 3, ...FULL, ink: "pink", angle: 75, pitch: 24, value: rings(0.5, 8) }],
41
+ },
42
+ {
43
+ plates: [
44
+ { beat: 0, ink: "blue", build: (p) => logo(p, svg, 140, 120, 420) },
45
+ { beat: 0, ink: "blue", words: [{ text: OG.site, size: 150, x: 640, y: 230 }] },
46
+ { beat: 1, ink: "pink", words: [{ text: OG.site, size: 150, x: 640, y: 230 }], px: 9 },
47
+ { beat: 1, ink: "blue", words: [{ text: OG.url, size: 48, x: 650, y: 420, font: "mono", weight: 600 }] },
48
+ ],
49
+ tones: [{ beat: 0, ...FULL, ink: "pink", angle: 75, pitch: 22, value: rings(0.2, 10) }],
50
+ },
51
+ ],
52
+ { pulse: true },
53
+ );
54
+ const mottle = paperGrain(layer(root), { ctx, mode: "mottle", seed: "end-m" });
55
+ return (t: number) => {
56
+ paper(t);
57
+ for (const p of pages) p(t);
58
+ mottle(t);
59
+ };
60
+ },
61
+ };