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,142 @@
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
+
90
+ - **살아 있는 화면** — `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` 그림)로 물러난다.
91
+ - **그림** — `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` 프레임으로).
92
+ - **시각** — ctx 만 주면 앞 장면 마지막 프레임에서 뒤 장면 첫 프레임까지(그 두 프레임은 이웃 장면이 찍으므로 같은 그림이 두 번 나오지 않는다). 직접 주려면 `at`·`dur`, 드롭·박에 끝을 맞추려면 `endAt: ctx.beats.drop(0)` 또는 `snap: "beat" | "bar" | "drop"`.
93
+ - **역동성(기본 켬)** — `pace: "ramp"`(천천히 들어가다 확 빨라진다, `"linear"` 면 종류 그대로) · 3D 는 `land`(끝에서 살짝 넘쳐 들어갔다 선다) · `hits`(카메라 충격 — 흔들림 + 화각 펀치, 기본은 전환 안에 든 드롭, 흔들림은 `shake` 이벤트로 검사가 센다) · `dof`(피사계 심도 조리개, 기본 0.03). 전부 양 끝에서 0 이라 경계 프레임은 그대로다.
94
+ - **모션 블러** — `npx kf render <폴더> --motion-blur 8 --shutter 180`(`kf still` 도 같다). 엔진이 한 프레임을 하위 프레임 8 장으로 찍어 평균해 빠른 것만 번진다. 하위 프레임 번호가 페이지 `seek(t, { index, count })` 로 넘어와, 3D 전환은 그 번호로 카메라를 조리개 위에서 옮겨 같은 평균에서 피사계 심도가 생긴다(초점은 시선 점). 셔터는 장면 경계를 넘지 않는다. seek 모드만, N 배 느리다.
95
+ - `seed`(기본 장면 id) 로 방향·흩어짐이 바뀐다. `colors: { bg, deep, accent, glow }` 로 공간 색을 덮는다(기본은 `style.json` — 밝은 스타일이면 밤 색을 깊은 바탕으로).
96
+ - 렌더러 하나를 돌려 쓴다(크롬은 페이지당 WebGL 문맥이 16 개쯤) — 전환이 몇 개든 괜찮다. 받는 중인 그림이 있으면 엔진 `onSeek` 에서 다 받고 같은 t 로 다시 그린다(React 장면이 첫 seek 에서 지어져도 대체 화면이 안 찍힌다).
97
+ - React: `import { Transition3D } from "@kasaframe/motion/transition3d/react"` → `<KfScene t={t} ctx={ctx}><Transition3D kind="portal" /></KfScene>`.
98
+ - 순수 리그(`diveRig(u, env)`·`chainZ` 등)는 브라우저 없이 시험한다. 데모: `packages/motion/demo/transition3d`(정지 그림 일곱 가지 — 경계 픽셀 시험용), `packages/motion/demo/transition3d-live`(곡에 맞춰 재생 중인 영상·살아 있는 장면 사이를 쉬지 않고 — 연속 다이브 마디·박), 한 장 모으기 `node packages/motion/demo/strip.ts <프로젝트> <out.png>`.
99
+
100
+ ## 전환 모음 — 이름 하나로 부르기 · `kf transitions`
101
+
102
+ `transition3d` 의 `kind` 에 3D 일곱 가지 말고도 셰이더 전환을 이름으로 준다. 앞·뒤 화면(정지 그림·영상·살아 있는 장면·`live`)과 시각 규칙은 그대로다.
103
+
104
+ ```ts
105
+ transition3d(root, ctx, { kind: "gl:crosswarp" }); // gl-transitions 125개 — `gl:<이름>`
106
+ transition3d(root, ctx, { kind: "gl:Swirl", params: { radius: 0.8 } }); // 셰이더 uniform 덮기
107
+ transition3d(root, ctx, { kind: "smooth:sdf-merge" }); // SmoothUI 덮개 13개 — reveal-* · sdf-*
108
+ ```
109
+
110
+ - 전부 진행도의 순수 함수(seek)라 같은 t 면 바이트까지 같다. 양 끝(u = 0·1)은 셰이더를 거치지 않고 앞·뒤 화면 텍셀 그대로 낸다 — 원본 셰이더가 0·1 에서 어떻든 경계가 이어진다.
111
+ - 공유 WebGL 렌더러 하나에서 GLSL ES 1.00 그대로 컴파일한다. 원본 기본값이 형과 어긋난 것(float 90, bool 1)은 맞춰 넣는다. 무늬 그림을 받는 것(`displacement`·`luma`)엔 시드 고정 노이즈를 꽂는다.
112
+ - SmoothUI 덮개는 가운데에서 바탕을 앞→뒤로 갈고 끝 0.2 동안 사라진다. 원본은 덮개를 앞쪽에 몰아(outQuart) 첫 15% 에 다 지나가서, 영상에선 고르게(inOutCubic) 편다.
113
+ - 목록 — `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"`.
114
+ - 이름으로 못 부르는 웹 부품 — React 부품 10개는 `@kasaframe/motion/transitions2d/react`(`MorphText` 는 CSS 라 seek, 나머지 rAF 는 `kf.json` 의 `"mode": "step"`). 나머지 42개는 원본만 geono-hub `vendor/transitions/` 에 있다(목록의 `원본만`).
115
+ - 들이지 않은 것 — React Bits·Animate UI(MIT + Commons Clause), Aceternity UI(재배포 금지). 출처·라이선스 원문은 레포 루트 `NOTICE`, 폴더마다 원본 `LICENSE`.
116
+ - 갤러리 — `packages/motion/demo/transitions-gallery`(이름으로 부르는 145개 + CSS 부품, seek), `transitions-gallery-step`(rAF 부품 8개, step). `npx kf sheet <폴더> --per-scene 1` 이 전환마다 가운데 프레임 한 장.
117
+
118
+ ## 규칙(style.json `motion`)과 검사
119
+
120
+ - 박 펄스·흔들림·섬광·카메라·등장 움직임은 효과가 0 이 아닌 프레임마다 `window.__kf.events` 에 한 줄 남긴다 — `kf check` 가 규칙 위반을 센다. **손으로 짠 흔들림은 안 잡힌다** — 위 부품을 쓴다.
121
+ - `scene: ctx.id` 를 넘기면 장면 단위로 센다(React 부품은 `KfScene` 이 넣는다).
122
+ - 이어지는 두 장면에 같은 등장 움직임을 쓰지 않는다(`repeatSameMove: false`).
123
+ - 등장이 끝나고 가만히 있는 화면은 `maxFreezeSec`(0.5초)를 넘기면 멈춤으로 잡힌다 — 장면 내용을 `breathe` 로 감싼다. 커서 깜빡임만으로는 모자란다.
124
+ - 드롭 연출은 `drop(i)` 로 잰 시각에만. BPM 을 곱해 시각을 만들지 않는다.
125
+
126
+ ## Remotion 에서 옮길 때
127
+
128
+ | Remotion | kasaframe |
129
+ |---|---|
130
+ | `useCurrentFrame()` | 장면 함수의 `t`(초) · React 는 `useTime()`. 프레임이 필요하면 `toFrame(t, fps)` |
131
+ | `useVideoConfig()` | `ctx.meta` — `{ fps, width, height, duration }` |
132
+ | `<AbsoluteFill>` | `<Fill>` |
133
+ | `<Sequence from durationInFrames>` | `<Sequence from={초} dur={초}>` |
134
+ | `<Series>` · `<Series.Sequence>` | `<Series>` · `<SeriesItem dur={초}>` |
135
+ | `spring({ frame, fps, config })` | `spring(t, { stiffness, damping, mass })` — 초 |
136
+ | `interpolate(frame, [..], [..], { extrapolateRight: "clamp" })` | `interpolate(t, [..], [..])` — 기본이 clamp |
137
+ | `random(seed)` | `rand(seed, i)` |
138
+ | `staticFile("x.png")` | `ctx.asset("x.png")` |
139
+ | `<Img>` | `<img src={ctx.asset(…)}>` — 엔진 `ready()` 가 받을 때까지 기다린다 |
140
+ | `<Video>` · `<OffthreadVideo>` | `<video data-kf-from="초">` — 엔진 `syncMedia` |
141
+ | `<Audio>` | 곡은 `kf.json` 의 `music` — 렌더가 얹는다 |
142
+ | `delayRender()` / `continueRender()` | 엔진 페이지의 `ready()` |
@@ -0,0 +1,29 @@
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
+ "./captions": "./src/captions.ts"
15
+ },
16
+ "dependencies": {
17
+ "@kasaframe/adapters": "^0.0.0",
18
+ "@kasaframe/core": "0.0.0",
19
+ "motion": "^12.43.0",
20
+ "react": "^19.3.0",
21
+ "three": "^0.186.1"
22
+ },
23
+ "devDependencies": {
24
+ "@types/react": "^19.3.0",
25
+ "@types/react-dom": "^19.3.0",
26
+ "@types/three": "^0.186.0",
27
+ "react-dom": "^19.3.0"
28
+ }
29
+ }
@@ -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
+ }