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.
- package/LICENSE +21 -0
- package/NOTICE +146 -0
- package/README.md +77 -2
- package/app/package.json +12 -0
- package/app/server/engine.ts +415 -0
- package/app/server/main.ts +205 -0
- package/app/web/env.d.ts +2 -0
- package/app/web/icons.ts +31 -0
- package/app/web/index.html +21 -0
- package/app/web/main.ts +1013 -0
- package/app/web/style.css +430 -0
- package/bin/hooks.mjs +51 -0
- package/bin/kf.mjs +14 -0
- package/docs/AGENTS.md +238 -0
- package/music/README.md +13 -0
- package/package.json +44 -4
- package/packages/adapters/package.json +36 -0
- package/packages/adapters/src/css.ts +11 -0
- package/packages/adapters/src/gsap.ts +26 -0
- package/packages/adapters/src/index.ts +9 -0
- package/packages/adapters/src/lottie.ts +22 -0
- package/packages/adapters/src/media.ts +59 -0
- package/packages/adapters/src/page.ts +229 -0
- package/packages/adapters/src/project.ts +214 -0
- package/packages/adapters/src/react.ts +36 -0
- package/packages/adapters/src/svelte.ts +22 -0
- package/packages/adapters/src/three.ts +18 -0
- package/packages/adapters/src/vue.ts +27 -0
- package/packages/check/package.json +19 -0
- package/packages/check/src/check.ts +273 -0
- package/packages/check/src/cli.ts +70 -0
- package/packages/check/src/image.ts +146 -0
- package/packages/check/src/index.ts +9 -0
- package/packages/check/src/ocr.swift +37 -0
- package/packages/check/src/probe.ts +328 -0
- package/packages/check/src/report.ts +44 -0
- package/packages/check/src/rules/assets.ts +42 -0
- package/packages/check/src/rules/beats.ts +212 -0
- package/packages/check/src/rules/camera.ts +217 -0
- package/packages/check/src/rules/captions.ts +49 -0
- package/packages/check/src/rules/flash.ts +235 -0
- package/packages/check/src/rules/frames.ts +135 -0
- package/packages/check/src/rules/layout.ts +257 -0
- package/packages/check/src/rules/page.ts +87 -0
- package/packages/check/src/rules/runs.ts +20 -0
- package/packages/check/src/rules/text.ts +326 -0
- package/packages/check/src/scan.ts +240 -0
- package/packages/check/src/serve.ts +67 -0
- package/packages/check/src/types.ts +80 -0
- package/packages/check/src/video.ts +137 -0
- package/packages/cli/package.json +29 -0
- package/packages/cli/src/blur.ts +68 -0
- package/packages/cli/src/browser.ts +203 -0
- package/packages/cli/src/command.ts +44 -0
- package/packages/cli/src/commands/app.ts +25 -0
- package/packages/cli/src/commands/beats.ts +36 -0
- package/packages/cli/src/commands/blender.ts +270 -0
- package/packages/cli/src/commands/check.ts +25 -0
- package/packages/cli/src/commands/doctor.ts +22 -0
- package/packages/cli/src/commands/gen.ts +173 -0
- package/packages/cli/src/commands/look.ts +39 -0
- package/packages/cli/src/commands/lyrics.ts +111 -0
- package/packages/cli/src/commands/make.ts +542 -0
- package/packages/cli/src/commands/new.ts +176 -0
- package/packages/cli/src/commands/preview.ts +43 -0
- package/packages/cli/src/commands/render.ts +216 -0
- package/packages/cli/src/commands/setup.ts +63 -0
- package/packages/cli/src/commands/sheet.ts +114 -0
- package/packages/cli/src/commands/skill.ts +43 -0
- package/packages/cli/src/commands/still.ts +40 -0
- package/packages/cli/src/commands/theme.ts +85 -0
- package/packages/cli/src/commands/transitions.ts +40 -0
- package/packages/cli/src/deps.ts +122 -0
- package/packages/cli/src/ffmpeg.ts +81 -0
- package/packages/cli/src/index.ts +8 -0
- package/packages/cli/src/kf.ts +53 -0
- package/packages/cli/src/lock.ts +72 -0
- package/packages/cli/src/out.ts +13 -0
- package/packages/cli/src/serve.ts +124 -0
- package/packages/clock/package.json +14 -0
- package/packages/clock/src/index.ts +25 -0
- package/packages/clock/src/install.ts +351 -0
- package/packages/clock/src/types.ts +45 -0
- package/packages/core/package.json +9 -0
- package/packages/core/src/beats.ts +283 -0
- package/packages/core/src/ease.ts +87 -0
- package/packages/core/src/frame.ts +99 -0
- package/packages/core/src/index.ts +27 -0
- package/packages/core/src/project.ts +146 -0
- package/packages/core/src/rand.ts +56 -0
- package/packages/core/src/spring.ts +52 -0
- package/packages/core/src/style.ts +100 -0
- package/packages/core/src/time.ts +88 -0
- package/packages/gen/PROVIDERS.md +55 -0
- package/packages/gen/package.json +9 -0
- package/packages/gen/src/generate.ts +204 -0
- package/packages/gen/src/image/og.ts +133 -0
- package/packages/gen/src/index.ts +18 -0
- package/packages/gen/src/keys.ts +60 -0
- package/packages/gen/src/media.ts +150 -0
- package/packages/gen/src/plan.ts +106 -0
- package/packages/gen/src/registry.ts +51 -0
- package/packages/gen/src/seam.ts +103 -0
- package/packages/gen/src/types.ts +86 -0
- package/packages/gen/src/video/fal.ts +140 -0
- package/packages/gen/src/video/h3.ts +107 -0
- package/packages/gen/src/video/http.ts +44 -0
- package/packages/gen/src/video/ltx.ts +60 -0
- package/packages/gen/src/video/minimax.ts +55 -0
- package/packages/gen/src/video/veo.ts +71 -0
- package/packages/jizura/package.json +16 -0
- package/packages/jizura/src/deny.ts +73 -0
- package/packages/jizura/src/index.ts +7 -0
- package/packages/jizura/src/install.ts +226 -0
- package/packages/jizura/src/layer.ts +282 -0
- package/packages/jizura/src/lyrics.ts +81 -0
- package/packages/jizura/src/pin.ts +5 -0
- package/packages/jizura/src/vite.ts +36 -0
- package/packages/motion/README.md +142 -0
- package/packages/motion/package.json +29 -0
- package/packages/motion/src/camera.ts +97 -0
- package/packages/motion/src/captions.ts +479 -0
- package/packages/motion/src/enter.ts +128 -0
- package/packages/motion/src/hangul.ts +129 -0
- package/packages/motion/src/impact.ts +100 -0
- package/packages/motion/src/index.ts +17 -0
- package/packages/motion/src/moves/brushWipe.ts +90 -0
- package/packages/motion/src/moves/cloneArray.ts +111 -0
- package/packages/motion/src/moves/curtains.ts +81 -0
- package/packages/motion/src/moves/echoStack.ts +70 -0
- package/packages/motion/src/moves/fit.ts +34 -0
- package/packages/motion/src/moves/flood.ts +61 -0
- package/packages/motion/src/moves/ghostStack.ts +79 -0
- package/packages/motion/src/moves/gridFloor.ts +100 -0
- package/packages/motion/src/moves/imageSwarm.ts +109 -0
- package/packages/motion/src/moves/index.ts +19 -0
- package/packages/motion/src/moves/irisBlades.ts +113 -0
- package/packages/motion/src/moves/karaokeLine.ts +94 -0
- package/packages/motion/src/moves/ledBoard.ts +94 -0
- package/packages/motion/src/moves/liquidTab.ts +72 -0
- package/packages/motion/src/moves/markerWrite.ts +63 -0
- package/packages/motion/src/moves/morphBox.ts +96 -0
- package/packages/motion/src/moves/neonSign.ts +77 -0
- package/packages/motion/src/moves/panelPop.ts +78 -0
- package/packages/motion/src/moves/paperTear.ts +75 -0
- package/packages/motion/src/moves/path.ts +64 -0
- package/packages/motion/src/moves/pathText.ts +107 -0
- package/packages/motion/src/moves/pointSphere.ts +109 -0
- package/packages/motion/src/moves/ransomLetters.ts +73 -0
- package/packages/motion/src/moves/shapeMorph.ts +143 -0
- package/packages/motion/src/moves/slamWords.ts +89 -0
- package/packages/motion/src/moves/sparkTrail.ts +114 -0
- package/packages/motion/src/moves/speedLines.ts +91 -0
- package/packages/motion/src/moves/splitFlap.ts +147 -0
- package/packages/motion/src/moves/stepWords.ts +117 -0
- package/packages/motion/src/moves/strikeOut.ts +98 -0
- package/packages/motion/src/moves/sunburst.ts +58 -0
- package/packages/motion/src/moves/tickerRows.ts +87 -0
- package/packages/motion/src/moves/tokenPicker.ts +114 -0
- package/packages/motion/src/moves/truchet.ts +85 -0
- package/packages/motion/src/moves/wordWall.ts +76 -0
- package/packages/motion/src/moves/worldRoll.ts +31 -0
- package/packages/motion/src/particles.ts +102 -0
- package/packages/motion/src/react/index.tsx +21 -0
- package/packages/motion/src/react/parts.tsx +431 -0
- package/packages/motion/src/react/time.tsx +97 -0
- package/packages/motion/src/text.ts +103 -0
- package/packages/motion/src/transition.ts +82 -0
- package/packages/motion/src/transition3d/cards.ts +65 -0
- package/packages/motion/src/transition3d/chain.ts +84 -0
- package/packages/motion/src/transition3d/dive.ts +181 -0
- package/packages/motion/src/transition3d/fold.ts +110 -0
- package/packages/motion/src/transition3d/gl.ts +219 -0
- package/packages/motion/src/transition3d/index.ts +228 -0
- package/packages/motion/src/transition3d/live.ts +70 -0
- package/packages/motion/src/transition3d/portal.ts +115 -0
- package/packages/motion/src/transition3d/react.tsx +29 -0
- package/packages/motion/src/transition3d/rig.ts +502 -0
- package/packages/motion/src/transition3d/shatter.ts +101 -0
- package/packages/motion/src/transition3d/whip.ts +65 -0
- package/packages/motion/src/transition3d/world.ts +683 -0
- package/packages/motion/src/transition3d/zoomOut.ts +114 -0
- package/packages/motion/src/transitions2d/catalog.ts +127 -0
- package/packages/motion/src/transitions2d/css.d.ts +2 -0
- package/packages/motion/src/transitions2d/cult-ui/LICENSE.md +9 -0
- package/packages/motion/src/transitions2d/cult-ui/RollingNumber.tsx +43 -0
- package/packages/motion/src/transitions2d/gl-transitions/LICENSE +25 -0
- package/packages/motion/src/transitions2d/gl-transitions/shaders.ts +1931 -0
- package/packages/motion/src/transitions2d/index.ts +2 -0
- package/packages/motion/src/transitions2d/kokonutui/LICENSE +21 -0
- package/packages/motion/src/transitions2d/kokonutui/MatrixText.css +16 -0
- package/packages/motion/src/transitions2d/kokonutui/MatrixText.tsx +94 -0
- package/packages/motion/src/transitions2d/magicui/HyperText.css +15 -0
- package/packages/motion/src/transitions2d/magicui/HyperText.tsx +115 -0
- package/packages/motion/src/transitions2d/magicui/LICENSE.md +21 -0
- package/packages/motion/src/transitions2d/magicui/MorphingText.css +25 -0
- package/packages/motion/src/transitions2d/magicui/MorphingText.tsx +130 -0
- package/packages/motion/src/transitions2d/magicui/WordRotate.tsx +42 -0
- package/packages/motion/src/transitions2d/react.ts +13 -0
- package/packages/motion/src/transitions2d/skiper-ui/ClipDiv.css +39 -0
- package/packages/motion/src/transitions2d/skiper-ui/ClipDiv.tsx +32 -0
- package/packages/motion/src/transitions2d/smoothui/LICENSE +21 -0
- package/packages/motion/src/transitions2d/smoothui/SharedAxisY.tsx +50 -0
- package/packages/motion/src/transitions2d/smoothui/TextMorph.tsx +90 -0
- package/packages/motion/src/transitions2d/smoothui/shaders.ts +223 -0
- package/packages/motion/src/transitions2d/unlumen/LICENSE +21 -0
- package/packages/motion/src/transitions2d/unlumen/ScrambleText.tsx +114 -0
- package/packages/motion/src/transitions2d/vengeance-ui/LICENSE +21 -0
- package/packages/motion/src/transitions2d/vengeance-ui/MorphText.css +69 -0
- package/packages/motion/src/transitions2d/vengeance-ui/MorphText.tsx +45 -0
- package/packages/motion/src/type.ts +131 -0
- package/packages/motion/src/ui.ts +172 -0
- package/packages/plan/package.json +15 -0
- package/packages/plan/src/brief.ts +254 -0
- package/packages/plan/src/captions.ts +75 -0
- package/packages/plan/src/detect.ts +93 -0
- package/packages/plan/src/index.ts +23 -0
- package/packages/plan/src/layout.ts +176 -0
- package/packages/plan/src/llm.ts +110 -0
- package/packages/plan/src/look.ts +220 -0
- package/packages/plan/src/plan.ts +125 -0
- package/packages/plan/src/request.ts +55 -0
- package/packages/plan/src/studio.ts +53 -0
- package/packages/plan/src/templates.ts +42 -0
- package/packages/plan/src/themes.ts +48 -0
- package/packages/plan/src/types.ts +106 -0
- package/packages/studio/package.json +12 -0
- package/packages/studio/src/index.ts +1 -0
- package/packages/studio/src/plugin.ts +236 -0
- package/packages/studio/src/ui/main.ts +503 -0
- package/packages/studio/src/ui/studio.css +165 -0
- package/packages/studio/src/ui/timeline.ts +317 -0
- package/packages/themes/kit/THEME-MAKE.md +68 -0
- package/packages/themes/kit/THEME.md +30 -0
- package/packages/themes/kit/briefs/og-intro-15s/brief.json +16 -0
- package/packages/themes/kit/briefs/og-intro-15s/facts.ts +29 -0
- package/packages/themes/kit/briefs/og-intro-15s/logo.svg +12 -0
- package/packages/themes/kit/effects.ts +5 -0
- package/packages/themes/kit/sample/index.html +11 -0
- package/packages/themes/kit/sample/main.ts +9 -0
- package/packages/themes/kit/sample/scenes/scene.ts +15 -0
- package/packages/themes/package.json +16 -0
- package/packages/themes/src/factory.ts +296 -0
- package/packages/themes/src/fx.ts +14 -0
- package/packages/themes/src/index.ts +105 -0
- package/packages/themes/src/stage3d.ts +177 -0
- package/packages/themes/src/types.ts +58 -0
- package/presets/kawaii-pastel.json +94 -0
- package/presets/neutral-dark.json +82 -0
- package/presets/og.json +98 -0
- package/skills/kasaframe/SKILL.md +32 -0
- package/templates/_shared/project/index.html +11 -0
- package/templates/_shared/project/lib/react.ts +22 -0
- package/templates/_shared/project/lib/stage.ts +272 -0
- package/templates/_shared/project/main.ts +9 -0
- package/templates/_shared/scenes/default.ts +18 -0
- package/templates/_shared/scenes/drop.ts +30 -0
- package/templates/_shared/scenes/end.ts +23 -0
- package/templates/_shared/scenes/hook.ts +16 -0
- package/templates/_shared/scenes/seam.ts +41 -0
- package/templates/_shared/scenes/step.ts +40 -0
- package/templates/ad/preview.png +0 -0
- package/templates/ad/template.json +132 -0
- package/templates/demo/preview.png +0 -0
- package/templates/demo/template.json +130 -0
- package/templates/explainer/preview.png +0 -0
- package/templates/explainer/template.json +142 -0
- package/templates/launch/preview.png +0 -0
- package/templates/launch/template.json +130 -0
- package/templates/mv/preview.png +0 -0
- package/templates/mv/scenes/default.ts +95 -0
- package/templates/mv/template.json +176 -0
- package/templates/promo/preview.png +0 -0
- package/templates/promo/template.json +144 -0
- package/templates/shorts/preview.png +0 -0
- package/templates/shorts/scenes/hook.ts +34 -0
- package/templates/shorts/template.json +127 -0
- package/templates/square/preview.png +0 -0
- package/templates/square/template.json +113 -0
- package/themes/debug-hud/THEME.md +39 -0
- package/themes/debug-hud/effects.ts +389 -0
- package/themes/debug-hud/sample/assets/og/logo.svg +12 -0
- package/themes/debug-hud/sample/beats.json +1 -0
- package/themes/debug-hud/sample/index.html +11 -0
- package/themes/debug-hud/sample/kf.json +59 -0
- package/themes/debug-hud/sample/lib/hudkit.ts +49 -0
- package/themes/debug-hud/sample/lib/og.ts +29 -0
- package/themes/debug-hud/sample/main.ts +9 -0
- package/themes/debug-hud/sample/scenes/end.ts +62 -0
- package/themes/debug-hud/sample/scenes/gather.ts +67 -0
- package/themes/debug-hud/sample/scenes/models.ts +70 -0
- package/themes/debug-hud/sample/scenes/price.ts +79 -0
- package/themes/debug-hud/sample/style.json +91 -0
- package/themes/debug-hud/still.png +0 -0
- package/themes/debug-hud/style.json +91 -0
- package/themes/debug-hud/theme.json +68 -0
- package/themes/og-measure/THEME.md +47 -0
- package/themes/og-measure/effects.ts +432 -0
- package/themes/og-measure/sample/assets/brand/og-logo-full.svg +12 -0
- package/themes/og-measure/sample/assets/brand/og-logo.svg +12 -0
- package/themes/og-measure/sample/assets/data/measure.json +353 -0
- package/themes/og-measure/sample/beats.json +1 -0
- package/themes/og-measure/sample/index.html +11 -0
- package/themes/og-measure/sample/kf.json +66 -0
- package/themes/og-measure/sample/lib/data.ts +62 -0
- package/themes/og-measure/sample/main.ts +9 -0
- package/themes/og-measure/sample/measure.ts +78 -0
- package/themes/og-measure/sample/scenes/end.ts +47 -0
- package/themes/og-measure/sample/scenes/gather.ts +51 -0
- package/themes/og-measure/sample/scenes/models.ts +34 -0
- package/themes/og-measure/sample/scenes/one.ts +39 -0
- package/themes/og-measure/sample/scenes/price.ts +56 -0
- package/themes/og-measure/sample/style.json +97 -0
- package/themes/og-measure/still.png +0 -0
- package/themes/og-measure/style.json +97 -0
- package/themes/og-measure/theme.json +79 -0
- package/themes/riso-zine/THEME.md +43 -0
- package/themes/riso-zine/effects.ts +321 -0
- package/themes/riso-zine/sample/assets/og/logo.svg +12 -0
- package/themes/riso-zine/sample/beats.json +1 -0
- package/themes/riso-zine/sample/index.html +11 -0
- package/themes/riso-zine/sample/kf.json +59 -0
- package/themes/riso-zine/sample/lib/og.ts +29 -0
- package/themes/riso-zine/sample/lib/shot.ts +86 -0
- package/themes/riso-zine/sample/lib/zine.ts +42 -0
- package/themes/riso-zine/sample/main.ts +9 -0
- package/themes/riso-zine/sample/scenes/end.ts +61 -0
- package/themes/riso-zine/sample/scenes/gather.ts +62 -0
- package/themes/riso-zine/sample/scenes/models.ts +52 -0
- package/themes/riso-zine/sample/scenes/price.ts +82 -0
- package/themes/riso-zine/sample/style.json +99 -0
- package/themes/riso-zine/still.png +0 -0
- package/themes/riso-zine/style.json +99 -0
- package/themes/riso-zine/theme.json +75 -0
- package/tools/beats/beats.py +372 -0
- package/tools/beats/requirements.txt +3 -0
- package/tools/lyrics/align.py +164 -0
- package/tools/lyrics/requirements.txt +9 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "shorts",
|
|
3
|
+
"label": "쇼츠",
|
|
4
|
+
"summary": "세로 쇼츠 — 첫 1.5초에 결과, 화면 글은 전문 낱말만, 말은 자막 트랙으로, 끝이 처음으로 이어진다",
|
|
5
|
+
"aspect": "9:16",
|
|
6
|
+
"width": 1080,
|
|
7
|
+
"height": 1920,
|
|
8
|
+
"fps": 60,
|
|
9
|
+
"duration": {
|
|
10
|
+
"min": 15,
|
|
11
|
+
"max": 60,
|
|
12
|
+
"default": 45
|
|
13
|
+
},
|
|
14
|
+
"music": "optional",
|
|
15
|
+
"captions": "off",
|
|
16
|
+
"loop": true,
|
|
17
|
+
"style": "og",
|
|
18
|
+
"safeArea": {
|
|
19
|
+
"top": 230,
|
|
20
|
+
"bottom": 460,
|
|
21
|
+
"left": 40,
|
|
22
|
+
"right": 40
|
|
23
|
+
},
|
|
24
|
+
"text": {
|
|
25
|
+
"policy": "terms-only",
|
|
26
|
+
"maxOnScreen": 3,
|
|
27
|
+
"minPx": 48
|
|
28
|
+
},
|
|
29
|
+
"motion": {
|
|
30
|
+
"beatPulse": "off",
|
|
31
|
+
"shake": {
|
|
32
|
+
"on": [],
|
|
33
|
+
"maxPerPhrase": 0,
|
|
34
|
+
"maxPx": 0
|
|
35
|
+
},
|
|
36
|
+
"cameraMove": "once-per-phrase",
|
|
37
|
+
"repeatSameMove": false,
|
|
38
|
+
"maxFreezeSec": 0.1,
|
|
39
|
+
"staticSec": {
|
|
40
|
+
"warn": 1.5,
|
|
41
|
+
"error": 3
|
|
42
|
+
},
|
|
43
|
+
"beatMove": "every-beat"
|
|
44
|
+
},
|
|
45
|
+
"scenes": [
|
|
46
|
+
{
|
|
47
|
+
"id": "hook",
|
|
48
|
+
"role": "hook",
|
|
49
|
+
"sec": 1.5,
|
|
50
|
+
"anchor": "start",
|
|
51
|
+
"idea": "결과 먼저 — 가장 센 숫자나 그림 하나가 첫 프레임부터 화면에 있다"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "setup",
|
|
55
|
+
"role": "setup",
|
|
56
|
+
"weight": 2,
|
|
57
|
+
"snap": "beat",
|
|
58
|
+
"idea": "조건 하나로 문제를 재현한다 — 보는 사람이 예상하는 쪽을 먼저 보여 준다"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "explain",
|
|
62
|
+
"role": "explain",
|
|
63
|
+
"weight": 4,
|
|
64
|
+
"snap": "beat",
|
|
65
|
+
"idea": "원리 — 큰 대상 하나를 끝까지 변신시킨다. 장면을 자르지 말고, 드러낼 때 다가가고 비교할 때 물러난다(stage.camera — 이유 없는 이동은 안 된다). 화면 글은 전문 낱말·숫자만"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "reveal",
|
|
69
|
+
"role": "reveal",
|
|
70
|
+
"weight": 2,
|
|
71
|
+
"snap": "beat",
|
|
72
|
+
"idea": "이름 공개 — 지금까지 본 것의 이름과 숫자 하나"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "limit",
|
|
76
|
+
"role": "limit",
|
|
77
|
+
"weight": 1,
|
|
78
|
+
"snap": "beat",
|
|
79
|
+
"idea": "남는 한계 한 가지 — 숫자나 낱말 하나로"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": "end",
|
|
83
|
+
"role": "end",
|
|
84
|
+
"sec": 2,
|
|
85
|
+
"anchor": "end",
|
|
86
|
+
"idea": "로고 — 되돌이 — 마지막으로 찍히는 프레임(lib/stage.ts 의 lastT = dur - 1/fps)에서 hook 첫 화면과 똑같아지게 움직임을 끝낸다"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"assets": {
|
|
90
|
+
"need": [],
|
|
91
|
+
"want": [
|
|
92
|
+
"logo",
|
|
93
|
+
"data"
|
|
94
|
+
],
|
|
95
|
+
"gen": [
|
|
96
|
+
"img:hook-bg"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"deliverables": [
|
|
100
|
+
"mp4",
|
|
101
|
+
"cover",
|
|
102
|
+
"srt",
|
|
103
|
+
"vtt"
|
|
104
|
+
],
|
|
105
|
+
"detect": {
|
|
106
|
+
"words": [
|
|
107
|
+
"쇼츠",
|
|
108
|
+
"숏츠",
|
|
109
|
+
"숏폼",
|
|
110
|
+
"릴스",
|
|
111
|
+
"틱톡",
|
|
112
|
+
"세로 영상",
|
|
113
|
+
"shorts",
|
|
114
|
+
"short-form",
|
|
115
|
+
"reels",
|
|
116
|
+
"tiktok"
|
|
117
|
+
],
|
|
118
|
+
"hints": [
|
|
119
|
+
"세로",
|
|
120
|
+
"9:16",
|
|
121
|
+
"vertical",
|
|
122
|
+
"45초",
|
|
123
|
+
"30초"
|
|
124
|
+
],
|
|
125
|
+
"aspect": "9:16"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "square",
|
|
3
|
+
"label": "피드",
|
|
4
|
+
"summary": "정사각 피드 — 소리 없이도 읽히게 글을 굽는다",
|
|
5
|
+
"aspect": "1:1",
|
|
6
|
+
"width": 1080,
|
|
7
|
+
"height": 1080,
|
|
8
|
+
"fps": 60,
|
|
9
|
+
"duration": {
|
|
10
|
+
"min": 15,
|
|
11
|
+
"max": 60,
|
|
12
|
+
"default": 30
|
|
13
|
+
},
|
|
14
|
+
"music": "optional",
|
|
15
|
+
"captions": "on",
|
|
16
|
+
"loop": true,
|
|
17
|
+
"style": "kawaii-pastel",
|
|
18
|
+
"safeArea": {
|
|
19
|
+
"top": 60,
|
|
20
|
+
"bottom": 60,
|
|
21
|
+
"left": 60,
|
|
22
|
+
"right": 60
|
|
23
|
+
},
|
|
24
|
+
"text": {
|
|
25
|
+
"policy": "captions",
|
|
26
|
+
"maxOnScreen": 8,
|
|
27
|
+
"minPx": 44
|
|
28
|
+
},
|
|
29
|
+
"motion": {
|
|
30
|
+
"beatPulse": "off",
|
|
31
|
+
"shake": {
|
|
32
|
+
"on": [],
|
|
33
|
+
"maxPerPhrase": 0,
|
|
34
|
+
"maxPx": 0
|
|
35
|
+
},
|
|
36
|
+
"cameraMove": "once-per-phrase",
|
|
37
|
+
"repeatSameMove": false,
|
|
38
|
+
"maxFreezeSec": 0.1,
|
|
39
|
+
"staticSec": {
|
|
40
|
+
"warn": 1.5,
|
|
41
|
+
"error": 3
|
|
42
|
+
},
|
|
43
|
+
"beatMove": "every-beat"
|
|
44
|
+
},
|
|
45
|
+
"scenes": [
|
|
46
|
+
{
|
|
47
|
+
"id": "hook",
|
|
48
|
+
"role": "hook",
|
|
49
|
+
"sec": 2,
|
|
50
|
+
"anchor": "start",
|
|
51
|
+
"idea": "첫 프레임에 무엇에 관한 영상인지 글 한 줄로 — 소리 없이도 읽힌다"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "point1",
|
|
55
|
+
"role": "point",
|
|
56
|
+
"weight": 1,
|
|
57
|
+
"snap": "beat",
|
|
58
|
+
"idea": "요점 하나 — 굵은 글 한 줄 + 그림"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "point2",
|
|
62
|
+
"role": "point",
|
|
63
|
+
"weight": 1,
|
|
64
|
+
"snap": "beat",
|
|
65
|
+
"idea": "요점 둘 — point1 과 다른 움직임"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "point3",
|
|
69
|
+
"role": "point",
|
|
70
|
+
"weight": 1,
|
|
71
|
+
"snap": "beat",
|
|
72
|
+
"idea": "요점 셋"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "end",
|
|
76
|
+
"role": "end",
|
|
77
|
+
"sec": 2,
|
|
78
|
+
"anchor": "end",
|
|
79
|
+
"idea": "이름 — 되돌이 — 마지막으로 찍히는 프레임(lastT = dur - 1/fps)에서 hook 첫 화면과 똑같아지게"
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"assets": {
|
|
83
|
+
"need": [],
|
|
84
|
+
"want": [
|
|
85
|
+
"logo"
|
|
86
|
+
],
|
|
87
|
+
"gen": []
|
|
88
|
+
},
|
|
89
|
+
"deliverables": [
|
|
90
|
+
"mp4",
|
|
91
|
+
"cover"
|
|
92
|
+
],
|
|
93
|
+
"detect": {
|
|
94
|
+
"words": [
|
|
95
|
+
"피드",
|
|
96
|
+
"정사각",
|
|
97
|
+
"정사각형",
|
|
98
|
+
"인스타 피드",
|
|
99
|
+
"1:1",
|
|
100
|
+
"square",
|
|
101
|
+
"feed post"
|
|
102
|
+
],
|
|
103
|
+
"hints": [
|
|
104
|
+
"무음",
|
|
105
|
+
"소리 없이",
|
|
106
|
+
"자막 넣어",
|
|
107
|
+
"인스타",
|
|
108
|
+
"instagram",
|
|
109
|
+
"carousel"
|
|
110
|
+
],
|
|
111
|
+
"aspect": "1:1"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# 디버그 HUD `debug-hud`
|
|
2
|
+
|
|
3
|
+
**비유: 화면이 계측되며 드러난다.** 검정 위에 형광 한 색. 무엇이 나타나든 먼저 잰다 — 모서리 꺾쇠가 서고, 변이 뻗고, 이름과 크기가 찍힌다. 값은 그 프레임에 실제로 잰 숫자(시각·프레임·박·마디·대역 에너지)만 화면에 오르고, 선은 오실로스코프처럼 흐른다.
|
|
4
|
+
|
|
5
|
+
## 맞는 내용·용도
|
|
6
|
+
|
|
7
|
+
- 측정·분석·성능·로그·파이프라인 — 숫자와 신호가 주인공인 내용. 곡 분석, 빌드·렌더 진행, 모델 지표, 계측 장비, 개발 도구.
|
|
8
|
+
- 용도: 설명(explainer)·시연(demo)·홍보(promo)·쇼츠(shorts)·공개(launch). 드롭에 `dropTrigger`.
|
|
9
|
+
- 화면 글은 로그 줄·측정 이름·숫자. 전부 모노(한글은 모노 뒤 Pretendard).
|
|
10
|
+
|
|
11
|
+
## 금지
|
|
12
|
+
|
|
13
|
+
- 형광 라임(`ink`)과 그 어두운 단(`dim`·`line`) 말고 다른 색. 면 채우기는 드롭 섬광 한 번뿐.
|
|
14
|
+
- 지어낸 숫자 — 화면의 값은 그 순간 잰 것(시각·프레임·박)이나 확인된 사실(브리프·실측 데이터)만. 「99.9%」 같은 장식 숫자 금지.
|
|
15
|
+
- 그림자·흐림·그라데이션·둥근 모서리. 선은 1–3px.
|
|
16
|
+
- 슬로건·감성 문장.
|
|
17
|
+
|
|
18
|
+
## 움직임
|
|
19
|
+
|
|
20
|
+
- 쉬지 않는다: `hudFrame` 의 계측판 눈금과 `plotTrace` 선이 늘 흐르고, 과녁(`crosshair`)이 박마다 다음 값으로 뛴다.
|
|
21
|
+
- 구도는 마디마다 바꾼다 — 컷마다 재는 대상이 다르다(흩어진 상자 · 막대 상자 · 주소 · 요청 로그 · 큰 숫자 · 가격선 · 로고), 들어올 때마다 `wireBox` 가 상자를 새로 잰다.
|
|
22
|
+
- 움직임은 「잡고 멈춘다」(outExpo 0.18초) 한 손으로.
|
|
23
|
+
|
|
24
|
+
## 효과
|
|
25
|
+
|
|
26
|
+
같은 레포 안에서는 `effects.ts` 를 바로, 프로젝트에서는 `fx("debug-hud")`. layer 는 `build` 에서 만들고 `(t) => …` 에서 부른다. 캔버스는 그리는 자리만큼만 잡으므로 한 장면에 배치를 여럿 겹쳐 둬도 가볍다.
|
|
27
|
+
|
|
28
|
+
| 효과 | 꼴 | 하는 일 |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| `readout` | value | 고정 폭 숫자(앞을 0 으로), 굴러도 폭이 안 흔들린다. NaN 은 「--」 |
|
|
31
|
+
| `wireBox` | layer | 와이어 상자 — 꺾쇠 → 변 → 이름, `dims` 면 크기 표 |
|
|
32
|
+
| `scanLine` | layer | 스캔선. 돌려준 clip 을 내용 틀에 — `reveal` 드러내기 · `hide` 지우기 |
|
|
33
|
+
| `logTail` | layer | 로그 꼬리. 줄마다 시각을 주면 빠르게 찍히고 한 줄씩 밀린다 |
|
|
34
|
+
| `plotTrace` | layer | 오실로스코프 — 지난 `window` 초, 박 눈금·DROP 표시가 같이 흐른다 |
|
|
35
|
+
| `crosshair` | layer | 조준선 — 키마다 잡고 멈추듯 뛴다, `coords` 좌표 표 |
|
|
36
|
+
| `hudFrame` | layer | 안전 영역 꺾쇠 + 곡 시각·프레임·마디·구간. `grid` 면 계측판 눈금이 늘 흐른다 |
|
|
37
|
+
| `dropTrigger` | layer | 드롭 — 형광으로 뒤집힌 두 프레임 + 가로 띠, 흔들림을 돌려준다 |
|
|
38
|
+
|
|
39
|
+
견본: `sample/` — 공통 주제 「OpenGateway 소개 15초」, kawaii-friends 4.0–19.0초(드롭 7.34초), 장면 넷 × 마디마다 컷. 숫자는 전부 브리프의 OG 사실(모델 102·회사별 수·주소·가격·실측 ms)이고 굴러가는 중간값만 지나가는 값이다.
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { clamp, ease, type SceneCtx, type Style } from "@kasaframe/core";
|
|
2
|
+
import { dropBurst, type DropBurstState } from "@kasaframe/motion";
|
|
3
|
+
|
|
4
|
+
const ink = (ctx: SceneCtx, key: string | undefined, fallback = "ink"): string => ctx.style.colors[key ?? fallback] ?? key ?? fallback;
|
|
5
|
+
const mono = (ctx: SceneCtx, px: number, weight = ctx.style.type.weightBody): string => `${weight} ${px}px ${ctx.style.fonts.mono}`;
|
|
6
|
+
|
|
7
|
+
type Rect = [x: number, y: number, w: number, h: number];
|
|
8
|
+
const areas = new WeakMap<CanvasRenderingContext2D, Rect>();
|
|
9
|
+
|
|
10
|
+
// 계기판은 한 장면에 배치를 여럿 겹쳐 둔다 — 효과마다 화면 전체 캔버스를 잡으면 탭 셋이 기가바이트를 먹는다. 그리는 자리만큼만 잡고 좌표는 화면 기준 그대로 쓴다
|
|
11
|
+
function canvas(el: HTMLElement, ctx: SceneCtx, area?: Rect): CanvasRenderingContext2D {
|
|
12
|
+
const [x, y, w, h] = (area ?? [0, 0, ctx.meta.width, ctx.meta.height]).map(Math.round) as Rect;
|
|
13
|
+
const c = document.createElement("canvas");
|
|
14
|
+
c.width = Math.max(1, w);
|
|
15
|
+
c.height = Math.max(1, h);
|
|
16
|
+
c.style.cssText = `position:absolute;left:${x}px;top:${y}px;width:${w}px;height:${h}px;pointer-events:none;`;
|
|
17
|
+
el.append(c);
|
|
18
|
+
const g = c.getContext("2d")!;
|
|
19
|
+
g.translate(-x, -y);
|
|
20
|
+
areas.set(g, [x, y, w, h]);
|
|
21
|
+
return g;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const clear = (g: CanvasRenderingContext2D): void => {
|
|
25
|
+
const [x, y, w, h] = areas.get(g)!;
|
|
26
|
+
g.clearRect(x, y, w, h);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// 계측 화면은 미끄러지지 않고 「잡고 멈춘다」 — 빠른 outExpo 한 가지로 통일해 모든 효과가 같은 손으로 움직인다
|
|
30
|
+
const SNAP = 0.18;
|
|
31
|
+
const snap = (t: number, at: number, dur = SNAP): number => ease.outExpo(clamp((t - at) / dur));
|
|
32
|
+
|
|
33
|
+
/** 고정 폭 숫자. 지정한 칸 수를 늘 지키고(앞을 0 으로) NaN·Infinity 는 「--」로 — 굴러도 글 폭이 안 흔들린다 */
|
|
34
|
+
export function readout(t: number, o: { to: number; from?: number; at?: number; dur?: number; width?: number; decimals?: number; unit?: string; sign?: boolean }): string {
|
|
35
|
+
const dur = o.dur ?? 0;
|
|
36
|
+
const p = dur > 0 ? clamp((t - (o.at ?? 0)) / dur) : t >= (o.at ?? 0) ? 1 : 0;
|
|
37
|
+
const v = (o.from ?? o.to) + (o.to - (o.from ?? o.to)) * p;
|
|
38
|
+
const dec = o.decimals ?? 0;
|
|
39
|
+
const width = o.width ?? 0;
|
|
40
|
+
const unit = o.unit ? ` ${o.unit}` : "";
|
|
41
|
+
if (!Number.isFinite(v)) return `${"-".repeat(Math.max(2, width))}${unit}`;
|
|
42
|
+
const abs = Math.abs(v).toFixed(dec);
|
|
43
|
+
const [i, f] = abs.split(".");
|
|
44
|
+
const body = (f === undefined ? i.padStart(width, "0") : `${i.padStart(Math.max(1, width - dec - 1), "0")}.${f}`).slice(-Math.max(width, abs.length));
|
|
45
|
+
const sign = v < 0 ? "-" : o.sign ? "+" : "";
|
|
46
|
+
return `${sign}${body}${unit}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface Box {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
w: number;
|
|
53
|
+
h: number;
|
|
54
|
+
at: number;
|
|
55
|
+
label?: string;
|
|
56
|
+
/** 오른쪽 아래에 「w×h」를 단다 */
|
|
57
|
+
dims?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** 와이어 상자 — 모서리 꺾쇠가 먼저 서고 변이 가운데로 뻗은 뒤 이름이 찍힌다 */
|
|
61
|
+
export function wireBox(el: HTMLElement, o: { ctx: SceneCtx; boxes: Box[]; dur?: number; until?: number }): (t: number) => void {
|
|
62
|
+
const { ctx } = o;
|
|
63
|
+
const x0 = Math.min(...o.boxes.map((b) => b.x)) - 8;
|
|
64
|
+
const y0 = Math.min(...o.boxes.map((b) => b.y)) - 48;
|
|
65
|
+
const x1 = Math.max(...o.boxes.map((b) => b.x + Math.max(b.w, 520))) + 8;
|
|
66
|
+
const y1 = Math.max(...o.boxes.map((b) => b.y + b.h)) + 44;
|
|
67
|
+
const g = canvas(el, ctx, [x0, y0, x1 - x0, y1 - y0]);
|
|
68
|
+
const dur = o.dur ?? 0.36;
|
|
69
|
+
const line = ink(ctx, "ink");
|
|
70
|
+
const dim = ink(ctx, "dim");
|
|
71
|
+
return (t) => {
|
|
72
|
+
clear(g);
|
|
73
|
+
if (o.until !== undefined && t >= o.until) return;
|
|
74
|
+
g.lineWidth = 2;
|
|
75
|
+
g.textBaseline = "bottom";
|
|
76
|
+
for (const b of o.boxes) {
|
|
77
|
+
if (t < b.at) continue;
|
|
78
|
+
const pc = snap(t, b.at, dur * 0.4);
|
|
79
|
+
const pe = snap(t, b.at + dur * 0.3, dur * 0.7);
|
|
80
|
+
const arm = Math.min(28, b.w / 2, b.h / 2) * pc;
|
|
81
|
+
const ex = (b.w / 2 - arm) * pe;
|
|
82
|
+
const ey = (b.h / 2 - arm) * pe;
|
|
83
|
+
g.strokeStyle = line;
|
|
84
|
+
g.beginPath();
|
|
85
|
+
for (const [cx, cy, sx, sy] of [
|
|
86
|
+
[b.x, b.y, 1, 1],
|
|
87
|
+
[b.x + b.w, b.y, -1, 1],
|
|
88
|
+
[b.x, b.y + b.h, 1, -1],
|
|
89
|
+
[b.x + b.w, b.y + b.h, -1, -1],
|
|
90
|
+
] as const) {
|
|
91
|
+
g.moveTo(cx + sx * (arm + ex), cy);
|
|
92
|
+
g.lineTo(cx, cy);
|
|
93
|
+
g.lineTo(cx, cy + sy * (arm + ey));
|
|
94
|
+
}
|
|
95
|
+
g.stroke();
|
|
96
|
+
if (b.label && t >= b.at + dur * 0.5) {
|
|
97
|
+
const n = Math.ceil(Array.from(b.label).length * clamp((t - b.at - dur * 0.5) / 0.2));
|
|
98
|
+
g.font = mono(ctx, 26, 600);
|
|
99
|
+
g.fillStyle = line;
|
|
100
|
+
g.fillText(Array.from(b.label).slice(0, n).join(""), b.x, b.y - 8);
|
|
101
|
+
}
|
|
102
|
+
if (b.dims && pe > 0.98) {
|
|
103
|
+
g.font = mono(ctx, 22);
|
|
104
|
+
g.fillStyle = dim;
|
|
105
|
+
g.textAlign = "right";
|
|
106
|
+
g.textBaseline = "top";
|
|
107
|
+
g.fillText(`${Math.round(b.w)}×${Math.round(b.h)}`, b.x + b.w, b.y + b.h + 8);
|
|
108
|
+
g.textAlign = "left";
|
|
109
|
+
g.textBaseline = "bottom";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** 스캔선 — 지나간 자리만 보이게(reveal) 또는 지나간 자리를 지우게(hide) 하는 clip 을 돌려주고 선과 잔상 줄 셋을 그린다 */
|
|
116
|
+
export function scanLine(el: HTMLElement, o: { ctx: SceneCtx; at: number; dur?: number; dir?: "down" | "up"; mode?: "reveal" | "hide" }): (t: number) => Style {
|
|
117
|
+
const { ctx } = o;
|
|
118
|
+
const g = canvas(el, ctx);
|
|
119
|
+
const H = ctx.meta.height;
|
|
120
|
+
const dur = o.dur ?? 0.5;
|
|
121
|
+
const color = ink(ctx, "ink");
|
|
122
|
+
return (t) => {
|
|
123
|
+
clear(g);
|
|
124
|
+
const p = ease.inOutCubic(clamp((t - o.at) / dur));
|
|
125
|
+
const y = o.dir === "up" ? H * (1 - p) : H * p;
|
|
126
|
+
if (p > 0 && p < 1) {
|
|
127
|
+
g.fillStyle = color;
|
|
128
|
+
for (let i = 0; i < 4; i++) {
|
|
129
|
+
g.globalAlpha = [1, 0.4, 0.2, 0.08][i];
|
|
130
|
+
g.fillRect(0, y + (o.dir === "up" ? 1 : -1) * i * 6 - 1, ctx.meta.width, i === 0 ? 3 : 2);
|
|
131
|
+
}
|
|
132
|
+
g.globalAlpha = 1;
|
|
133
|
+
}
|
|
134
|
+
if (o.mode === "hide") return o.dir === "up" ? { clip: { bottom: p } } : { clip: { top: p } };
|
|
135
|
+
if (p >= 1) return { clip: { top: 0, bottom: 0 } };
|
|
136
|
+
return o.dir === "up" ? { clip: { top: 1 - p } } : { clip: { bottom: 1 - p } };
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** 로그 꼬리(tail -f) — 줄은 정한 시각에 빠르게 찍히고, 칸이 차면 한 줄씩 끊어 위로 민다 */
|
|
141
|
+
export function logTail(el: HTMLElement, o: { ctx: SceneCtx; x: number; y: number; w: number; h: number; lines: { t: number; text: string; dim?: boolean }[]; size?: number; cps?: number }): (t: number) => void {
|
|
142
|
+
const { ctx } = o;
|
|
143
|
+
const g = canvas(el, ctx, [o.x, o.y, o.w, o.h]);
|
|
144
|
+
const size = o.size ?? 26;
|
|
145
|
+
const lh = Math.round(size * 1.5);
|
|
146
|
+
const rows = Math.max(1, Math.floor(o.h / lh));
|
|
147
|
+
const cps = o.cps ?? 140;
|
|
148
|
+
const lines = [...o.lines].sort((a, b) => a.t - b.t);
|
|
149
|
+
return (t) => {
|
|
150
|
+
clear(g);
|
|
151
|
+
const shown = lines.filter((l) => l.t <= t);
|
|
152
|
+
const tail = shown.slice(-rows);
|
|
153
|
+
g.save();
|
|
154
|
+
g.beginPath();
|
|
155
|
+
g.rect(o.x, o.y, o.w, o.h);
|
|
156
|
+
g.clip();
|
|
157
|
+
g.font = mono(ctx, size);
|
|
158
|
+
g.textBaseline = "top";
|
|
159
|
+
tail.forEach((l, i) => {
|
|
160
|
+
const chars = Array.from(l.text);
|
|
161
|
+
const n = Math.min(chars.length, Math.ceil((t - l.t) * cps));
|
|
162
|
+
g.fillStyle = ink(ctx, l.dim ? "dim" : "ink");
|
|
163
|
+
g.fillText(chars.slice(0, n).join(""), o.x, o.y + i * lh);
|
|
164
|
+
if (n < chars.length || l === tail.at(-1)) {
|
|
165
|
+
const cw = g.measureText(chars.slice(0, n).join("")).width;
|
|
166
|
+
if (n < chars.length || Math.floor((t - l.t) / 0.5) % 2 === 0) g.fillRect(o.x + cw + 4, o.y + i * lh + 2, size * 0.55, size);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
g.restore();
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface Series {
|
|
174
|
+
/** 장면 시각 → 0..1 */
|
|
175
|
+
value(t: number): number;
|
|
176
|
+
label: string;
|
|
177
|
+
/** 0 이 가장 밝다 — 한 색의 단으로만 가른다 */
|
|
178
|
+
tone?: 0 | 1 | 2;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** 오실로스코프 — 지난 window 초를 오른쪽 끝이 지금인 선으로. 박 눈금이 같이 흘러가고 드롭 자리에 표시가 선다 */
|
|
182
|
+
export function plotTrace(el: HTMLElement, o: { ctx: SceneCtx; x: number; y: number; w: number; h: number; series: Series[]; window?: number; at?: number; since?: number }): (t: number) => void {
|
|
183
|
+
const { ctx } = o;
|
|
184
|
+
const g = canvas(el, ctx, [o.x - 12, o.y - 12, o.w + 260, o.h + 24]);
|
|
185
|
+
const win = o.window ?? 4;
|
|
186
|
+
const N = 160;
|
|
187
|
+
const color = ink(ctx, "ink");
|
|
188
|
+
const dim = ink(ctx, "dim");
|
|
189
|
+
const faint = ink(ctx, "line");
|
|
190
|
+
const since = o.since ?? 0;
|
|
191
|
+
const xOf = (tt: number, t: number) => o.x + o.w * (1 - (t - tt) / win);
|
|
192
|
+
return (t) => {
|
|
193
|
+
clear(g);
|
|
194
|
+
if (t < (o.at ?? 0)) return;
|
|
195
|
+
const reveal = snap(t, o.at ?? 0, 0.3);
|
|
196
|
+
g.save();
|
|
197
|
+
g.beginPath();
|
|
198
|
+
g.rect(o.x, o.y - 4, o.w * reveal, o.h + 8);
|
|
199
|
+
g.clip();
|
|
200
|
+
const b = ctx.beats;
|
|
201
|
+
for (const bt of b.beats) {
|
|
202
|
+
if (bt < t - win || bt > t) continue;
|
|
203
|
+
const down = b.downbeats.some((d) => Math.abs(d - bt) < 1e-3);
|
|
204
|
+
g.fillStyle = down ? dim : faint;
|
|
205
|
+
g.fillRect(Math.round(xOf(bt, t)), o.y, down ? 2 : 1, o.h);
|
|
206
|
+
}
|
|
207
|
+
g.font = mono(ctx, 22, 600);
|
|
208
|
+
g.textBaseline = "top";
|
|
209
|
+
for (const d of b.drops) {
|
|
210
|
+
if (d < t - win || d > t) continue;
|
|
211
|
+
const x = xOf(d, t);
|
|
212
|
+
g.fillStyle = color;
|
|
213
|
+
g.fillRect(Math.round(x) - 1, o.y, 3, o.h);
|
|
214
|
+
g.fillText("DROP", x + 8, o.y + 6);
|
|
215
|
+
}
|
|
216
|
+
o.series.forEach((s, k) => {
|
|
217
|
+
g.strokeStyle = [color, dim, faint][s.tone ?? k] ?? color;
|
|
218
|
+
g.lineWidth = s.tone === 0 || (s.tone === undefined && k === 0) ? 3 : 2;
|
|
219
|
+
g.beginPath();
|
|
220
|
+
let started = false;
|
|
221
|
+
for (let i = 0; i <= N; i++) {
|
|
222
|
+
const tt = t - win + (win * i) / N;
|
|
223
|
+
if (tt < since) continue;
|
|
224
|
+
const v = clamp(s.value(tt));
|
|
225
|
+
const px = xOf(tt, t);
|
|
226
|
+
const py = o.y + o.h * (1 - v);
|
|
227
|
+
if (!started) g.moveTo(px, py);
|
|
228
|
+
else g.lineTo(px, py);
|
|
229
|
+
started = true;
|
|
230
|
+
}
|
|
231
|
+
g.stroke();
|
|
232
|
+
});
|
|
233
|
+
g.restore();
|
|
234
|
+
const head = o.series[0];
|
|
235
|
+
if (head && t >= since) {
|
|
236
|
+
const v = clamp(head.value(t));
|
|
237
|
+
g.fillStyle = color;
|
|
238
|
+
g.fillRect(o.x + o.w - 6, o.y + o.h * (1 - v) - 6, 12, 12);
|
|
239
|
+
}
|
|
240
|
+
g.font = mono(ctx, 24, 600);
|
|
241
|
+
g.textBaseline = "top";
|
|
242
|
+
o.series.forEach((s, k) => {
|
|
243
|
+
g.fillStyle = [color, dim, dim][s.tone ?? k] ?? color;
|
|
244
|
+
g.fillText(`${s.label} ${readout(0, { to: t >= since ? clamp(s.value(t)) : NaN, width: 4, decimals: 2 })}`, o.x + o.w + 40, o.y + k * 40);
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/** 조준선 — 화면을 가로지르는 가는 선 둘과 가운데 과녁, 좌표 표. 키 사이를 잡고 멈추듯 옮긴다 */
|
|
250
|
+
export function crosshair(el: HTMLElement, o: { ctx: SceneCtx; keys: { t: number; x: number; y: number; label?: string }[]; move?: number; at?: number; area?: [number, number, number, number]; coords?: boolean; size?: number }): (t: number) => void {
|
|
251
|
+
const { ctx } = o;
|
|
252
|
+
const keys = [...o.keys].sort((a, b) => a.t - b.t);
|
|
253
|
+
const move = o.move ?? 0.24;
|
|
254
|
+
const [ax, ay, aw, ah] = o.area ?? [0, 0, ctx.meta.width, ctx.meta.height];
|
|
255
|
+
const r0 = o.size ?? 26;
|
|
256
|
+
const g = canvas(el, ctx, [ax - r0 - 4, ay - r0 - 40, aw + r0 + 300, ah + 2 * r0 + 80]);
|
|
257
|
+
const color = ink(ctx, "ink");
|
|
258
|
+
const dim = ink(ctx, "dim");
|
|
259
|
+
return (t) => {
|
|
260
|
+
clear(g);
|
|
261
|
+
if (!keys.length || t < (o.at ?? keys[0].t)) return;
|
|
262
|
+
let i = 0;
|
|
263
|
+
while (i + 1 < keys.length && keys[i + 1].t <= t) i++;
|
|
264
|
+
const a = keys[Math.max(0, i - 1)];
|
|
265
|
+
const b = keys[i];
|
|
266
|
+
const p = i === 0 ? 1 : snap(t, b.t, move);
|
|
267
|
+
const x = a.x + (b.x - a.x) * p;
|
|
268
|
+
const y = a.y + (b.y - a.y) * p;
|
|
269
|
+
g.fillStyle = dim;
|
|
270
|
+
g.fillRect(ax, Math.round(y), aw, 1);
|
|
271
|
+
g.fillRect(Math.round(x), ay, 1, ah);
|
|
272
|
+
g.strokeStyle = color;
|
|
273
|
+
g.lineWidth = 2;
|
|
274
|
+
const r = o.size ?? 26;
|
|
275
|
+
g.strokeRect(x - r, y - r, r * 2, r * 2);
|
|
276
|
+
g.fillStyle = color;
|
|
277
|
+
g.fillRect(x - 3, y - 3, 6, 6);
|
|
278
|
+
g.font = mono(ctx, 22, 600);
|
|
279
|
+
g.textBaseline = "top";
|
|
280
|
+
if (o.coords !== false) g.fillText(`x ${readout(0, { to: x, width: 4 })} y ${readout(0, { to: y, width: 4 })}`, x + r + 10, y + r + 6);
|
|
281
|
+
if (b.label && p > 0.9) g.fillText(b.label, x + r + 10, y - r - 2);
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** HUD 틀 — 안전 영역 모서리 꺾쇠, 곡 시각·프레임 번호·마디·구간. 전부 그 프레임에 잰 값이라 멈추지 않는다 */
|
|
286
|
+
export function hudFrame(el: HTMLElement, o: { ctx: SceneCtx; title: string; songFrom?: number; barFrom?: number; at?: number; grid?: { step?: number; speed?: number } }): (t: number) => void {
|
|
287
|
+
const { ctx } = o;
|
|
288
|
+
const g = canvas(el, ctx);
|
|
289
|
+
const s = ctx.safe;
|
|
290
|
+
const W = ctx.meta.width;
|
|
291
|
+
const H = ctx.meta.height;
|
|
292
|
+
const L = s.left || 60;
|
|
293
|
+
const T = s.top || 40;
|
|
294
|
+
const R = W - (s.right || 60);
|
|
295
|
+
const B = H - (s.bottom || 40);
|
|
296
|
+
const color = ink(ctx, "ink");
|
|
297
|
+
const dim = ink(ctx, "dim");
|
|
298
|
+
const step = o.grid?.step ?? 60;
|
|
299
|
+
const speed = o.grid?.speed ?? 360;
|
|
300
|
+
return (t) => {
|
|
301
|
+
clear(g);
|
|
302
|
+
// 계측판 눈금 — 늘 한쪽으로 흘러 재는 동안 화면이 한순간도 서지 않는다
|
|
303
|
+
if (o.grid) {
|
|
304
|
+
const off = (((ctx.from + t) * speed) % step + step) % step;
|
|
305
|
+
g.fillStyle = ink(ctx, "line");
|
|
306
|
+
for (let x = off - step; x < W; x += step) g.fillRect(Math.round(x), 0, 2, H);
|
|
307
|
+
for (let y = (off * 0.5) % step - step; y < H; y += step) g.fillRect(0, Math.round(y), W, 2);
|
|
308
|
+
// 마디마다 화면을 한 번 가로지르는 계측 커서
|
|
309
|
+
const b0 = ctx.beats.prev(t, "bar");
|
|
310
|
+
const b1 = ctx.beats.next(t, "bar");
|
|
311
|
+
if (Number.isFinite(b0) && Number.isFinite(b1) && b1 > b0) {
|
|
312
|
+
g.fillStyle = ink(ctx, "dim");
|
|
313
|
+
g.fillRect(Math.round(((t - b0) / (b1 - b0)) * W), 0, 3, H);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
const p = snap(t, o.at ?? 0, 0.3);
|
|
317
|
+
if (p <= 0) return;
|
|
318
|
+
const arm = 44 * p;
|
|
319
|
+
g.strokeStyle = color;
|
|
320
|
+
g.lineWidth = 3;
|
|
321
|
+
g.beginPath();
|
|
322
|
+
for (const [cx, cy, sx, sy] of [
|
|
323
|
+
[L - 30, T - 20, 1, 1],
|
|
324
|
+
[R + 30, T - 20, -1, 1],
|
|
325
|
+
[L - 30, B + 20, 1, -1],
|
|
326
|
+
[R + 30, B + 20, -1, -1],
|
|
327
|
+
] as const) {
|
|
328
|
+
g.moveTo(cx + sx * arm, cy);
|
|
329
|
+
g.lineTo(cx, cy);
|
|
330
|
+
g.lineTo(cx, cy + sy * arm);
|
|
331
|
+
}
|
|
332
|
+
g.stroke();
|
|
333
|
+
if (p < 0.6) return;
|
|
334
|
+
const song = (o.songFrom ?? 0) + ctx.from + t;
|
|
335
|
+
const bar = (o.barFrom ?? 0) + ctx.beats.bars.filter((x) => x <= t + 1e-6).length;
|
|
336
|
+
const f = Math.floor((ctx.from + t) * ctx.meta.fps + 1e-6);
|
|
337
|
+
const sec = ctx.beats.section(t);
|
|
338
|
+
g.font = mono(ctx, 26, 600);
|
|
339
|
+
g.fillStyle = color;
|
|
340
|
+
g.textBaseline = "top";
|
|
341
|
+
g.fillText(o.title, L, T);
|
|
342
|
+
g.textAlign = "right";
|
|
343
|
+
g.fillText(`${readout(0, { to: Math.floor(song / 60), width: 2 })}:${readout(0, { to: song % 60, width: 5, decimals: 2 })}`, R, T);
|
|
344
|
+
g.fillStyle = dim;
|
|
345
|
+
g.fillText(`F ${readout(0, { to: f, width: 5 })}`, R, T + 36);
|
|
346
|
+
g.textBaseline = "bottom";
|
|
347
|
+
g.fillStyle = color;
|
|
348
|
+
g.fillText(`BAR ${readout(0, { to: bar, width: 3 })}`, R, B);
|
|
349
|
+
g.textAlign = "left";
|
|
350
|
+
g.fillText(`${String(sec.kind).toUpperCase()} ${readout(0, { to: sec.strength ?? 0, width: 4, decimals: 2 })}`, L, B);
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** 드롭 트리거 — 화면이 두 프레임 형광으로 뒤집히고 가로 띠가 어긋났다 돌아온다. 흔들림을 돌려준다 */
|
|
355
|
+
export function dropTrigger(el: HTMLElement, o: { ctx: SceneCtx; drop?: number; label?: string }): (t: number) => DropBurstState {
|
|
356
|
+
const { ctx } = o;
|
|
357
|
+
const g = canvas(el, ctx);
|
|
358
|
+
const W = ctx.meta.width;
|
|
359
|
+
const H = ctx.meta.height;
|
|
360
|
+
const color = ink(ctx, "ink");
|
|
361
|
+
const bg = ink(ctx, "bg");
|
|
362
|
+
return (t) => {
|
|
363
|
+
const s = dropBurst(t, { beats: ctx.beats, drop: o.drop ?? 0, rules: ctx.style.motion, scene: ctx.id, source: "dropTrigger" });
|
|
364
|
+
clear(g);
|
|
365
|
+
const local = t - ctx.beats.drop(o.drop ?? 0);
|
|
366
|
+
if (local < 0 || local > 0.5) return s;
|
|
367
|
+
if (s.flash > 0.6) {
|
|
368
|
+
g.fillStyle = color;
|
|
369
|
+
g.fillRect(0, 0, W, H);
|
|
370
|
+
g.fillStyle = bg;
|
|
371
|
+
g.font = mono(ctx, 160, 800);
|
|
372
|
+
g.textBaseline = "middle";
|
|
373
|
+
g.textAlign = "center";
|
|
374
|
+
g.fillText(o.label ?? "TRIG", W / 2, H / 2);
|
|
375
|
+
g.textAlign = "left";
|
|
376
|
+
return s;
|
|
377
|
+
}
|
|
378
|
+
// 섬광이 걷히는 동안 형광 가로 띠 몇 줄 — 줄 수와 자리는 드롭에서 지난 시각만으로 정한다
|
|
379
|
+
const k = Math.floor(local * 30);
|
|
380
|
+
g.fillStyle = color;
|
|
381
|
+
for (let i = 0; i < 6 - k; i++) {
|
|
382
|
+
const y = ((i * 397 + k * 131) % H) | 0;
|
|
383
|
+
g.globalAlpha = s.flash * 0.9 + 0.1;
|
|
384
|
+
g.fillRect(0, y, W, 6 + ((i * 7) % 18));
|
|
385
|
+
}
|
|
386
|
+
g.globalAlpha = 1;
|
|
387
|
+
return s;
|
|
388
|
+
};
|
|
389
|
+
}
|
|
@@ -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>
|