kasaframe 0.0.0-stage → 0.1.3

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 (442) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +148 -0
  3. package/README.md +92 -2
  4. package/app/package.json +12 -0
  5. package/app/server/engine.ts +533 -0
  6. package/app/server/main.ts +209 -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 +1195 -0
  11. package/app/web/style.css +463 -0
  12. package/bin/hooks.mjs +64 -0
  13. package/bin/kf.mjs +32 -0
  14. package/docs/AGENTS.md +286 -0
  15. package/music/README.md +37 -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 +280 -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 +45 -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 +136 -0
  43. package/packages/check/src/rules/layout.ts +281 -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 +30 -0
  52. package/packages/cli/src/blur.ts +80 -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/bench.ts +123 -0
  58. package/packages/cli/src/commands/blender.ts +293 -0
  59. package/packages/cli/src/commands/check.ts +25 -0
  60. package/packages/cli/src/commands/direct.ts +210 -0
  61. package/packages/cli/src/commands/doctor.ts +30 -0
  62. package/packages/cli/src/commands/gen.ts +173 -0
  63. package/packages/cli/src/commands/look.ts +46 -0
  64. package/packages/cli/src/commands/lyrics.ts +157 -0
  65. package/packages/cli/src/commands/make.ts +1121 -0
  66. package/packages/cli/src/commands/music.ts +78 -0
  67. package/packages/cli/src/commands/narrate.ts +238 -0
  68. package/packages/cli/src/commands/new.ts +185 -0
  69. package/packages/cli/src/commands/preview.ts +43 -0
  70. package/packages/cli/src/commands/render.ts +250 -0
  71. package/packages/cli/src/commands/series.ts +110 -0
  72. package/packages/cli/src/commands/setup.ts +102 -0
  73. package/packages/cli/src/commands/sheet.ts +114 -0
  74. package/packages/cli/src/commands/skill.ts +43 -0
  75. package/packages/cli/src/commands/still.ts +40 -0
  76. package/packages/cli/src/commands/theme.ts +172 -0
  77. package/packages/cli/src/commands/transitions.ts +40 -0
  78. package/packages/cli/src/deps.ts +122 -0
  79. package/packages/cli/src/ffmpeg.ts +81 -0
  80. package/packages/cli/src/index.ts +8 -0
  81. package/packages/cli/src/kf.ts +64 -0
  82. package/packages/cli/src/lock.ts +72 -0
  83. package/packages/cli/src/mix.ts +131 -0
  84. package/packages/cli/src/out.ts +13 -0
  85. package/packages/cli/src/pool.ts +34 -0
  86. package/packages/cli/src/segments.ts +402 -0
  87. package/packages/cli/src/serve.ts +124 -0
  88. package/packages/clock/package.json +14 -0
  89. package/packages/clock/src/index.ts +25 -0
  90. package/packages/clock/src/install.ts +351 -0
  91. package/packages/clock/src/types.ts +45 -0
  92. package/packages/core/package.json +9 -0
  93. package/packages/core/src/beats.ts +283 -0
  94. package/packages/core/src/ease.ts +87 -0
  95. package/packages/core/src/frame.ts +99 -0
  96. package/packages/core/src/index.ts +27 -0
  97. package/packages/core/src/project.ts +157 -0
  98. package/packages/core/src/rand.ts +56 -0
  99. package/packages/core/src/spring.ts +52 -0
  100. package/packages/core/src/style.ts +100 -0
  101. package/packages/core/src/time.ts +88 -0
  102. package/packages/director/package.json +23 -0
  103. package/packages/director/src/assemble.ts +361 -0
  104. package/packages/director/src/brief.ts +122 -0
  105. package/packages/director/src/catalog.ts +49 -0
  106. package/packages/director/src/content.ts +343 -0
  107. package/packages/director/src/fallback.ts +58 -0
  108. package/packages/director/src/index.ts +13 -0
  109. package/packages/director/src/pattern.ts +90 -0
  110. package/packages/director/src/patterns/fill/cells.ts +115 -0
  111. package/packages/director/src/patterns/formula/stack.ts +93 -0
  112. package/packages/director/src/patterns/util.ts +58 -0
  113. package/packages/director/src/scene.ts +62 -0
  114. package/packages/director/src/select.ts +163 -0
  115. package/packages/director/src/transitions.ts +115 -0
  116. package/packages/gen/PROVIDERS.md +90 -0
  117. package/packages/gen/package.json +9 -0
  118. package/packages/gen/src/ask.ts +132 -0
  119. package/packages/gen/src/audio.ts +91 -0
  120. package/packages/gen/src/blender.ts +54 -0
  121. package/packages/gen/src/capabilities.ts +151 -0
  122. package/packages/gen/src/generate.ts +206 -0
  123. package/packages/gen/src/image/codex.ts +117 -0
  124. package/packages/gen/src/image/og.ts +133 -0
  125. package/packages/gen/src/index.ts +26 -0
  126. package/packages/gen/src/keys.ts +86 -0
  127. package/packages/gen/src/media.ts +150 -0
  128. package/packages/gen/src/music/elevenlabs.ts +41 -0
  129. package/packages/gen/src/music/index.ts +120 -0
  130. package/packages/gen/src/music/library.ts +73 -0
  131. package/packages/gen/src/music/lyria.ts +52 -0
  132. package/packages/gen/src/music/types.ts +28 -0
  133. package/packages/gen/src/plan.ts +106 -0
  134. package/packages/gen/src/registry.ts +54 -0
  135. package/packages/gen/src/seam.ts +103 -0
  136. package/packages/gen/src/tts/dashscope.ts +64 -0
  137. package/packages/gen/src/tts/elevenlabs.ts +84 -0
  138. package/packages/gen/src/tts/gemini.ts +73 -0
  139. package/packages/gen/src/tts/index.ts +241 -0
  140. package/packages/gen/src/tts/local.ts +42 -0
  141. package/packages/gen/src/tts/types.ts +44 -0
  142. package/packages/gen/src/types.ts +90 -0
  143. package/packages/gen/src/video/fal.ts +140 -0
  144. package/packages/gen/src/video/h3.ts +112 -0
  145. package/packages/gen/src/video/http.ts +44 -0
  146. package/packages/gen/src/video/ltx.ts +60 -0
  147. package/packages/gen/src/video/minimax.ts +55 -0
  148. package/packages/gen/src/video/veo.ts +71 -0
  149. package/packages/jizura/package.json +16 -0
  150. package/packages/jizura/src/deny.ts +73 -0
  151. package/packages/jizura/src/index.ts +7 -0
  152. package/packages/jizura/src/install.ts +269 -0
  153. package/packages/jizura/src/layer.ts +325 -0
  154. package/packages/jizura/src/lyrics.ts +81 -0
  155. package/packages/jizura/src/pin.ts +8 -0
  156. package/packages/jizura/src/vendor.ts +140 -0
  157. package/packages/jizura/src/vite.ts +63 -0
  158. package/packages/jizura/vendor/JIZURA_LICENSE.txt +21 -0
  159. package/packages/jizura/vendor/NOTICE +43 -0
  160. package/packages/jizura/vendor/engine.json +47 -0
  161. package/packages/jizura/vendor/fonts/BlackHanSans-Regular.woff2 +0 -0
  162. package/packages/jizura/vendor/fonts/DotGothic16-Regular.woff2 +0 -0
  163. package/packages/jizura/vendor/fonts/GowunBatang-Bold.woff2 +0 -0
  164. package/packages/jizura/vendor/fonts/IBMPlexMono-Medium.ttf +0 -0
  165. package/packages/jizura/vendor/fonts/IBMPlexMono-SemiBold.ttf +0 -0
  166. package/packages/jizura/vendor/fonts/NotoSansKR-VF.woff2 +0 -0
  167. package/packages/jizura/vendor/fonts/NotoSerifKR-VF.woff2 +0 -0
  168. package/packages/jizura/vendor/fonts/OFL-blackhansans.txt +93 -0
  169. package/packages/jizura/vendor/fonts/OFL-dotgothic16.txt +93 -0
  170. package/packages/jizura/vendor/fonts/OFL-gowunbatang.txt +94 -0
  171. package/packages/jizura/vendor/fonts/OFL-ibmplexmono.txt +93 -0
  172. package/packages/jizura/vendor/fonts/OFL-notosanskr.txt +93 -0
  173. package/packages/jizura/vendor/fonts/OFL-notoserifkr.txt +94 -0
  174. package/packages/jizura/vendor/fonts/fonts.json +52 -0
  175. package/packages/jizura/vendor/jizura_engine.js +35024 -0
  176. package/packages/motion/README.md +153 -0
  177. package/packages/motion/package.json +30 -0
  178. package/packages/motion/src/camera.ts +97 -0
  179. package/packages/motion/src/captions.ts +487 -0
  180. package/packages/motion/src/enter.ts +128 -0
  181. package/packages/motion/src/hangul.ts +129 -0
  182. package/packages/motion/src/impact.ts +100 -0
  183. package/packages/motion/src/index.ts +17 -0
  184. package/packages/motion/src/moves/brushWipe.ts +103 -0
  185. package/packages/motion/src/moves/cloneArray.ts +111 -0
  186. package/packages/motion/src/moves/curtains.ts +81 -0
  187. package/packages/motion/src/moves/dress.ts +191 -0
  188. package/packages/motion/src/moves/echoStack.ts +70 -0
  189. package/packages/motion/src/moves/fit.ts +70 -0
  190. package/packages/motion/src/moves/flood.ts +61 -0
  191. package/packages/motion/src/moves/ghostStack.ts +88 -0
  192. package/packages/motion/src/moves/gridFloor.ts +100 -0
  193. package/packages/motion/src/moves/imageSwarm.ts +113 -0
  194. package/packages/motion/src/moves/index.ts +38 -0
  195. package/packages/motion/src/moves/irisBlades.ts +113 -0
  196. package/packages/motion/src/moves/karaokeLine.ts +108 -0
  197. package/packages/motion/src/moves/ledBoard.ts +94 -0
  198. package/packages/motion/src/moves/liquidTab.ts +72 -0
  199. package/packages/motion/src/moves/markerWrite.ts +63 -0
  200. package/packages/motion/src/moves/menu.ts +138 -0
  201. package/packages/motion/src/moves/morphBox.ts +96 -0
  202. package/packages/motion/src/moves/neonSign.ts +78 -0
  203. package/packages/motion/src/moves/panelPop.ts +78 -0
  204. package/packages/motion/src/moves/paperTear.ts +75 -0
  205. package/packages/motion/src/moves/path.ts +64 -0
  206. package/packages/motion/src/moves/pathText.ts +107 -0
  207. package/packages/motion/src/moves/pointSphere.ts +109 -0
  208. package/packages/motion/src/moves/ransomLetters.ts +73 -0
  209. package/packages/motion/src/moves/shapeMorph.ts +143 -0
  210. package/packages/motion/src/moves/slamWords.ts +96 -0
  211. package/packages/motion/src/moves/sparkTrail.ts +130 -0
  212. package/packages/motion/src/moves/speedLines.ts +91 -0
  213. package/packages/motion/src/moves/splitFlap.ts +149 -0
  214. package/packages/motion/src/moves/stepWords.ts +128 -0
  215. package/packages/motion/src/moves/strikeOut.ts +98 -0
  216. package/packages/motion/src/moves/sunburst.ts +58 -0
  217. package/packages/motion/src/moves/tickerRows.ts +91 -0
  218. package/packages/motion/src/moves/tokenPicker.ts +115 -0
  219. package/packages/motion/src/moves/truchet.ts +85 -0
  220. package/packages/motion/src/moves/wordWall.ts +78 -0
  221. package/packages/motion/src/moves/worldRoll.ts +32 -0
  222. package/packages/motion/src/particles.ts +102 -0
  223. package/packages/motion/src/react/index.tsx +21 -0
  224. package/packages/motion/src/react/parts.tsx +431 -0
  225. package/packages/motion/src/react/time.tsx +97 -0
  226. package/packages/motion/src/text.ts +103 -0
  227. package/packages/motion/src/transition.ts +82 -0
  228. package/packages/motion/src/transition3d/cards.ts +65 -0
  229. package/packages/motion/src/transition3d/chain.ts +84 -0
  230. package/packages/motion/src/transition3d/dive.ts +181 -0
  231. package/packages/motion/src/transition3d/fold.ts +110 -0
  232. package/packages/motion/src/transition3d/gl.ts +219 -0
  233. package/packages/motion/src/transition3d/index.ts +235 -0
  234. package/packages/motion/src/transition3d/live.ts +70 -0
  235. package/packages/motion/src/transition3d/portal.ts +115 -0
  236. package/packages/motion/src/transition3d/react.tsx +29 -0
  237. package/packages/motion/src/transition3d/rig.ts +600 -0
  238. package/packages/motion/src/transition3d/shatter.ts +104 -0
  239. package/packages/motion/src/transition3d/space.ts +173 -0
  240. package/packages/motion/src/transition3d/whip.ts +78 -0
  241. package/packages/motion/src/transition3d/world.ts +737 -0
  242. package/packages/motion/src/transition3d/zoomOut.ts +114 -0
  243. package/packages/motion/src/transitions2d/catalog.ts +127 -0
  244. package/packages/motion/src/transitions2d/css.d.ts +2 -0
  245. package/packages/motion/src/transitions2d/cult-ui/LICENSE.md +9 -0
  246. package/packages/motion/src/transitions2d/cult-ui/RollingNumber.tsx +43 -0
  247. package/packages/motion/src/transitions2d/gl-transitions/LICENSE +25 -0
  248. package/packages/motion/src/transitions2d/gl-transitions/shaders.ts +1931 -0
  249. package/packages/motion/src/transitions2d/index.ts +2 -0
  250. package/packages/motion/src/transitions2d/kokonutui/LICENSE +21 -0
  251. package/packages/motion/src/transitions2d/kokonutui/MatrixText.css +16 -0
  252. package/packages/motion/src/transitions2d/kokonutui/MatrixText.tsx +94 -0
  253. package/packages/motion/src/transitions2d/magicui/HyperText.css +15 -0
  254. package/packages/motion/src/transitions2d/magicui/HyperText.tsx +115 -0
  255. package/packages/motion/src/transitions2d/magicui/LICENSE.md +21 -0
  256. package/packages/motion/src/transitions2d/magicui/MorphingText.css +25 -0
  257. package/packages/motion/src/transitions2d/magicui/MorphingText.tsx +130 -0
  258. package/packages/motion/src/transitions2d/magicui/WordRotate.tsx +42 -0
  259. package/packages/motion/src/transitions2d/react.ts +13 -0
  260. package/packages/motion/src/transitions2d/skiper-ui/ClipDiv.css +39 -0
  261. package/packages/motion/src/transitions2d/skiper-ui/ClipDiv.tsx +32 -0
  262. package/packages/motion/src/transitions2d/smoothui/LICENSE +21 -0
  263. package/packages/motion/src/transitions2d/smoothui/SharedAxisY.tsx +50 -0
  264. package/packages/motion/src/transitions2d/smoothui/TextMorph.tsx +90 -0
  265. package/packages/motion/src/transitions2d/smoothui/shaders.ts +223 -0
  266. package/packages/motion/src/transitions2d/unlumen/LICENSE +21 -0
  267. package/packages/motion/src/transitions2d/unlumen/ScrambleText.tsx +114 -0
  268. package/packages/motion/src/transitions2d/vengeance-ui/LICENSE +21 -0
  269. package/packages/motion/src/transitions2d/vengeance-ui/MorphText.css +69 -0
  270. package/packages/motion/src/transitions2d/vengeance-ui/MorphText.tsx +45 -0
  271. package/packages/motion/src/type.ts +131 -0
  272. package/packages/motion/src/ui.ts +172 -0
  273. package/packages/patterns/package.json +15 -0
  274. package/packages/patterns/src/bars/rank.ts +119 -0
  275. package/packages/patterns/src/before-after/shrink.ts +127 -0
  276. package/packages/patterns/src/before-after/strike.ts +125 -0
  277. package/packages/patterns/src/code/terminal.ts +133 -0
  278. package/packages/patterns/src/compare/bars.ts +142 -0
  279. package/packages/patterns/src/compare/duel.ts +103 -0
  280. package/packages/patterns/src/end/lockup.ts +85 -0
  281. package/packages/patterns/src/end/slam.ts +91 -0
  282. package/packages/patterns/src/flow/graph.ts +250 -0
  283. package/packages/patterns/src/hook-number/counter.ts +101 -0
  284. package/packages/patterns/src/hook-number/roll.ts +179 -0
  285. package/packages/patterns/src/hook-number/slam.ts +91 -0
  286. package/packages/patterns/src/index.ts +38 -0
  287. package/packages/patterns/src/kit.ts +449 -0
  288. package/packages/patterns/src/limit/gauge.ts +117 -0
  289. package/packages/patterns/src/list/cards.ts +131 -0
  290. package/packages/patterns/src/list/cycle.ts +22 -0
  291. package/packages/patterns/src/media/panels.ts +100 -0
  292. package/packages/patterns/src/objects.ts +234 -0
  293. package/packages/patterns/src/quote/karaoke.ts +126 -0
  294. package/packages/patterns/src/quote/slam.ts +22 -0
  295. package/packages/patterns/src/screen/focus.ts +85 -0
  296. package/packages/patterns/src/steps/path.ts +137 -0
  297. package/packages/patterns/src/steps/stack.ts +111 -0
  298. package/packages/patterns/src/term-reveal/chips.ts +92 -0
  299. package/packages/patterns/src/term-reveal/expand.ts +127 -0
  300. package/packages/patterns/src/timeline/axis.ts +144 -0
  301. package/packages/patterns/src/title/mask.ts +85 -0
  302. package/packages/patterns/src/title/slam.ts +23 -0
  303. package/packages/patterns/src/toggle-sim/switch.ts +92 -0
  304. package/packages/patterns/src/trend/columns.ts +108 -0
  305. package/packages/patterns/src/trend/draw.ts +140 -0
  306. package/packages/patterns/src/types.ts +67 -0
  307. package/packages/patterns/src/words/moves.ts +42 -0
  308. package/packages/patterns/src/words/slam.ts +4 -0
  309. package/packages/plan/package.json +15 -0
  310. package/packages/plan/src/asks.ts +256 -0
  311. package/packages/plan/src/brief.ts +383 -0
  312. package/packages/plan/src/captions.ts +78 -0
  313. package/packages/plan/src/detect.ts +93 -0
  314. package/packages/plan/src/index.ts +27 -0
  315. package/packages/plan/src/layout.ts +176 -0
  316. package/packages/plan/src/llm.ts +172 -0
  317. package/packages/plan/src/look.ts +222 -0
  318. package/packages/plan/src/plan.ts +179 -0
  319. package/packages/plan/src/request.ts +55 -0
  320. package/packages/plan/src/series.ts +76 -0
  321. package/packages/plan/src/studio.ts +53 -0
  322. package/packages/plan/src/templates.ts +42 -0
  323. package/packages/plan/src/themes.ts +48 -0
  324. package/packages/plan/src/types.ts +157 -0
  325. package/packages/studio/package.json +12 -0
  326. package/packages/studio/src/index.ts +1 -0
  327. package/packages/studio/src/plugin.ts +236 -0
  328. package/packages/studio/src/ui/main.ts +503 -0
  329. package/packages/studio/src/ui/studio.css +165 -0
  330. package/packages/studio/src/ui/timeline.ts +317 -0
  331. package/packages/themes/kit/THEME-MAKE.md +68 -0
  332. package/packages/themes/kit/THEME.md +30 -0
  333. package/packages/themes/kit/briefs/og-intro-15s/brief.json +16 -0
  334. package/packages/themes/kit/briefs/og-intro-15s/facts.ts +29 -0
  335. package/packages/themes/kit/briefs/og-intro-15s/logo.svg +12 -0
  336. package/packages/themes/kit/effects.ts +5 -0
  337. package/packages/themes/kit/sample/index.html +11 -0
  338. package/packages/themes/kit/sample/main.ts +9 -0
  339. package/packages/themes/kit/sample/scenes/scene.ts +15 -0
  340. package/packages/themes/package.json +19 -0
  341. package/packages/themes/src/factory.ts +296 -0
  342. package/packages/themes/src/fx.ts +14 -0
  343. package/packages/themes/src/index.ts +114 -0
  344. package/packages/themes/src/slotkit.ts +79 -0
  345. package/packages/themes/src/slots.ts +46 -0
  346. package/packages/themes/src/stage3d.ts +197 -0
  347. package/packages/themes/src/types.ts +58 -0
  348. package/presets/kawaii-pastel.json +94 -0
  349. package/presets/neutral-dark.json +82 -0
  350. package/presets/og.json +98 -0
  351. package/series/og-shorts.json +14 -0
  352. package/skills/kasaframe/SKILL.md +33 -0
  353. package/templates/_shared/project/index.html +11 -0
  354. package/templates/_shared/project/lib/react.ts +22 -0
  355. package/templates/_shared/project/lib/stage.ts +292 -0
  356. package/templates/_shared/project/main.ts +9 -0
  357. package/templates/_shared/scenes/default.ts +21 -0
  358. package/templates/_shared/scenes/drop.ts +33 -0
  359. package/templates/_shared/scenes/end.ts +26 -0
  360. package/templates/_shared/scenes/hook.ts +18 -0
  361. package/templates/_shared/scenes/seam.ts +41 -0
  362. package/templates/_shared/scenes/step.ts +49 -0
  363. package/templates/ad/preview.png +0 -0
  364. package/templates/ad/template.json +151 -0
  365. package/templates/demo/preview.png +0 -0
  366. package/templates/demo/template.json +141 -0
  367. package/templates/explainer/preview.png +0 -0
  368. package/templates/explainer/template.json +193 -0
  369. package/templates/launch/preview.png +0 -0
  370. package/templates/launch/template.json +163 -0
  371. package/templates/mv/preview.png +0 -0
  372. package/templates/mv/scenes/default.ts +98 -0
  373. package/templates/mv/template.json +178 -0
  374. package/templates/promo/preview.png +0 -0
  375. package/templates/promo/template.json +185 -0
  376. package/templates/shorts/preview.png +0 -0
  377. package/templates/shorts/scenes/hook.ts +37 -0
  378. package/templates/shorts/template.json +196 -0
  379. package/templates/square/preview.png +0 -0
  380. package/templates/square/template.json +133 -0
  381. package/themes/debug-hud/THEME.md +39 -0
  382. package/themes/debug-hud/effects.ts +389 -0
  383. package/themes/debug-hud/sample/assets/og/logo.svg +12 -0
  384. package/themes/debug-hud/sample/beats.json +1 -0
  385. package/themes/debug-hud/sample/index.html +11 -0
  386. package/themes/debug-hud/sample/kf.json +59 -0
  387. package/themes/debug-hud/sample/lib/hudkit.ts +49 -0
  388. package/themes/debug-hud/sample/lib/og.ts +29 -0
  389. package/themes/debug-hud/sample/main.ts +9 -0
  390. package/themes/debug-hud/sample/scenes/end.ts +62 -0
  391. package/themes/debug-hud/sample/scenes/gather.ts +67 -0
  392. package/themes/debug-hud/sample/scenes/models.ts +70 -0
  393. package/themes/debug-hud/sample/scenes/price.ts +79 -0
  394. package/themes/debug-hud/sample/style.json +91 -0
  395. package/themes/debug-hud/slots.ts +99 -0
  396. package/themes/debug-hud/still.png +0 -0
  397. package/themes/debug-hud/style.json +91 -0
  398. package/themes/debug-hud/theme.json +68 -0
  399. package/themes/og-measure/THEME.md +47 -0
  400. package/themes/og-measure/effects.ts +432 -0
  401. package/themes/og-measure/sample/assets/brand/og-logo-full.svg +12 -0
  402. package/themes/og-measure/sample/assets/brand/og-logo.svg +12 -0
  403. package/themes/og-measure/sample/assets/data/measure.json +353 -0
  404. package/themes/og-measure/sample/beats.json +1 -0
  405. package/themes/og-measure/sample/index.html +11 -0
  406. package/themes/og-measure/sample/kf.json +66 -0
  407. package/themes/og-measure/sample/lib/data.ts +62 -0
  408. package/themes/og-measure/sample/main.ts +9 -0
  409. package/themes/og-measure/sample/measure.ts +78 -0
  410. package/themes/og-measure/sample/scenes/end.ts +47 -0
  411. package/themes/og-measure/sample/scenes/gather.ts +51 -0
  412. package/themes/og-measure/sample/scenes/models.ts +34 -0
  413. package/themes/og-measure/sample/scenes/one.ts +39 -0
  414. package/themes/og-measure/sample/scenes/price.ts +56 -0
  415. package/themes/og-measure/sample/style.json +97 -0
  416. package/themes/og-measure/slots.ts +88 -0
  417. package/themes/og-measure/still.png +0 -0
  418. package/themes/og-measure/style.json +97 -0
  419. package/themes/og-measure/theme.json +79 -0
  420. package/themes/riso-zine/THEME.md +43 -0
  421. package/themes/riso-zine/effects.ts +321 -0
  422. package/themes/riso-zine/sample/assets/og/logo.svg +12 -0
  423. package/themes/riso-zine/sample/beats.json +1 -0
  424. package/themes/riso-zine/sample/index.html +11 -0
  425. package/themes/riso-zine/sample/kf.json +59 -0
  426. package/themes/riso-zine/sample/lib/og.ts +29 -0
  427. package/themes/riso-zine/sample/lib/shot.ts +86 -0
  428. package/themes/riso-zine/sample/lib/zine.ts +42 -0
  429. package/themes/riso-zine/sample/main.ts +9 -0
  430. package/themes/riso-zine/sample/scenes/end.ts +61 -0
  431. package/themes/riso-zine/sample/scenes/gather.ts +62 -0
  432. package/themes/riso-zine/sample/scenes/models.ts +52 -0
  433. package/themes/riso-zine/sample/scenes/price.ts +82 -0
  434. package/themes/riso-zine/sample/style.json +99 -0
  435. package/themes/riso-zine/slots.ts +81 -0
  436. package/themes/riso-zine/still.png +0 -0
  437. package/themes/riso-zine/style.json +99 -0
  438. package/themes/riso-zine/theme.json +75 -0
  439. package/tools/beats/beats.py +372 -0
  440. package/tools/beats/requirements.txt +3 -0
  441. package/tools/lyrics/align.py +164 -0
  442. package/tools/lyrics/requirements.txt +9 -0
@@ -0,0 +1,153 @@
1
+ # @kasaframe/motion · @kasaframe/core — 움직임 사용서
2
+
3
+ 모든 부품은 `(t, opts)` 의 순수 함수다. **같은 t 면 같은 값** — 앞 프레임 상태가 없어서 아무 시각으로 건너뛰어도, 탭을 나눠 찍어도 같은 그림이 나온다. t 는 **장면 안 초**(장면 시작이 0). 글을 돌려주는 부품은 무엇이 들어와도 `undefined`·`NaN` 을 찍지 않는다.
4
+
5
+ ## 장면에서 쓰는 꼴
6
+
7
+ ```ts
8
+ import { applyStyle, combine, type SceneCtx } from "@kasaframe/core";
9
+ import { enter, typeText, dropBurst, beatPulse } from "@kasaframe/motion";
10
+
11
+ export default {
12
+ build(root: HTMLElement, ctx: SceneCtx) {
13
+ const title = document.createElement("div");
14
+ root.append(title);
15
+ return (t: number) => {
16
+ title.textContent = typeText("선택한 줄을 보냅니다", t, { at: 0.3 }).text;
17
+ applyStyle(title, enter("rise", t, { at: 0.2, scene: ctx.id }));
18
+ };
19
+ },
20
+ };
21
+ ```
22
+
23
+ React 장면은 `<KfScene t={t} ctx={ctx}>` 로 감싸면 아래 부품이 시각·박자·스타일을 알아서 받는다(`@kasaframe/motion/react`).
24
+
25
+ ## core
26
+
27
+ | 부품 | 하는 일 |
28
+ |---|---|
29
+ | `clip(t, from, dur)` → `{ local, p, active }` | 구간 진행도 |
30
+ | `seq([{ id, dur, overlap? }])` → `{ items, duration, at(t) }` | 이어 붙이기 |
31
+ | `interpolate(v, [0, 1], [0, 100], { ease, extrapolate })` | 값 사상(밖은 끝값에 붙음) |
32
+ | `ease.outCubic` … `ease.snappy` · `bezier(x1,y1,x2,y2)` · `toEase("name")` | 이징(모르는 이름은 던진다) |
33
+ | `spring(t, { from, to, stiffness, damping, mass, velocity })` | 닫힌 식 스프링 — t 는 초 |
34
+ | `rand(seed, i)` · `randRange` · `randInt` · `pick` · `shuffle` · `noise1(seed, x)` | 시드 난수. `Math.random` 금지 |
35
+ | `ctx.beats` — `beatAt(n)` · `nearestBeat(t, grid)` · `prev`/`next(t, grid)` · `drop(i)` · `section(t)` · `phrase(t)` · `inDrop(t)` · `pulse(t, { every, decay, within })` · `energy(t, band)` | 장면 기준 박자. grid = `beat`·`downbeat`·`bar`·`phrase`·`drop`·`section` |
36
+ | `combine(a, b, …)` · `toCss(style)` · `applyStyle(el, style)` | `Style` 겹치기·CSS 로 |
37
+
38
+ ## motion
39
+
40
+ | 부품 | 하는 일 |
41
+ |---|---|
42
+ | `enter(move, t, { at, dur, ease, distance, from })` · `exit(…)` · `inOut(…, { out })` | 등장·퇴장 `fade` `rise` `drop` `pop` `blurIn` `scaleIn` `maskWipe` `slide` |
43
+ | `stagger(i, { each, origin, count })` | i 번째 늦춤 |
44
+ | `typeText(text, t, { at, cps, jitter, ime })` → `{ text, caret, done, … }` | **한글 자모 단위 타자**(두벌식 — `가 → 간 → 가나`). 끝은 늘 원문 |
45
+ | `typeLines(lines, t)` · `typeDuration(text)` | 여러 줄 · 걸리는 초 |
46
+ | `counter(t, { to, from, decimals, unit: "ko", prefix, suffix })` | 굴러 오르는 숫자 글 |
47
+ | `words(text, t, { move, each })` · `letters(…)` | 낱말·글자 키네틱 |
48
+ | `sweep(t, { at })` | 형광펜 쓸기(`Style.clip`) |
49
+ | `transition(name, t, { at, dur, width, dir })` → `{ out, in }` | `whip` `zoomThrough` `slide` `matchCut` `crossfade` |
50
+ | `camera(t, { at, kind: "push"·"pull"·"pan"·"tilt", amount })` | 카메라 — 프레이즈당 한 번 |
51
+ | `breathe(t, { seed: ctx.id })` | 숨 쉬는 틀 — 가만히 있는 화면이 멈춤 검사에 걸리지 않게. **바탕이 아닌 내용 층에** 건다 |
52
+ | `dropBurst(t, { beats: ctx.beats, drop: 0, rules: ctx.style.motion })` → `{ flash, ring, shake, punch }` | 드롭 터짐 — 드롭 번호로만 건다 |
53
+ | `beatPulse(t, { beats, rules, amount })` | 박 펄스 — 기본은 드롭 구간만 |
54
+ | `shake(t, { at, px, rules })` | 흔들림(`rules.shake.maxPx` 상한) |
55
+ | `sparkles(t, { width, height, count, seed })` · `burst(t, { at, x, y })` | 반짝이 · 터지는 조각 |
56
+ | `cursor(t, [{ t, x, y, click }])` | 커서 이동·클릭 물결 |
57
+ | `terminal(t, [{ cmd, out }], { at })` · `codeReveal(code, t)` | 터미널 입력 · 코드 블록 |
58
+ | `grow(t, values, { at, stagger })` · `draw(t, { at })` | 차트 자라기 · 선 그리기 |
59
+ | `flyPath(t, [{ t, pos, look }])` | three.js 카메라 비행 |
60
+ | `transition3d(root, ctx, { kind })` | 3D 장면 전환·셰이더 전환(`gl:<이름>`·`smooth:<이름>`) — 아래 절, 목록은 `kf transitions` |
61
+
62
+ React(`@kasaframe/motion/react`): `KfScene` `Sequence` `Series`+`SeriesItem` `Fill` `useTime` `useCtx` `useBeats` · `Enter` `Typewriter` `Counter` `Words` `Highlight` `Transition` `Camera` `Breathe` `BeatPulse` `DropBurst` `Sparkles` `Burst` `Cursor` `Terminal` `CodeBlock` `BarChart` `DeviceFrame`. 부품마다 `t` 를 직접 줘도 된다.
63
+
64
+ ## 3D 전환 — `@kasaframe/motion/transition3d`
65
+
66
+ 앞 장면 화면을 three.js 공간의 판에 붙이고 카메라를 움직여 뒤 장면 화면에 내려앉는다. 영상 모델 없이 코드로 그리므로 같은 t 면 같은 그림이고, **구간 앞은 앞 장면 그림, 끝은 뒤 장면 그림 그대로**(텍셀을 색 공간 변환 없이 1:1 로 낸다 — 경계 프레임 차 0).
67
+
68
+ ```ts
69
+ import { transition3d } from "@kasaframe/motion/transition3d";
70
+
71
+ // 이음매 장면(kf.json 장면 하나) — ctx 만 주면 된다
72
+ export default {
73
+ build(root: HTMLElement, ctx: SceneCtx) {
74
+ return transition3d(root, ctx, { kind: "dive" });
75
+ },
76
+ };
77
+ ```
78
+
79
+ | `kind` | 그림 |
80
+ |---|---|
81
+ | `dive` | 화면 속으로 — 짧게 물러나면 책상 위 모니터, 옆으로 쓸며 다가가 화면이 칸칸이 녹으며 뚫고 들어가 깊은 빛 고리 통로를 한 바퀴 돌며 날아 뒤 장면으로 |
82
+ | `portal` | 화면에 둥근 구멍이 열리고 깊은 터널을 날아 뒤 장면으로 |
83
+ | `cards` | 장면들이 3D 공간의 판으로 떠 있고 카메라가 다음 판으로 날아간다 |
84
+ | `shatter` | 앞 장면이 칸으로 쪼개져 흩어지고 뒤 장면 칸이 날아와 맞춰진다 |
85
+ | `zoomOut` | 앞 장면이 뒤 장면 속 작은 창이었음이 드러난다(`window: { x, y, h }` — 뒤 장면 안 창 중심·높이 0..1) |
86
+ | `fold` | 병풍처럼 접혀 옆으로 빠진다. `fold: "roll"` 이면 아래부터 말려 올라간다 |
87
+ | `diveChain` | 화면 속 화면 — `screens` 를 깊이로 늘어놓고 끊김 없이 뚫고 들어간다. `arrivals: "bar"`·`"beat"`(박마다 한 겹) 또는 시각 배열, `settle` 0 흘러가기 … 1 화면마다 멈추기 |
88
+ | `whip` | 휙 넘기기 — 제자리에서 90° 를 휙 돈다. 반대로 살짝 감았다가 확 돌고 넘쳤다 선다, 도는 동안 기울고 화각이 넓어진다 |
89
+ | `rise` | 2D → 3D 공간 잇기 — 앞 장면 판이 바닥으로 눕고, 그 주인공 상자(`[data-kf-hero]`, 없으면 가장 넓은 글·`hero` 로 직접)가 같은 화면 자리에서 블록으로 선다(옆면은 그 요소의 2D 색). 카메라는 깊이로 기울어 들어가 블록 위를 지나 뒤 장면 벽 앞에 정면으로 선다 |
90
+ | `land` | 3D → 2D 공간 잇기 — 앞 장면(3D 샷 끝 화면) 앞 공간에 누운 판이 일어서고 카메라가 그 판으로 다가간다. 판 위 주인공 블록은 평면으로 내려앉고, 판이 정면으로 꽉 찬 순간이 뒤 장면 첫 화면 |
91
+
92
+ - **섬광 안전** — 화면 사이로 보이는 하늘은 앞 화면 바탕색 → 뒤 화면 바탕색으로 서서히 넘어간다(`bridgeSky` — 밝기 순 가운데 절반 평균). 밝은 화면과 어두운 공간이 칸마다 엇갈려 오가면 `kf check` 의 `frame.flash` 에 걸린다. `whip` 은 가장 빠를 때 두 판의 대비를 그 색 쪽으로 누른다(셔터가 번진 것처럼, 양 끝은 0).
93
+
94
+ - **살아 있는 화면** — `live: { kf, scenes: import.meta.glob("./*.ts", { eager: true }) }` 를 주면 앞 장면은 자기 끝을 지나 계속 돌고(타자·카운터가 전환 중에도 이어진다) 뒤 장면은 첫 프레임에서 기다린다. 다른 장면 하나는 `sceneSource(모듈, ctx, { id, from, dur }, (t) => 그 장면 시각)`, 영상은 `{ video: 주소, from: 영상 전체 기준 0 초 }`, 아무 DOM 은 `{ dom(root) { …; return (t) => … }, still? }`. DOM 은 크롬 HTML-in-Canvas(`--enable-features=CanvasDrawElement`, 렌더·검사 브라우저는 켜져 있다)로 seek 마다 paint 이벤트 안에서 텍스처에 올리고 `onSeek` 이 그 페인트를 기다린다 — 같은 t 두 번이 바이트까지 같다. 플래그 없는 브라우저는 `still`(이음매는 `assets/seam` 그림)로 물러난다.
95
+ - **그림** — `from`·`to` 에 주소(`kf still` PNG 등)·`<img>`·`<canvas>`·그리기 함수 `(g, t, w, h) => void`(같은 t 같은 그림). ctx 만 주면 `assets/seam/<장면id>-from.png`(앞 장면 마지막 프레임)·`-to.png`(뒤 장면 첫 프레임)을 쓰고, 없으면 스타일 색으로 그린 대체 화면(없는 파일을 부르지 않아 검사가 깨끗하다). 찍는 곳은 `kf make`(장면을 다 쓴 뒤 `@kasaframe/gen` 의 `seamFrames` 프레임으로).
96
+ - **시각** — ctx 만 주면 앞 장면 마지막 프레임에서 뒤 장면 첫 프레임까지(그 두 프레임은 이웃 장면이 찍으므로 같은 그림이 두 번 나오지 않는다). 직접 주려면 `at`·`dur`, 드롭·박에 끝을 맞추려면 `endAt: ctx.beats.drop(0)` 또는 `snap: "beat" | "bar" | "drop"`.
97
+ - **역동성(기본 켬)** — `pace: "ramp"`(천천히 들어가다 확 빨라진다, `"linear"` 면 종류 그대로) · 3D 는 `land`(끝에서 살짝 넘쳐 들어갔다 선다) · `hits`(카메라 충격 — 흔들림 + 화각 펀치, 기본은 전환 안에 든 드롭, 흔들림은 `shake` 이벤트로 검사가 센다) · `dof`(피사계 심도 조리개, 기본 0.03). 전부 양 끝에서 0 이라 경계 프레임은 그대로다.
98
+ - **모션 블러** — `npx kf render <폴더> --motion-blur 8 --shutter 180`(`kf still` 도 같다). 엔진이 한 프레임을 하위 프레임 8 장으로 찍어 평균해 빠른 것만 번진다. 하위 프레임 번호가 페이지 `seek(t, { index, count })` 로 넘어와, 3D 전환은 그 번호로 카메라를 조리개 위에서 옮겨 같은 평균에서 피사계 심도가 생긴다(초점은 시선 점). 셔터는 장면 경계를 넘지 않는다. seek 모드만, N 배 느리다.
99
+ - `seed`(기본 장면 id) 로 방향·흩어짐이 바뀐다. `colors: { bg, deep, accent, glow }` 로 공간 색을 덮는다(기본은 `style.json` — 밝은 스타일이면 밤 색을 깊은 바탕으로).
100
+ - 렌더러 하나를 돌려 쓴다(크롬은 페이지당 WebGL 문맥이 16 개쯤) — 전환이 몇 개든 괜찮다. 받는 중인 그림이 있으면 엔진 `onSeek` 에서 다 받고 같은 t 로 다시 그린다(React 장면이 첫 seek 에서 지어져도 대체 화면이 안 찍힌다).
101
+ - React: `import { Transition3D } from "@kasaframe/motion/transition3d/react"` → `<KfScene t={t} ctx={ctx}><Transition3D kind="portal" /></KfScene>`.
102
+ - 순수 리그(`diveRig(u, env)`·`chainZ` 등)는 브라우저 없이 시험한다. 데모: `packages/motion/demo/transition3d`(정지 그림 일곱 가지 — 경계 픽셀 시험용), `packages/motion/demo/transition3d-live`(곡에 맞춰 재생 중인 영상·살아 있는 장면 사이를 쉬지 않고 — 연속 다이브 마디·박), 한 장 모으기 `node packages/motion/demo/strip.ts <프로젝트> <out.png>`.
103
+
104
+ ## 전환 모음 — 이름 하나로 부르기 · `kf transitions`
105
+
106
+ `transition3d` 의 `kind` 에 3D 일곱 가지 말고도 셰이더 전환을 이름으로 준다. 앞·뒤 화면(정지 그림·영상·살아 있는 장면·`live`)과 시각 규칙은 그대로다.
107
+
108
+ ```ts
109
+ transition3d(root, ctx, { kind: "gl:crosswarp" }); // gl-transitions 125개 — `gl:<이름>`
110
+ transition3d(root, ctx, { kind: "gl:Swirl", params: { radius: 0.8 } }); // 셰이더 uniform 덮기
111
+ transition3d(root, ctx, { kind: "smooth:sdf-merge" }); // SmoothUI 덮개 13개 — reveal-* · sdf-*
112
+ ```
113
+
114
+ - 전부 진행도의 순수 함수(seek)라 같은 t 면 바이트까지 같다. 양 끝(u = 0·1)은 셰이더를 거치지 않고 앞·뒤 화면 텍셀 그대로 낸다 — 원본 셰이더가 0·1 에서 어떻든 경계가 이어진다.
115
+ - 공유 WebGL 렌더러 하나에서 GLSL ES 1.00 그대로 컴파일한다. 원본 기본값이 형과 어긋난 것(float 90, bool 1)은 맞춰 넣는다. 무늬 그림을 받는 것(`displacement`·`luma`)엔 시드 고정 노이즈를 꽂는다.
116
+ - SmoothUI 덮개는 가운데에서 바탕을 앞→뒤로 갈고 끝 0.2 동안 사라진다. 원본은 덮개를 앞쪽에 몰아(outQuart) 첫 15% 에 다 지나가서, 영상에선 고르게(inOutCubic) 편다.
117
+ - 목록 — `npx kf transitions [찾을 말] [--source gl] [--clock seek|step] [--use transition3d|react|vendor] [--json]`. 197개(3D 7 · gl-transitions 125 · MIT 웹 부품 62 · Skiper UI 3)의 이름·출처·라이선스·시계·쓰는 법. 코드에서는 `import { CATALOG } from "@kasaframe/motion/transitions2d"`.
118
+ - 이름으로 못 부르는 웹 부품 — React 부품 10개는 `@kasaframe/motion/transitions2d/react`(`MorphText` 는 CSS 라 seek, 나머지 rAF 는 `kf.json` 의 `"mode": "step"`). 나머지 42개는 원본만 geono-hub `vendor/transitions/` 에 있다(목록의 `원본만`).
119
+ - 들이지 않은 것 — React Bits·Animate UI(MIT + Commons Clause), Aceternity UI(재배포 금지). 출처·라이선스 원문은 레포 루트 `NOTICE`, 폴더마다 원본 `LICENSE`.
120
+ - 갤러리 — `packages/motion/demo/transitions-gallery`(이름으로 부르는 145개 + CSS 부품, seek), `transitions-gallery-step`(rAF 부품 8개, step). `npx kf sheet <폴더> --per-scene 1` 이 전환마다 가운데 프레임 한 장.
121
+
122
+ ## 연출 수 — `@kasaframe/motion/moves`
123
+
124
+ 영상에서 모은 수(글·선·그림 바탕·전환·UI) — 수마다 3–5초 예시와 갤러리는 [`examples/moves/`](../../examples/moves/README.md). 꼴은 거의 다 `수(el, { w, h, hits, scene, … }) → (t) => void`.
125
+
126
+ - `MENU`·`bundleFor(틀 moves, 테마)`·`pickDress(씨앗, 장면, 묶음)`(`@kasaframe/motion/menu` — DOM 없이 Node 에서도): 뼈대가 바로 거는 메뉴와 장면마다 시드로 고르기. 같은 요청이면 같은 수, 이어지는 장면은 다른 수, 경계 덮기는 이음매·드롭 앞에 안 건다.
127
+ - `dressBg`·`dressText`·`dressWipe`: 메뉴 이름을 장면에 거는 쪽 — 예시에서 검사를 넘긴 값을 기본으로. 덮기는 경계의 영상 시각을 씨앗으로 써 앞 장면 끝과 뒤 장면 처음이 같은 덮개로 이어진다. 무대(`lib/stage.ts` `makeStage(root, ctx, { dress })`)가 부른다.
128
+
129
+ ## 규칙(style.json `motion`)과 검사
130
+
131
+ - 박 펄스·흔들림·섬광·카메라·등장 움직임은 효과가 0 이 아닌 프레임마다 `window.__kf.events` 에 한 줄 남긴다 — `kf check` 가 규칙 위반을 센다. **손으로 짠 흔들림은 안 잡힌다** — 위 부품을 쓴다.
132
+ - `scene: ctx.id` 를 넘기면 장면 단위로 센다(React 부품은 `KfScene` 이 넣는다).
133
+ - 이어지는 두 장면에 같은 등장 움직임을 쓰지 않는다(`repeatSameMove: false`).
134
+ - 등장이 끝나고 가만히 있는 화면은 `maxFreezeSec`(0.5초)를 넘기면 멈춤으로 잡힌다 — 장면 내용을 `breathe` 로 감싼다. 커서 깜빡임만으로는 모자란다.
135
+ - 드롭 연출은 `drop(i)` 로 잰 시각에만. BPM 을 곱해 시각을 만들지 않는다.
136
+
137
+ ## Remotion 에서 옮길 때
138
+
139
+ | Remotion | kasaframe |
140
+ |---|---|
141
+ | `useCurrentFrame()` | 장면 함수의 `t`(초) · React 는 `useTime()`. 프레임이 필요하면 `toFrame(t, fps)` |
142
+ | `useVideoConfig()` | `ctx.meta` — `{ fps, width, height, duration }` |
143
+ | `<AbsoluteFill>` | `<Fill>` |
144
+ | `<Sequence from durationInFrames>` | `<Sequence from={초} dur={초}>` |
145
+ | `<Series>` · `<Series.Sequence>` | `<Series>` · `<SeriesItem dur={초}>` |
146
+ | `spring({ frame, fps, config })` | `spring(t, { stiffness, damping, mass })` — 초 |
147
+ | `interpolate(frame, [..], [..], { extrapolateRight: "clamp" })` | `interpolate(t, [..], [..])` — 기본이 clamp |
148
+ | `random(seed)` | `rand(seed, i)` |
149
+ | `staticFile("x.png")` | `ctx.asset("x.png")` |
150
+ | `<Img>` | `<img src={ctx.asset(…)}>` — 엔진 `ready()` 가 받을 때까지 기다린다 |
151
+ | `<Video>` · `<OffthreadVideo>` | `<video data-kf-from="초">` — 엔진 `syncMedia` |
152
+ | `<Audio>` | 곡은 `kf.json` 의 `music` — 렌더가 얹는다 |
153
+ | `delayRender()` / `continueRender()` | 엔진 페이지의 `ready()` |
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@kasaframe/motion",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "exports": {
7
+ ".": "./src/index.ts",
8
+ "./react": "./src/react/index.tsx",
9
+ "./transition3d": "./src/transition3d/index.ts",
10
+ "./transition3d/react": "./src/transition3d/react.tsx",
11
+ "./transitions2d": "./src/transitions2d/index.ts",
12
+ "./transitions2d/react": "./src/transitions2d/react.ts",
13
+ "./moves": "./src/moves/index.ts",
14
+ "./menu": "./src/moves/menu.ts",
15
+ "./captions": "./src/captions.ts"
16
+ },
17
+ "dependencies": {
18
+ "@kasaframe/adapters": "^0.0.0",
19
+ "@kasaframe/core": "0.0.0",
20
+ "motion": "^12.43.0",
21
+ "react": "^19.3.0",
22
+ "three": "^0.186.1"
23
+ },
24
+ "devDependencies": {
25
+ "@types/react": "^19.3.0",
26
+ "@types/react-dom": "^19.3.0",
27
+ "@types/three": "^0.186.0",
28
+ "react-dom": "^19.3.0"
29
+ }
30
+ }
@@ -0,0 +1,97 @@
1
+ import { emit, progress, rand, toEase, type Ease, type EaseName, type Style, safeTime } from "@kasaframe/core";
2
+
3
+ export interface CameraOpts {
4
+ at: number;
5
+ dur?: number;
6
+ /** push 다가가기 · pull 물러나기 · pan 옆으로 · tilt 위아래 */
7
+ kind?: "push" | "pull" | "pan" | "tilt";
8
+ /** push·pull 은 배율 차(0.08 = 8%), pan·tilt 는 px */
9
+ amount?: number;
10
+ dir?: 1 | -1;
11
+ ease?: EaseName | Ease;
12
+ source?: string;
13
+ scene?: string;
14
+ emit?: boolean;
15
+ }
16
+
17
+ /**
18
+ * 장면 틀 하나에 거는 카메라 움직임. style.json 의 cameraMove 가 once-per-phrase 면
19
+ * 프레이즈마다 한 번만 쓴다 — 검사가 camera 이벤트로 센다.
20
+ */
21
+ export function camera(t: number, opts: CameraOpts): Style {
22
+ t = safeTime(t);
23
+ const kind = opts.kind ?? "push";
24
+ const dur = opts.dur ?? 2.4;
25
+ const raw = progress(t, opts.at, dur);
26
+ const p = toEase(opts.ease, toEase("inOutCubic"))(raw);
27
+ const dir = opts.dir ?? 1;
28
+ const amount = opts.amount ?? (kind === "push" || kind === "pull" ? 0.08 : 120);
29
+ let s: Style;
30
+ let moved: number;
31
+ if (kind === "push" || kind === "pull") {
32
+ const d = (kind === "push" ? 1 : -1) * amount * p;
33
+ s = { scale: 1 + d };
34
+ moved = Math.abs(d) * 1000;
35
+ } else {
36
+ const d = -dir * amount * p;
37
+ s = kind === "pan" ? { x: d } : { y: d };
38
+ moved = Math.abs(d);
39
+ }
40
+ if (opts.emit !== false && raw > 0 && raw < 1) emit({ kind: "camera", source: opts.source ?? `camera:${kind}`, scene: opts.scene, value: moved });
41
+ return s;
42
+ }
43
+
44
+ export interface BreatheOpts {
45
+ /** 한 번 숨 쉬는 초 */
46
+ period?: number;
47
+ /** 커졌다 돌아오는 배율 차 */
48
+ scale?: number;
49
+ /** 옆으로 흐르는 px */
50
+ drift?: number;
51
+ /** 시작 위상 — 장면마다 다르게 주면 같은 숨이 반복돼 보이지 않는다 */
52
+ seed?: number | string;
53
+ }
54
+
55
+ /**
56
+ * 가만히 있는 화면이 멈춤으로 보이지 않게 아주 느리게 숨 쉬는 틀. 흐름은 타원을 돌아 속도가 0 이 되는
57
+ * 순간이 없다 — 어느 0.5 초를 잘라도 움직임이 남는다(kf check 의 멈춤 검사를 통과하는 까닭).
58
+ * 바탕이 아닌 내용 층에 건다: 바탕째 밀면 가장자리에 페이지 바탕이 비친다. 카메라 이동으로 치지 않는다(이벤트 없음).
59
+ */
60
+ export function breathe(t: number, opts: BreatheOpts = {}): Style {
61
+ t = safeTime(t);
62
+ const period = Math.max(0.5, opts.period ?? 3.2);
63
+ const phase = rand(opts.seed ?? "breathe", 0) * Math.PI * 2;
64
+ const w = (Math.PI * 2 * t) / period + phase;
65
+ const s = opts.scale ?? 0.03;
66
+ const d = opts.drift ?? 16;
67
+ return { scale: 1 + s * (0.5 - 0.5 * Math.cos(w)), x: d * Math.sin(w), y: d * 0.5 * Math.cos(w) };
68
+ }
69
+
70
+ export type Vec3 = [number, number, number];
71
+
72
+ export interface FlyKey {
73
+ t: number;
74
+ pos: Vec3;
75
+ look: Vec3;
76
+ }
77
+
78
+ /** 카트멀-롬으로 키 사이를 잇는다 — three.js 카메라 비행. 키가 하나면 그 자리에 선다 */
79
+ export function flyPath(t: number, keys: FlyKey[], opts: { ease?: EaseName | Ease } = {}): { pos: Vec3; look: Vec3 } {
80
+ t = safeTime(t);
81
+ if (keys.length === 0) return { pos: [0, 0, 10], look: [0, 0, 0] };
82
+ const ks = keys.slice().sort((a, b) => a.t - b.t);
83
+ if (t <= ks[0].t || ks.length === 1) return { pos: [...ks[0].pos], look: [...ks[0].look] };
84
+ const last = ks[ks.length - 1];
85
+ if (t >= last.t) return { pos: [...last.pos], look: [...last.look] };
86
+ let i = 0;
87
+ while (i < ks.length - 2 && t >= ks[i + 1].t) i++;
88
+ const a = ks[Math.max(0, i - 1)];
89
+ const b = ks[i];
90
+ const c = ks[i + 1];
91
+ const d = ks[Math.min(ks.length - 1, i + 2)];
92
+ const u = toEase(opts.ease, toEase("inOutCubic"))((t - b.t) / (c.t - b.t));
93
+ const cr = (p0: number, p1: number, p2: number, p3: number) =>
94
+ 0.5 * (2 * p1 + (-p0 + p2) * u + (2 * p0 - 5 * p1 + 4 * p2 - p3) * u * u + (-p0 + 3 * p1 - 3 * p2 + p3) * u * u * u);
95
+ const mix = (k: "pos" | "look"): Vec3 => [0, 1, 2].map((j) => cr(a[k][j], b[k][j], c[k][j], d[k][j])) as Vec3;
96
+ return { pos: mix("pos"), look: mix("look") };
97
+ }