@auscera/cleoedits 0.0.0-stage → 0.1.0

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 (230) hide show
  1. package/README.md +62 -2
  2. package/cli.mjs +149 -0
  3. package/lib/dependencies.mjs +384 -0
  4. package/lib/run.mjs +114 -0
  5. package/lib/workspace.mjs +167 -0
  6. package/package.json +240 -3
  7. package/workspace/.agents/skills/cleoedits/SKILL.md +29 -0
  8. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/audiogram.json +41 -0
  9. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/facebook.json +48 -0
  10. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/linkedin.json +48 -0
  11. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/podcast.json +23 -0
  12. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/reels.json +48 -0
  13. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/shorts.json +48 -0
  14. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/tiktok.json +48 -0
  15. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/x.json +48 -0
  16. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/youtube-shorts.json +48 -0
  17. package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/youtube.json +48 -0
  18. package/workspace/.agents/skills/cleoedits/assets/reel_effects/assets/LICENSE-SimpleIcons +30 -0
  19. package/workspace/.agents/skills/cleoedits/assets/reel_effects/assets/logos.json +1 -0
  20. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Anton-Regular.ttf +0 -0
  21. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/ArchivoBlack-Regular.ttf +0 -0
  22. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/InstrumentSerif-Italic.ttf +0 -0
  23. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Inter.ttf +0 -0
  24. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/LICENSE-PermanentMarker.txt +202 -0
  25. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Montserrat.ttf +0 -0
  26. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Anton.txt +93 -0
  27. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-ArchivoBlack.txt +93 -0
  28. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-InstrumentSerif.txt +93 -0
  29. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Inter.txt +93 -0
  30. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Montserrat.txt +93 -0
  31. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-PlayfairDisplay.txt +93 -0
  32. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Poppins.txt +93 -0
  33. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-SpaceMono.txt +93 -0
  34. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PermanentMarker-Regular.ttf +0 -0
  35. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PlayfairDisplay-Italic.ttf +0 -0
  36. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PlayfairDisplay.ttf +0 -0
  37. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-Black.ttf +0 -0
  38. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-Bold.ttf +0 -0
  39. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-ExtraBold.ttf +0 -0
  40. package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/SpaceMono-Bold.ttf +0 -0
  41. package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/LICENSE-MediaPipe +218 -0
  42. package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/LICENSE-YuNet +21 -0
  43. package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/NOTICE.md +4 -0
  44. package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/selfie_segmenter.tflite +0 -0
  45. package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/yunet.onnx +0 -0
  46. package/workspace/.agents/skills/cleoedits/assets/video_styles/LICENSE +21 -0
  47. package/workspace/.agents/skills/cleoedits/assets/video_styles/audio-app-ui/STYLE.md +65 -0
  48. package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/STYLE.md +53 -0
  49. package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/index.html +328 -0
  50. package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/studio.js +57 -0
  51. package/workspace/.agents/skills/cleoedits/assets/video_styles/data-story/STYLE.md +65 -0
  52. package/workspace/.agents/skills/cleoedits/assets/video_styles/data-story/index.html +575 -0
  53. package/workspace/.agents/skills/cleoedits/assets/video_styles/design-app-ui/STYLE.md +68 -0
  54. package/workspace/.agents/skills/cleoedits/assets/video_styles/editor-ui/STYLE.md +73 -0
  55. package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/STYLE.md +54 -0
  56. package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/index.html +189 -0
  57. package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/studio.js +57 -0
  58. package/workspace/.agents/skills/cleoedits/assets/video_styles/explainer-diagram/STYLE.md +64 -0
  59. package/workspace/.agents/skills/cleoedits/assets/video_styles/explainer-diagram/index.html +620 -0
  60. package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/STYLE.md +55 -0
  61. package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/index.html +238 -0
  62. package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/studio.js +57 -0
  63. package/workspace/.agents/skills/cleoedits/assets/video_styles/growing-city/STYLE.md +66 -0
  64. package/workspace/.agents/skills/cleoedits/assets/video_styles/growing-city/index.html +602 -0
  65. package/workspace/.agents/skills/cleoedits/assets/video_styles/ink-line/STYLE.md +66 -0
  66. package/workspace/.agents/skills/cleoedits/assets/video_styles/ink-line/index.html +777 -0
  67. package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/STYLE.md +56 -0
  68. package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/index.html +186 -0
  69. package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/studio.js +57 -0
  70. package/workspace/.agents/skills/cleoedits/assets/video_styles/motion-app-ui/STYLE.md +68 -0
  71. package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/STYLE.md +56 -0
  72. package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/index.html +244 -0
  73. package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/studio.js +57 -0
  74. package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-world/STYLE.md +67 -0
  75. package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-world/index.html +663 -0
  76. package/workspace/.agents/skills/cleoedits/assets/video_styles/particle-field/STYLE.md +59 -0
  77. package/workspace/.agents/skills/cleoedits/assets/video_styles/particle-field/index.html +395 -0
  78. package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/STYLE.md +52 -0
  79. package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/index.html +194 -0
  80. package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/studio.js +57 -0
  81. package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/STYLE.md +58 -0
  82. package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/index.html +242 -0
  83. package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/studio.js +57 -0
  84. package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/STYLE.md +53 -0
  85. package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/index.html +138 -0
  86. package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/studio.js +57 -0
  87. package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-kinetic/STYLE.md +63 -0
  88. package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-kinetic/index.html +599 -0
  89. package/workspace/.agents/skills/cleoedits/assets/video_styles/time-travel/STYLE.md +65 -0
  90. package/workspace/.agents/skills/cleoedits/assets/video_styles/time-travel/index.html +1297 -0
  91. package/workspace/.agents/skills/cleoedits/assets/video_styles/weather-widget/STYLE.md +69 -0
  92. package/workspace/.agents/skills/cleoedits/assets/video_styles/weather-widget/index.html +674 -0
  93. package/workspace/.agents/skills/cleoedits/references/audio-clearervoice-elevenlabs.md +11 -0
  94. package/workspace/.agents/skills/cleoedits/references/ffmpeg-and-reels.md +15 -0
  95. package/workspace/.agents/skills/cleoedits/references/hyperframes-workflows.md +13 -0
  96. package/workspace/.agents/skills/cleoedits/references/kdenlive-cli-and-mcp.md +12 -0
  97. package/workspace/.agents/skills/cleoedits/references/motion-design-pipeline.md +7 -0
  98. package/workspace/.agents/skills/cleoedits/references/motion-taste-emil.md +5 -0
  99. package/workspace/.agents/skills/cleoedits/references/playwright-demo-capture.md +9 -0
  100. package/workspace/.agents/skills/cleoedits/references/remotion-workflows.md +13 -0
  101. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/LICENSE +21 -0
  102. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_ass_overlay.py +399 -0
  103. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/__init__.py +235 -0
  104. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/alpha.py +560 -0
  105. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/asr.py +1237 -0
  106. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/color.py +540 -0
  107. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/decision.py +2452 -0
  108. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/drawtext.py +290 -0
  109. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/emit.py +1309 -0
  110. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/emoji.py +518 -0
  111. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/fonts.py +875 -0
  112. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/pacing.py +263 -0
  113. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/pacing_edit.py +432 -0
  114. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/probe.py +1613 -0
  115. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/runner.py +3994 -0
  116. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/text.py +73 -0
  117. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/timeline.py +721 -0
  118. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/wrap.py +981 -0
  119. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_contract.py +2454 -0
  120. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_platforms.py +258 -0
  121. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_review.html +754 -0
  122. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_review.py +258 -0
  123. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_smartcut.py +450 -0
  124. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/audio.py +867 -0
  125. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/background.py +136 -0
  126. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/batch.py +1409 -0
  127. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/broll.py +282 -0
  128. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/caption.py +2207 -0
  129. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/check.py +815 -0
  130. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/color.py +695 -0
  131. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/crop.py +91 -0
  132. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/cropdetect.py +214 -0
  133. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/cut.py +2076 -0
  134. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/deinterlace.py +90 -0
  135. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/denoise.py +94 -0
  136. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/export.py +1033 -0
  137. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/fit.py +729 -0
  138. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/freeze.py +197 -0
  139. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/graphics.py +920 -0
  140. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/grid.py +235 -0
  141. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/insert.py +142 -0
  142. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/join.py +1083 -0
  143. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/look.py +475 -0
  144. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/loop.py +395 -0
  145. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/loudness.py +397 -0
  146. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/metadata.py +416 -0
  147. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/multicam.py +414 -0
  148. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/overlay.py +766 -0
  149. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/pad.py +121 -0
  150. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/probe.py +145 -0
  151. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/proxy.py +93 -0
  152. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/redact.py +162 -0
  153. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/render.py +2424 -0
  154. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/report.py +354 -0
  155. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/reverse.py +114 -0
  156. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/scenes.py +439 -0
  157. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sequence.py +285 -0
  158. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/silence.py +945 -0
  159. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/speedramp.py +193 -0
  160. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sphere.py +137 -0
  161. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/stabilize.py +141 -0
  162. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/straighten.py +120 -0
  163. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sync.py +500 -0
  164. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/verify.py +411 -0
  165. package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/waveform.py +502 -0
  166. package/workspace/.agents/skills/cleoedits/scripts/kdenlive_builder.py +284 -0
  167. package/workspace/.agents/skills/cleoedits/scripts/motion/LICENSE-claude-motion +21 -0
  168. package/workspace/.agents/skills/cleoedits/scripts/motion/LICENSE-motion-design +21 -0
  169. package/workspace/.agents/skills/cleoedits/scripts/motion/_media.py +43 -0
  170. package/workspace/.agents/skills/cleoedits/scripts/motion/pacing_check.py +90 -0
  171. package/workspace/.agents/skills/cleoedits/scripts/motion/storyboard.py +77 -0
  172. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/LICENSE +26 -0
  173. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/fx.py +2717 -0
  174. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/logos.py +194 -0
  175. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/sfx.py +105 -0
  176. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/trim.py +99 -0
  177. package/workspace/.agents/skills/cleoedits/scripts/reel_effects/words.py +60 -0
  178. package/workspace/.claude/commands/blender-3d.md +12 -0
  179. package/workspace/.claude/commands/business-short-form-reels.md +12 -0
  180. package/workspace/.claude/commands/color-grade.md +12 -0
  181. package/workspace/.claude/commands/cutout-grid-reel.md +12 -0
  182. package/workspace/.claude/commands/depth-ui-reel.md +12 -0
  183. package/workspace/.claude/commands/explainer-panel-reel.md +12 -0
  184. package/workspace/.claude/commands/freeze-frame.md +12 -0
  185. package/workspace/.claude/commands/glass-graph.md +12 -0
  186. package/workspace/.claude/commands/over-the-shoulder.md +12 -0
  187. package/workspace/.claude/commands/personal-short-form-reels.md +12 -0
  188. package/workspace/.claude/commands/ranking-format.md +12 -0
  189. package/workspace/.claude/commands/relight.md +12 -0
  190. package/workspace/.claude/commands/reverse-engineer.md +12 -0
  191. package/workspace/.claude/commands/text-behind.md +12 -0
  192. package/workspace/.claude/commands/tier-list.md +12 -0
  193. package/workspace/.claude-plugin/plugin.json +8 -0
  194. package/workspace/.npmignore +15 -0
  195. package/workspace/AGENTS.md +30 -0
  196. package/workspace/README.md +63 -0
  197. package/workspace/assets/fonts/TikTokSans-OFL.txt +93 -0
  198. package/workspace/assets/fonts/TikTokSans-Variable.ttf +0 -0
  199. package/workspace/assets/luts/clean_warm.cube +4917 -0
  200. package/workspace/assets/luts/golden_hour.cube +4917 -0
  201. package/workspace/assets/luts/moody_dark.cube +4917 -0
  202. package/workspace/assets/luts/teal_orange.cube +4917 -0
  203. package/workspace/assets/sfx/NOTICE.txt +1 -0
  204. package/workspace/assets/sfx/click.wav +0 -0
  205. package/workspace/assets/sfx/pop.wav +0 -0
  206. package/workspace/assets/sfx/riser.wav +0 -0
  207. package/workspace/assets/sfx/whoosh.wav +0 -0
  208. package/workspace/generators/hyperframes/index.html +39 -0
  209. package/workspace/generators/hyperframes/package.json +15 -0
  210. package/workspace/generators/hyperframes/pnpm-lock.yaml +1181 -0
  211. package/workspace/generators/hyperframes/pnpm-workspace.yaml +10 -0
  212. package/workspace/generators/remotion/eslint.config.mjs +3 -0
  213. package/workspace/generators/remotion/package.json +36 -0
  214. package/workspace/generators/remotion/pnpm-lock.yaml +4179 -0
  215. package/workspace/generators/remotion/pnpm-workspace.yaml +10 -0
  216. package/workspace/generators/remotion/remotion.config.ts +13 -0
  217. package/workspace/generators/remotion/src/Root.tsx +52 -0
  218. package/workspace/generators/remotion/src/index.css +1 -0
  219. package/workspace/generators/remotion/src/index.ts +4 -0
  220. package/workspace/generators/remotion/tsconfig.json +15 -0
  221. package/workspace/pipeline/scripts/_codec.py +28 -0
  222. package/workspace/pipeline/scripts/ai_media_api.py +109 -0
  223. package/workspace/pipeline/scripts/blender_render.py +166 -0
  224. package/workspace/pipeline/scripts/composite.py +49 -0
  225. package/workspace/pipeline/scripts/melt.sh +68 -0
  226. package/workspace/pipeline/scripts/normalize_audio.py +39 -0
  227. package/workspace/pipeline/scripts/person_matte.py +216 -0
  228. package/workspace/pipeline/scripts/record_demo.py +69 -0
  229. package/workspace/pipeline/scripts/whisper_cut.py +98 -0
  230. package/workspace-manifest.json +908 -0
@@ -0,0 +1,575 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=1920, height=1080" />
6
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
7
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
8
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bodoni+Moda:opsz,wght@6..96,400&family=Inter:wght@400;500;700&display=swap" />
9
+ <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
10
+ <style>
11
+ * { margin: 0; padding: 0; box-sizing: border-box; }
12
+ html, body { margin: 0; width: 1920px; height: 1080px; overflow: hidden; background: #FFF1E5; }
13
+ #root { position: relative; width: 1920px; height: 1080px; }
14
+ #stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; }
15
+ </style>
16
+ </head>
17
+ <body>
18
+ <div id="root" data-composition-id="main" data-start="0" data-duration="12" data-width="1920" data-height="1080">
19
+ <canvas id="stage" class="clip" width="1920" height="1080" data-start="0" data-duration="12" data-track-index="0"></canvas>
20
+ </div>
21
+ <script>
22
+ // ============================================================
23
+ // Where viewers leave: an editorial newspaper-style data story.
24
+ // One canvas, drawn as a pure function of time. 12 s, does not loop.
25
+ // Beats (120 BPM, hits on 0.5 s):
26
+ // 0.0-1.0 title rises, gridlines and axes draw in
27
+ // 1.0-3.5 ink line draws, playhead dot rides the cliff, big counter 100% -> end value
28
+ // 3.5-6.0 camera dives into the first minute, ticks reflow, "42% gone by 0:30" callout
29
+ // 6.0-8.5 blue "better" line unzips out of the ink line, camera pulls back out
30
+ // 9.0-12 "+38%" gain counts up in the open sky, light sweeps the gain, hold
31
+ // Change words: TITLE_WORDS and the LABEL_* constants below.
32
+ // Change colours: PAPER, INK, GRID, BLUE (BLUE is the one accent).
33
+ // Change the data: the SAMPLE DATA block. The on-screen numbers are worked out from it.
34
+ // ============================================================
35
+ window.__timelines = window.__timelines || {};
36
+ const DUR = 12;
37
+ const W = 1920, H = 1080;
38
+ const L = 216, R = 1720, T = 280, BOT = 920, PW = R - L, PH = BOT - T;
39
+ const PAPER = '#FFF1E5', INK = '#1A1A1A', GRID = '#E6D9CE', BLUE = '#0F5499';
40
+ const SANS = '"Inter", Arial, sans-serif';
41
+ const SERIF = '"Bodoni Moda", Georgia, serif';
42
+
43
+ // ---------- words ----------
44
+ const TITLE_WORDS = ['Where', 'viewers', 'leave'];
45
+ const LABEL_STILL = 'still watching';
46
+ const LABEL_BEFORE = 'Before';
47
+ const LABEL_AFTER = 'Better hook';
48
+ const LABEL_GONE = 'gone by';
49
+
50
+ // ---------- SAMPLE DATA: change these ----------
51
+ // Made-up retention curves for a 10 minute (600 s) video: % still watching at second x.
52
+ // Each curve = floor + slow * e^(-x/slowTau) + cliff * e^(-x/cliffTau). Keep floor + slow + cliff = 100.
53
+ const DATA_BEFORE = { floor: 28.3, slow: 31.2, slowTau: 250, cliff: 40.5, cliffTau: 9 };
54
+ const DATA_AFTER = { floor: 38.3, slow: 43.2, slowTau: 280, cliff: 18.5, cliffTau: 14 };
55
+ const DROP_AT = 30; // seconds: the callout band and "gone by" marker
56
+
57
+ const cv = document.getElementById('stage');
58
+ const mainCtx = cv.getContext('2d');
59
+ let ctx = mainCtx;
60
+ const fcv = document.createElement('canvas'); fcv.width = W; fcv.height = H;
61
+ const fctx = fcv.getContext('2d');
62
+
63
+ // ---------- helpers ----------
64
+ const clamp = (v, a = 0, b = 1) => Math.min(b, Math.max(a, v));
65
+ const lerp = (a, b, k) => a + (b - a) * k;
66
+ const seg = (t, a, b) => clamp((t - a) / (b - a));
67
+ const sstep = (a, b, v) => { const k = clamp((v - a) / (b - a)); return k * k * (3 - 2 * k); };
68
+ const E = {};
69
+ ['power1.inOut', 'power2.out', 'power2.in', 'power2.inOut', 'power3.out', 'power3.inOut', 'power4.out',
70
+ 'expo.out', 'expo.inOut', 'sine.inOut', 'back.out(2.2)', 'back.out(1.4)'].forEach(n => { E[n] = gsap.parseEase(n); });
71
+ const ez = (n, t, a, b) => E[n](seg(t, a, b));
72
+
73
+ // seeded PRNG (mulberry32)
74
+ function rng(seed) { return function () { seed |= 0; seed = seed + 0x6D2B79F5 | 0; let t = Math.imul(seed ^ seed >>> 15, 1 | seed); t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t; return ((t ^ t >>> 14) >>> 0) / 4294967296; }; }
75
+
76
+ // ---------- curve wobble (keeps the line from looking like a formula) ----------
77
+ function wob(x) {
78
+ const s = sstep(0, 40, x);
79
+ return (0.55 * Math.sin(x * 0.23 + 1.3) + 0.35 * Math.sin(x * 0.61 + 0.4) + 0.14 * Math.sin(x * 1.37 + 2.1)) * s
80
+ + 1.6 * Math.exp(-Math.pow((x - 262) / 9, 2));
81
+ }
82
+ const curve = d => x => d.floor + d.slow * Math.exp(-x / d.slowTau) + d.cliff * Math.exp(-x / d.cliffTau) + wob(x);
83
+ const before = curve(DATA_BEFORE);
84
+ const after = curve(DATA_AFTER);
85
+ // on-screen numbers, worked out from the sample data (42% and +38% with the defaults)
86
+ const DROP_PCT = Math.round(100 - before(DROP_AT));
87
+ const GAIN_PCT = Math.round((after(600) / before(600) - 1) * 100);
88
+
89
+ // ---------- paper texture (static, seeded) ----------
90
+ const paper = document.createElement('canvas');
91
+ paper.width = W + 160; paper.height = H + 160;
92
+ (function buildPaper() {
93
+ const p = paper.getContext('2d');
94
+ const pw = paper.width, ph = paper.height;
95
+ p.fillStyle = PAPER; p.fillRect(0, 0, pw, ph);
96
+ const r = rng(4242);
97
+ // low-frequency mottling: soft blotches
98
+ for (let i = 0; i < 140; i++) {
99
+ const x = r() * pw, y = r() * ph, rad = 120 + r() * 320;
100
+ const g = p.createRadialGradient(x, y, 0, x, y, rad);
101
+ const dark = r() < 0.5;
102
+ const a = 0.008 + r() * 0.012;
103
+ g.addColorStop(0, dark ? `rgba(150,96,50,${a})` : `rgba(255,252,246,${a * 1.6})`);
104
+ g.addColorStop(1, 'rgba(0,0,0,0)');
105
+ p.fillStyle = g; p.fillRect(x - rad, y - rad, rad * 2, rad * 2);
106
+ }
107
+ // fibres
108
+ p.lineCap = 'round';
109
+ for (let i = 0; i < 2600; i++) {
110
+ const x = r() * pw, y = r() * ph, len = 6 + r() * 26, ang = r() * Math.PI;
111
+ const bend = (r() - 0.5) * 8;
112
+ const dark = r() < 0.55;
113
+ p.strokeStyle = dark ? `rgba(120,80,45,${0.035 + r() * 0.05})` : `rgba(255,255,250,${0.12 + r() * 0.18})`;
114
+ p.lineWidth = 0.6 + r() * 0.9;
115
+ const dx = Math.cos(ang) * len, dy = Math.sin(ang) * len;
116
+ p.beginPath(); p.moveTo(x, y); p.quadraticCurveTo(x + dx / 2 - dy / len * bend, y + dy / 2 + dx / len * bend, x + dx, y + dy); p.stroke();
117
+ }
118
+ // fine grain
119
+ const img = p.getImageData(0, 0, pw, ph); const d = img.data;
120
+ for (let i = 0; i < d.length; i += 4) {
121
+ const n = (r() - 0.5) * 9;
122
+ d[i] += n; d[i + 1] += n * 0.92; d[i + 2] += n * 0.8;
123
+ }
124
+ p.putImageData(img, 0, 0);
125
+ })();
126
+
127
+ // diagonal hatch for the gain area (print detail)
128
+ const hatch = document.createElement('canvas');
129
+ hatch.width = 14; hatch.height = 14;
130
+ (function () {
131
+ const h = hatch.getContext('2d');
132
+ h.strokeStyle = 'rgba(15,84,153,0.55)'; h.lineWidth = 1.4;
133
+ for (const o of [-14, 0, 14]) { h.beginPath(); h.moveTo(o, 14); h.lineTo(o + 14, 0); h.stroke(); }
134
+ })();
135
+ const hatchPat = ctx.createPattern(hatch, 'repeat');
136
+
137
+ // ---------- camera ----------
138
+ const LN = Math.log;
139
+ function cam(t) {
140
+ const z = ez('power3.inOut', t, 3.5, 4.5) - ez('power3.inOut', t, 7.0, 8.0);
141
+ const xs = Math.exp(lerp(LN(600), LN(60), z));
142
+ const ys = Math.exp(lerp(LN(100), LN(62), z));
143
+ return { z, x0: 0, xs, y0: 100 - ys, ys };
144
+ }
145
+ const SX = (c, v) => L + (v - c.x0) / c.xs * PW;
146
+ const SY = (c, v) => BOT - (v - c.y0) / c.ys * PH;
147
+
148
+ // blue playhead (data seconds) and lift amount
149
+ function blueTip(t, c) {
150
+ if (t < 6.0) return 0;
151
+ const f1 = 0.9 * ez('expo.out', t, 6.0, 6.7);
152
+ const f = f1 + 0.1 * seg(t, 7.0, 8.5);
153
+ return Math.min(600, c.x0 + f * c.xs);
154
+ }
155
+ const lift = (t, x) => E['power3.inOut'](seg(t - 0.35 * clamp(x / 60), 6.45, 7.0));
156
+ const blueVal = (t, x) => { const b = before(x); return b + lift(t, x) * (after(x) - b); };
157
+
158
+ function fmtTime(s) { const m = Math.floor(s / 60), r = Math.round(s - m * 60); return `${m}:${String(r).padStart(2, '0')}`; }
159
+
160
+ function linePath(c, fn, x1, x2) {
161
+ const a = SX(c, x1), b = SX(c, x2);
162
+ ctx.beginPath();
163
+ let first = true;
164
+ for (let px = a; px <= b + 0.01; px += 2.5) {
165
+ const v = c.x0 + (Math.min(px, b) - L) / PW * c.xs;
166
+ const y = SY(c, fn(v));
167
+ if (first) { ctx.moveTo(px, y); first = false; } else ctx.lineTo(px, y);
168
+ }
169
+ ctx.lineTo(b, SY(c, fn(x2)));
170
+ }
171
+
172
+ function haloText(str, x, y, fill, halo = 9) {
173
+ ctx.lineJoin = 'round';
174
+ ctx.strokeStyle = 'rgba(255,241,229,0.92)'; ctx.lineWidth = halo; ctx.strokeText(str, x, y);
175
+ ctx.fillStyle = fill; ctx.fillText(str, x, y);
176
+ }
177
+
178
+ function dot(x, y, col, s, a = 1) {
179
+ if (s <= 0 || a <= 0) return;
180
+ ctx.save();
181
+ ctx.globalAlpha = a;
182
+ ctx.shadowColor = 'rgba(70,40,15,0.30)'; ctx.shadowBlur = 14; ctx.shadowOffsetY = 6;
183
+ ctx.fillStyle = PAPER; ctx.beginPath(); ctx.arc(x, y, 16 * s, 0, Math.PI * 2); ctx.fill();
184
+ ctx.shadowColor = 'transparent';
185
+ ctx.fillStyle = col; ctx.beginPath(); ctx.arc(x, y, 10.5 * s, 0, Math.PI * 2); ctx.fill();
186
+ // specular-free tiny highlight for depth
187
+ const g = ctx.createRadialGradient(x - 3 * s, y - 4 * s, 0, x, y, 10.5 * s);
188
+ g.addColorStop(0, 'rgba(255,255,255,0.28)'); g.addColorStop(0.6, 'rgba(255,255,255,0)');
189
+ ctx.fillStyle = g; ctx.beginPath(); ctx.arc(x, y, 10.5 * s, 0, Math.PI * 2); ctx.fill();
190
+ ctx.restore();
191
+ }
192
+ function ring(x, y, col, t, at) {
193
+ const k = seg(t, at, at + 0.7);
194
+ if (k <= 0 || k >= 1) return;
195
+ const e = E['power2.out'](k);
196
+ ctx.save();
197
+ ctx.strokeStyle = col; ctx.globalAlpha = 0.55 * (1 - e); ctx.lineWidth = 2.5 * (1 - e) + 0.8;
198
+ ctx.beginPath(); ctx.arc(x, y, 14 + 62 * e, 0, Math.PI * 2); ctx.stroke();
199
+ ctx.restore();
200
+ }
201
+
202
+ // ---------- the frame: a pure function of time ----------
203
+ function draw(t) {
204
+ const c = cam(t);
205
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
206
+
207
+ // physical camera: slow push + a lean-in during the dive
208
+ const push = 1 + 0.012 * (t / DUR) + 0.028 * c.z;
209
+ const ox = 760, oy = 560;
210
+ const drift = -6 * c.z;
211
+ ctx.setTransform(push, 0, 0, push, ox - ox * push + drift, oy - oy * push);
212
+
213
+ // paper
214
+ ctx.drawImage(paper, -80, -80);
215
+ // key light: warm pool, slowly travelling
216
+ const lx = lerp(420, 900, t / DUR), ly = lerp(180, 260, t / DUR);
217
+ let g = ctx.createRadialGradient(lx, ly, 0, lx, ly, 1300);
218
+ g.addColorStop(0, 'rgba(255,250,242,0.55)'); g.addColorStop(0.5, 'rgba(255,246,236,0.12)'); g.addColorStop(1, 'rgba(255,240,225,0)');
219
+ ctx.fillStyle = g; ctx.fillRect(-100, -100, W + 200, H + 200);
220
+ g = ctx.createRadialGradient(W * 0.45, H * 0.42, 500, W * 0.5, H * 0.5, 1250);
221
+ g.addColorStop(0, 'rgba(150,80,40,0)'); g.addColorStop(1, 'rgba(150,80,40,0.10)');
222
+ ctx.fillStyle = g; ctx.fillRect(-100, -100, W + 200, H + 200);
223
+
224
+ // ----- title block -----
225
+ const barW = 84 * ez('expo.out', t, 0.0, 0.5);
226
+ ctx.fillStyle = INK; ctx.fillRect(120, 82, barW, 10);
227
+ ctx.font = `400 88px ${SERIF}`; ctx.textBaseline = 'alphabetic'; ctx.textAlign = 'left';
228
+ const words = TITLE_WORDS;
229
+ let wx = 120;
230
+ words.forEach((w, i) => {
231
+ const k = ez('power3.out', t, 0.1 + i * 0.09, 0.7 + i * 0.09);
232
+ ctx.save();
233
+ ctx.globalAlpha = k;
234
+ ctx.fillStyle = INK;
235
+ ctx.fillText(w, wx, 186 + 26 * (1 - k));
236
+ ctx.restore();
237
+ wx += ctx.measureText(w + ' ').width;
238
+ });
239
+
240
+ // ----- gridlines + y labels -----
241
+ ctx.save();
242
+ ctx.beginPath(); ctx.rect(L - 140, T - 40, PW + 180, PH + 40.5); ctx.clip();
243
+ const visY = s => sstep(62, 100, s / c.ys * PH);
244
+ for (let v = 0; v <= 100; v += 10) {
245
+ const vis = Math.max(v % 20 === 0 ? visY(20) : 0, visY(10));
246
+ if (vis <= 0.01) continue;
247
+ const y = SY(c, v);
248
+ if (y > BOT - 6 || y < T - 6) continue;
249
+ const intro = v % 20 === 0 ? ez('expo.out', t, 0.08 + (v / 20) * 0.07, 0.75 + (v / 20) * 0.07) : 1;
250
+ const edgeFade = sstep(BOT - 6, BOT - 40, y);
251
+ const a = vis * edgeFade;
252
+ if (intro <= 0) continue;
253
+ ctx.strokeStyle = GRID; ctx.globalAlpha = a; ctx.lineWidth = 2;
254
+ ctx.beginPath(); ctx.moveTo(L, y); ctx.lineTo(L + PW * intro, y); ctx.stroke();
255
+ ctx.globalAlpha = a * clamp(intro * 1.6);
256
+ ctx.font = `400 26px ${SANS}`; ctx.textAlign = 'right'; ctx.textBaseline = 'middle';
257
+ ctx.fillStyle = 'rgba(26,26,26,0.62)';
258
+ ctx.fillText(v === 100 ? '100%' : String(v), L - 22 - 10 * (1 - intro), y);
259
+ }
260
+ ctx.restore();
261
+
262
+ // ----- DROP_AT callout band (zoomed view) -----
263
+ const bandIn = ez('power3.out', t, 4.5, 5.0);
264
+ const bandOut = 1 - ez('power2.in', t, 7.0, 7.4);
265
+ const bandA = bandIn * bandOut;
266
+ if (bandA > 0) {
267
+ const bx2 = SX(c, DROP_AT);
268
+ const bw = (bx2 - L) * bandIn;
269
+ ctx.save();
270
+ ctx.globalAlpha = bandOut;
271
+ const bg = ctx.createLinearGradient(0, T, 0, BOT);
272
+ bg.addColorStop(0, 'rgba(120,70,30,0.075)'); bg.addColorStop(1, 'rgba(120,70,30,0.025)');
273
+ ctx.fillStyle = bg; ctx.fillRect(L, T - 20, bw, BOT - T + 20);
274
+ // dashed DROP_AT marker
275
+ const dk = ez('power3.out', t, 4.6, 5.1);
276
+ ctx.strokeStyle = 'rgba(26,26,26,0.55)'; ctx.lineWidth = 2; ctx.setLineDash([6, 8]);
277
+ ctx.beginPath(); ctx.moveTo(bx2, T - 20); ctx.lineTo(bx2, lerp(T - 20, BOT, dk)); ctx.stroke();
278
+ ctx.setLineDash([]);
279
+ ctx.restore();
280
+ }
281
+
282
+ // ----- baseline + x ticks -----
283
+ const baseK = ez('expo.out', t, 0.35, 1.05);
284
+ ctx.strokeStyle = INK; ctx.lineWidth = 2.5;
285
+ ctx.beginPath(); ctx.moveTo(L, BOT); ctx.lineTo(L + PW * baseK, BOT); ctx.stroke();
286
+ const visX = s => sstep(108, 150, s / c.xs * PW);
287
+ ctx.font = `400 26px ${SANS}`; ctx.textAlign = 'center'; ctx.textBaseline = 'alphabetic';
288
+ for (let v = 0; v <= 600; v += 10) {
289
+ let vis = 0;
290
+ for (const s of [10, 30, 60, 120]) if (v % s === 0) vis = Math.max(vis, visX(s));
291
+ if (vis <= 0.01) continue;
292
+ const x = SX(c, v);
293
+ if (x > R + 30) continue;
294
+ const xf = sstep(R + 30, R - 4, x);
295
+ const intro = ez('power3.out', t, 0.5 + (v / 60) * 0.045, 0.95 + (v / 60) * 0.045);
296
+ const a = vis * xf * intro;
297
+ if (a <= 0.01) continue;
298
+ ctx.globalAlpha = a;
299
+ ctx.strokeStyle = INK; ctx.lineWidth = 2;
300
+ ctx.beginPath(); ctx.moveTo(x, BOT); ctx.lineTo(x, BOT + 12); ctx.stroke();
301
+ ctx.fillStyle = 'rgba(26,26,26,0.72)';
302
+ ctx.fillText(fmtTime(v), x, BOT + 52 + 10 * (1 - intro) + 8 * (1 - vis));
303
+ }
304
+ ctx.globalAlpha = 1;
305
+
306
+ // ----- curves -----
307
+ const inkReveal = 600 * ez('sine.inOut', t, 1.0, 3.5);
308
+ const rxb = blueTip(t, c);
309
+ const inkFade = 1 - 0.55 * ez('power2.inOut', t, 10.5, 11.1);
310
+
311
+ ctx.save();
312
+ ctx.beginPath(); ctx.rect(L - 30, T - 60, PW + 60, PH + 60); ctx.clip();
313
+
314
+ // faint ink wash under the curve (depth)
315
+ if (inkReveal > 0) {
316
+ linePath(c, before, 0, inkReveal);
317
+ ctx.lineTo(SX(c, inkReveal), BOT); ctx.lineTo(SX(c, 0), BOT); ctx.closePath();
318
+ const wg = ctx.createLinearGradient(0, T, 0, BOT);
319
+ wg.addColorStop(0, 'rgba(26,26,26,0.11)'); wg.addColorStop(1, 'rgba(26,26,26,0.035)');
320
+ ctx.fillStyle = wg; ctx.globalAlpha = (1 - 0.45 * c.z) * (1 - 0.6 * ez('power2.inOut', t, 6.4, 7.2)); ctx.fill();
321
+ ctx.globalAlpha = 1;
322
+ }
323
+
324
+ // the gain: area between lines
325
+ if (rxb > 0) {
326
+ const fillA = ez('power2.out', t, 6.45, 7.2) * (1 + 0.35 * ez('power2.inOut', t, 10.5, 11.1));
327
+ const tracePoly = () => {
328
+ linePath(c, x => blueVal(t, x), 0, rxb);
329
+ const a = SX(c, 0), b = SX(c, rxb);
330
+ for (let px = b; px >= a - 0.01; px -= 2.5) {
331
+ const v = c.x0 + (Math.max(px, a) - L) / PW * c.xs;
332
+ ctx.lineTo(px, SY(c, before(v)));
333
+ }
334
+ ctx.closePath();
335
+ };
336
+ const m = ctx.getTransform();
337
+ ctx = fctx;
338
+ ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.clearRect(0, 0, W, H);
339
+ ctx.setTransform(m);
340
+ tracePoly();
341
+ const fg = ctx.createLinearGradient(0, T, 0, BOT);
342
+ fg.addColorStop(0, 'rgba(15,84,153,0.30)'); fg.addColorStop(1, 'rgba(15,84,153,0.10)');
343
+ ctx.globalAlpha = clamp(fillA * 0.85); ctx.fillStyle = fg; ctx.fill();
344
+ ctx.globalAlpha = clamp(fillA * 0.5); ctx.fillStyle = hatchPat; ctx.fill();
345
+ ctx.globalAlpha = 1;
346
+ // soft leading edge while the playhead is moving
347
+ const soft = 1 - ez('power2.inOut', t, 8.1, 8.5);
348
+ if (soft > 0) {
349
+ const bx = SX(c, rxb), fl = 150;
350
+ const hg = ctx.createLinearGradient(bx - fl, 0, bx + 2, 0);
351
+ hg.addColorStop(0, 'rgba(0,0,0,0)'); hg.addColorStop(1, `rgba(0,0,0,${soft})`);
352
+ ctx.globalCompositeOperation = 'destination-out';
353
+ ctx.fillStyle = hg; ctx.fillRect(bx - fl, T - 80, fl + 40, PH + 120);
354
+ ctx.globalCompositeOperation = 'source-over';
355
+ }
356
+ // raking light passes over the gain once it is proven
357
+ const shk = seg(t, 9.95, 11.2);
358
+ if (shk > 0 && shk < 1) {
359
+ const cx = lerp(L - 400, R + 400, E['power2.inOut'](shk));
360
+ const lg = ctx.createLinearGradient(cx - 220, T, cx + 220, T + 300);
361
+ lg.addColorStop(0, 'rgba(255,255,255,0)'); lg.addColorStop(0.5, 'rgba(255,255,255,0.75)'); lg.addColorStop(1, 'rgba(255,255,255,0)');
362
+ ctx.globalCompositeOperation = 'source-atop';
363
+ ctx.fillStyle = lg; ctx.fillRect(L - 40, T - 80, PW + 80, PH + 120);
364
+ ctx.globalCompositeOperation = 'source-over';
365
+ }
366
+ ctx = mainCtx;
367
+ ctx.save(); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.drawImage(fcv, 0, 0); ctx.restore();
368
+ ctx.globalAlpha = 1;
369
+ }
370
+
371
+ // ink line
372
+ if (inkReveal > 0) {
373
+ ctx.save();
374
+ ctx.globalAlpha = inkFade;
375
+ ctx.shadowColor = 'rgba(60,35,15,0.28)'; ctx.shadowBlur = 10; ctx.shadowOffsetY = 6;
376
+ ctx.strokeStyle = INK; ctx.lineWidth = 4.5; ctx.lineJoin = 'round'; ctx.lineCap = 'round';
377
+ linePath(c, before, 0, inkReveal); ctx.stroke();
378
+ ctx.restore();
379
+ }
380
+ // blue line
381
+ if (rxb > 0) {
382
+ ctx.save();
383
+ ctx.shadowColor = 'rgba(15,40,80,0.30)'; ctx.shadowBlur = 12; ctx.shadowOffsetY = 7;
384
+ ctx.strokeStyle = BLUE; ctx.lineWidth = 5.5; ctx.lineJoin = 'round'; ctx.lineCap = 'round';
385
+ linePath(c, x => blueVal(t, x), 0, rxb); ctx.stroke();
386
+ ctx.restore();
387
+ }
388
+ ctx.restore();
389
+
390
+ // ----- annotation: DROP_PCT% gone by DROP_AT -----
391
+ const annIn = ez('power3.out', t, 5.0, 5.4);
392
+ const annOut = 1 - ez('power2.in', t, 6.0, 6.3);
393
+ if (annIn > 0 && annOut > 0) {
394
+ const lx0 = SX(c, DROP_AT + 5.5), ly0 = SY(c, 89);
395
+ ctx.save();
396
+ ctx.globalAlpha = annIn * annOut;
397
+ const n = Math.round(DROP_PCT * ez('power2.out', t, 5.0, 5.5));
398
+ ctx.textAlign = 'left'; ctx.textBaseline = 'alphabetic';
399
+ ctx.font = `700 60px ${SANS}`;
400
+ const y0 = ly0 + 22 * (1 - annIn) - 10 * (1 - annOut);
401
+ haloText(`${n}%`, lx0, y0, INK, 12);
402
+ const w1 = ctx.measureText(DROP_PCT + '%').width;
403
+ ctx.font = `400 60px ${SANS}`;
404
+ haloText(' ' + LABEL_GONE + ' ' + fmtTime(DROP_AT), lx0 + w1, y0, INK, 12);
405
+ ctx.restore();
406
+ // arrow, drawn from the label to the cliff
407
+ const ak = ez('power2.inOut', t, 5.05, 5.55);
408
+ const p0 = { x: lx0 - 22, y: ly0 - 4 };
409
+ const tx = 17, p2 = { x: SX(c, tx) + 14, y: SY(c, before(tx)) - 22 };
410
+ const p1 = { x: p0.x - 190, y: p0.y - 140 };
411
+ const q = (u) => ({ x: (1 - u) * (1 - u) * p0.x + 2 * (1 - u) * u * p1.x + u * u * p2.x, y: (1 - u) * (1 - u) * p0.y + 2 * (1 - u) * u * p1.y + u * u * p2.y });
412
+ if (ak > 0) {
413
+ ctx.save();
414
+ ctx.globalAlpha = annOut;
415
+ ctx.strokeStyle = INK; ctx.lineWidth = 3; ctx.lineCap = 'round'; ctx.lineJoin = 'round';
416
+ ctx.beginPath(); ctx.moveTo(p0.x, p0.y);
417
+ for (let u = 0.02; u <= ak + 1e-6; u += 0.02) { const pt = q(Math.min(u, ak)); ctx.lineTo(pt.x, pt.y); }
418
+ ctx.stroke();
419
+ if (ak > 0.9) {
420
+ const e = q(ak), pr = q(ak - 0.04);
421
+ const ang = Math.atan2(e.y - pr.y, e.x - pr.x);
422
+ const hk = E['back.out(2.2)'](seg(ak, 0.9, 1));
423
+ const hl = 20 * hk;
424
+ ctx.beginPath();
425
+ ctx.moveTo(e.x - hl * Math.cos(ang - 0.45), e.y - hl * Math.sin(ang - 0.45));
426
+ ctx.lineTo(e.x, e.y);
427
+ ctx.lineTo(e.x - hl * Math.cos(ang + 0.45), e.y - hl * Math.sin(ang + 0.45));
428
+ ctx.stroke();
429
+ }
430
+ ctx.restore();
431
+ }
432
+ }
433
+
434
+ // ----- series labels (lagged camera = follow-through) -----
435
+ const cl = cam(Math.max(0, t - 0.09));
436
+ const beforeIn = ez('power3.out', t, 6.55, 7.0);
437
+ if (beforeIn > 0) {
438
+ const v = cl.x0 + 0.70 * cl.xs;
439
+ const x = SX(cl, v), y = SY(cl, before(v)) + 58 + 18 * (1 - beforeIn);
440
+ ctx.save();
441
+ ctx.globalAlpha = beforeIn * (1 - 0.4 * ez('power2.inOut', t, 10.5, 11.1));
442
+ ctx.font = `500 40px ${SANS}`; ctx.textAlign = 'center'; ctx.textBaseline = 'alphabetic';
443
+ haloText(LABEL_BEFORE, x, y, INK, 10);
444
+ ctx.restore();
445
+ }
446
+ const hookIn = ez('power3.out', t, 6.85, 7.3);
447
+ if (hookIn > 0) {
448
+ const v = cl.x0 + 0.42 * cl.xs;
449
+ const x = SX(cl, v), y = SY(cl, blueVal(t, v)) - 34 - 18 * (1 - hookIn);
450
+ ctx.save();
451
+ ctx.globalAlpha = hookIn;
452
+ ctx.font = `700 42px ${SANS}`; ctx.textAlign = 'center'; ctx.textBaseline = 'alphabetic';
453
+ haloText(LABEL_AFTER, x, y, BLUE, 12);
454
+ ctx.restore();
455
+ }
456
+
457
+ // ----- dots, readouts, rings -----
458
+ ctx.font = `700 30px ${SANS}`; ctx.textBaseline = 'middle'; ctx.textAlign = 'left';
459
+ // intro ink playhead
460
+ {
461
+ const sIn = E['back.out(2.2)'](seg(t, 1.0, 1.3));
462
+ const aOut = 1 - ez('power2.in', t, 3.6, 3.9);
463
+ if (sIn > 0 && aOut > 0) {
464
+ const x = SX(c, inkReveal), y = SY(c, before(inkReveal));
465
+ // playhead hairline
466
+ ctx.save();
467
+ ctx.globalAlpha = 0.45 * aOut * clamp(sIn);
468
+ ctx.strokeStyle = INK; ctx.lineWidth = 2;
469
+ ctx.beginPath(); ctx.moveTo(x, y + 18); ctx.lineTo(x, BOT); ctx.stroke();
470
+ ctx.restore();
471
+ ring(x, y, INK, t, 1.0);
472
+ ring(x, y, INK, t, 3.5);
473
+ dot(x, y, INK, lerp(0.6, 1, sIn), aOut * clamp(sIn * 2));
474
+ }
475
+ }
476
+ // DROP_AT marker dot
477
+ {
478
+ const s = E['back.out(2.2)'](seg(t, 4.95, 5.3));
479
+ const a = 1 - ez('power2.in', t, 6.0, 6.3);
480
+ if (s > 0 && a > 0) {
481
+ const x = SX(c, DROP_AT), y = SY(c, before(DROP_AT));
482
+ ring(x, y, INK, t, 5.0);
483
+ dot(x, y, INK, lerp(0.6, 1, s), a * clamp(s * 2));
484
+ }
485
+ }
486
+ // blue playhead
487
+ if (t >= 6.0) {
488
+ const s = E['back.out(2.2)'](seg(t, 6.0, 6.3));
489
+ const x = SX(c, rxb), y = SY(c, blueVal(t, rxb));
490
+ ring(x, y, BLUE, t, 6.0);
491
+ ring(x, y, BLUE, t, 8.5);
492
+ ring(x, y, BLUE, t, 10.0);
493
+ dot(x, y, BLUE, lerp(0.6, 1, s), clamp(s * 2));
494
+ ctx.save(); ctx.globalAlpha = clamp(s * 2) * (t < 8.5 ? 1 : 1);
495
+ const tl = Math.max(6.0, t - 0.07), cl2 = cam(tl), rb2 = blueTip(tl, cl2);
496
+ const ry = SY(c, blueVal(t, Math.min(rb2, rxb)));
497
+ const atEnd = ez('power3.inOut', t, 8.3, 8.7);
498
+ const ox2 = lerp(24, 30, atEnd), oy2 = lerp(-30, 0, atEnd);
499
+ haloText(`${Math.round(blueVal(t, rxb))}%`, x + ox2, lerp(ry, y, atEnd) + oy2, BLUE, 9);
500
+ ctx.restore();
501
+ }
502
+ // end: ink dot returns + caliper
503
+ {
504
+ const s = E['back.out(2.2)'](seg(t, 8.5, 8.8));
505
+ if (s > 0) {
506
+ const x = SX(c, 600), yb = SY(c, before(600)), ya = SY(c, blueVal(t, 600));
507
+ const ck = ez('power3.out', t, 8.5, 9.0);
508
+ ctx.save();
509
+ ctx.strokeStyle = BLUE; ctx.lineWidth = 3;
510
+ ctx.beginPath(); ctx.moveTo(x, ya); ctx.lineTo(x, lerp(ya, yb, ck)); ctx.stroke();
511
+ ctx.restore();
512
+ ring(x, yb, INK, t, 8.5);
513
+ dot(x, yb, INK, lerp(0.6, 1, s), clamp(s * 2) * lerp(1, 0.75, 1 - inkFade));
514
+ ctx.save(); ctx.globalAlpha = clamp(s * 2) * inkFade;
515
+ haloText(`${Math.round(before(600))}%`, x + 30, yb + 8 * (1 - s), INK, 9);
516
+ ctx.restore();
517
+ }
518
+ }
519
+
520
+ // ----- big serif figure: ink counter during the draw, blue gain at the end -----
521
+ const bigNum = (prefix, n, col, alpha, by, shadowCol) => {
522
+ const rx = 1700;
523
+ ctx.save();
524
+ ctx.globalAlpha = alpha;
525
+ ctx.textBaseline = 'alphabetic'; ctx.textAlign = 'left';
526
+ const big = `400 316px ${SERIF}`, small = `400 150px ${SERIF}`;
527
+ ctx.font = big; const wd = ctx.measureText(String(n)).width;
528
+ ctx.font = small; const wp = prefix ? ctx.measureText(prefix).width + 6 : 0;
529
+ const wpc = ctx.measureText('%').width;
530
+ const x = rx - (wp + wd + wpc + 10);
531
+ ctx.shadowColor = shadowCol; ctx.shadowBlur = 26; ctx.shadowOffsetY = 14;
532
+ ctx.fillStyle = col;
533
+ if (prefix) { ctx.font = small; ctx.fillText(prefix, x, by - 122); }
534
+ ctx.font = big; ctx.fillText(String(n), x + wp, by);
535
+ ctx.font = small; ctx.fillText('%', x + wp + wd + 10, by - 122);
536
+ ctx.restore();
537
+ return x;
538
+ };
539
+ {
540
+ const k = ez('power3.out', t, 1.0, 1.45);
541
+ const out = ez('power2.in', t, 3.55, 3.95);
542
+ if (k > 0 && out < 1) {
543
+ const by = 500 + 30 * (1 - k) - 40 * out;
544
+ bigNum('', Math.round(before(inkReveal)), INK, k * (1 - out), by, 'rgba(60,35,15,0.20)');
545
+ const lk = ez('power3.out', t, 1.2, 1.7);
546
+ ctx.save();
547
+ ctx.globalAlpha = lk * (1 - out);
548
+ ctx.font = `500 34px ${SANS}`; ctx.textAlign = 'right'; ctx.textBaseline = 'alphabetic';
549
+ ctx.fillStyle = 'rgba(26,26,26,0.78)';
550
+ ctx.fillText(LABEL_STILL, 1700, by + 64 + 14 * (1 - lk));
551
+ ctx.restore();
552
+ }
553
+ }
554
+ const nk = ez('power3.out', t, 9.0, 9.5);
555
+ if (nk > 0) {
556
+ const n = Math.round(GAIN_PCT * ez('expo.out', t, 9.0, 10.0));
557
+ const by = 500 + 34 * (1 - nk);
558
+ bigNum('+', n, BLUE, nk, by, 'rgba(15,40,80,0.24)');
559
+ const rk = ez('expo.out', t, 10.0, 10.6);
560
+ if (rk > 0) { ctx.fillStyle = BLUE; ctx.fillRect(1700 - 380 * rk, by + 40, 380 * rk, 4); }
561
+ }
562
+ }
563
+
564
+ const tl = gsap.timeline({ paused: true });
565
+ const p = { t: 0 };
566
+ tl.to(p, { t: DUR, duration: DUR, ease: 'none', onUpdate: () => draw(p.t) }, 0);
567
+ window.__timelines['main'] = tl;
568
+ draw(0);
569
+ tl.seek(0);
570
+ // canvas text needs the web fonts loaded first; redraw once they are in
571
+ Promise.all(['400 88px "Bodoni Moda"', '400 26px "Inter"', '500 40px "Inter"', '700 42px "Inter"']
572
+ .map(f => document.fonts.load(f))).then(() => draw(p.t));
573
+ </script>
574
+ </body>
575
+ </html>
@@ -0,0 +1,68 @@
1
+ # A thumbnail, designed
2
+
3
+ id: design-app-ui
4
+ Best for: "AI designs my thumbnail" demos, design tool launches, layout explainers, poster and ad builds, A/B variant stories.
5
+ Mood: a bright canvas design tool with live collaborators, an AI cursor builds a thumbnail with real design moves, then the winner leaves the app as a feed card.
6
+ Reference piece: none, spec only (the original is built around real footage)
7
+ Gallery video: gallery/videos/design-app-ui.mp4
8
+
9
+ ## Palette (hex)
10
+ - canvas: #EAEAE7 with a dot grid (#CFCFCA dots, 1.1 px)
11
+ - panels: #FFFFFF, hairlines #E6E6E3, shadow 0 6px 20px rgba(0,0,0,0.08)
12
+ - input fields: #F5F5F2 with a 1 px line #E8E8E4
13
+ - text: #1F1F1F (main), #6B6B67 (labels), #A3A39E (dim)
14
+ - collaborator cursors (app chrome, small): teal #2F8C83, violet #6E5FC2
15
+ - thumbnail content (inside the frame only): headline yellow #FFD43B, near black #1F1F1F
16
+ - winner ring: pen red #E5402A, used once
17
+ - accent: #D97757 clay. The ONE accent. AI cursor ring, selection boxes, handles, smart guides, measure pills, layout grid, plan ticks.
18
+
19
+ ## Type
20
+ - Display: Switzer 800 caps for the thumbnail headline (the heaviest weight in the link), tracking -0.03em, line height 0.9
21
+ - Labels: Switzer 600 to 700, 13 to 16 px, dim; measure pills 13 px 700 white on clay
22
+ - Font links (paste into <head>; all fonts are free):
23
+ <link rel="stylesheet" href="https://api.fontshare.com/v2/css?f[]=switzer@400,500,600,700,800&display=swap">
24
+
25
+ ## Easing (numbers)
26
+ - land: expo.out, 0.7 s (floating panels stagger in)
27
+ - leave: power2.in, 0.25 s
28
+ - move: power3.inOut, 0.45 s (camera pushes, cursor moves)
29
+ - pop: back.out(2.2), 0.35 s (new layers, badge, plan ticks back.out(2.6))
30
+ - snap: power3.out, 0.25 s, with a guide flash
31
+ - stagger: 0.07 s panels, 0.06 s type letters
32
+
33
+ ## Motion rules
34
+ - One clock. Our camera, the in-app canvas zoom, all three cursors, typing, drags, snaps, sliders and the hero flight are pure functions of time.
35
+ - Two cameras: our camera flies over the app (with a small tilt from its speed). The app has its own canvas zoom (60 percent down to 22 percent). The zoom label and the dot grid follow it.
36
+ - Counter-scale every overlay (selection lines, handles, guides, pills) by 1 over the canvas zoom, so they stay app-sized at any zoom.
37
+ - App opens tilted (scale 0.80, 16 deg and -13 deg) and settles wide by 1.5 s. Pushes are power3.inOut, about 0.45 s, to scale 1.6 to 2.8, then a slow linear drift hold.
38
+ - Two collaborator cursors drift slowly with name pills (28 px tall). The AI joins as a third: a clay arrow with a dark pill (#1F1F1F, 1.5 px clay ring) holding a spark and its name.
39
+ - Every hit lands on a 0.5 s beat (120 BPM).
40
+
41
+ ## Signature moves
42
+ - The clay selection box: everything the AI makes gets selected with a 2 px clay box, four white handles with clay edges, and a size pill under it (for example 602 x 258).
43
+ - Real design moves: background drops in, the cut-out rises, drop shadow then outer glow are added, a slider drag blooms the glow, the headline types in huge caps.
44
+ - Snapping: a 12 column layout grid fades in, the cursor drags the headline, X snaps then Y snaps with clay guides and distance pills.
45
+ - Variants and the pick: pull back, duplicate, copies slide left and right, swap backgrounds and headline colour, a red ring is drawn round the winner, the others dim.
46
+ - The fly out: the winner hands off pixel exact to a screen copy, lifts out with a 3D tilt, and lands as a 1440x810 feed card with avatar, title and a views line that counts up. The cursor hovers, the card lifts.
47
+
48
+ ## Composition
49
+ - Floating white panels: Layers left, Design properties right, AI panel far right (prompt plus a six-step plan). A tool pill floats at the bottom centre (388x52, radius 14). A slim title bar with avatars.
50
+ - The thumbnail frame sits centre canvas, 16:9, labelled "Thumbnail" in dim 13 px text above it.
51
+ - Inside the thumbnail: headline left, subject right, badge top left, an arrow pointing at the subject.
52
+ - Finish: the feed card fills the frame on light grey, neighbour cards peek in at the sides, slow push to the end.
53
+
54
+ ## With media
55
+ - The person's cut-out photo (a PNG with alpha) is the subject. Their still or clip is the background.
56
+ - Variant backgrounds can be live clips, so the copies move.
57
+ - Their portrait is the channel avatar on the feed card.
58
+ - Keep the headline, badge and arrow off the face box. Check it on every held frame.
59
+ - No media? Use flat SVG art (a valley, an island at dusk) and a plain grey bust silhouette.
60
+
61
+ ## Ban list
62
+ - real design tool names, logos or brand colours
63
+ - a dark theme (this look is light)
64
+ - overlays that grow or shrink with the canvas zoom
65
+ - the red used anywhere but the winner ring
66
+ - text, badge or arrow on a face
67
+ - a cursor parked on the headline at the reveal
68
+ - noisy dot grid when zoomed out (fade it as the zoom drops)