@bydiorama/motion 0.0.0-stage → 0.4.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 (354) hide show
  1. package/CREDITS.md +62 -0
  2. package/LICENSE +21 -0
  3. package/README.md +142 -2
  4. package/catalog.json +4697 -0
  5. package/dist/npm/brief/brief.d.ts +28 -0
  6. package/dist/npm/brief/brief.js +159 -0
  7. package/dist/npm/brief/types.d.ts +75 -0
  8. package/dist/npm/brief/types.js +2 -0
  9. package/dist/npm/browser/motion.js +1039 -0
  10. package/dist/npm/browser/page.js +4821 -0
  11. package/dist/npm/browser/wizard.js +1511 -0
  12. package/dist/npm/build/design.d.ts +54 -0
  13. package/dist/npm/build/design.js +91 -0
  14. package/dist/npm/build/index.d.ts +39 -0
  15. package/dist/npm/build/index.js +66 -0
  16. package/dist/npm/build/iso.d.ts +41 -0
  17. package/dist/npm/build/iso.js +71 -0
  18. package/dist/npm/catalog.d.ts +24 -0
  19. package/dist/npm/catalog.js +23 -0
  20. package/dist/npm/cli/browser.d.ts +26 -0
  21. package/dist/npm/cli/browser.js +66 -0
  22. package/dist/npm/cli/capture.d.ts +26 -0
  23. package/dist/npm/cli/capture.js +94 -0
  24. package/dist/npm/cli/files.d.ts +14 -0
  25. package/dist/npm/cli/files.js +87 -0
  26. package/dist/npm/cli/frames.d.ts +27 -0
  27. package/dist/npm/cli/frames.js +125 -0
  28. package/dist/npm/cli/guard.d.ts +23 -0
  29. package/dist/npm/cli/guard.js +158 -0
  30. package/dist/npm/cli/library.d.ts +2 -0
  31. package/dist/npm/cli/library.js +55 -0
  32. package/dist/npm/cli/main.d.ts +17 -0
  33. package/dist/npm/cli/main.js +964 -0
  34. package/dist/npm/cli/motion.d.ts +2 -0
  35. package/dist/npm/cli/motion.js +6 -0
  36. package/dist/npm/cli/record.d.ts +36 -0
  37. package/dist/npm/cli/record.js +142 -0
  38. package/dist/npm/cli/review.d.ts +45 -0
  39. package/dist/npm/cli/review.js +139 -0
  40. package/dist/npm/cli/schema.d.ts +852 -0
  41. package/dist/npm/cli/schema.js +120 -0
  42. package/dist/npm/cli/server.d.ts +17 -0
  43. package/dist/npm/cli/server.js +135 -0
  44. package/dist/npm/core/ease.d.ts +39 -0
  45. package/dist/npm/core/ease.js +176 -0
  46. package/dist/npm/core/frame.d.ts +52 -0
  47. package/dist/npm/core/frame.js +60 -0
  48. package/dist/npm/core/shapes.d.ts +8 -0
  49. package/dist/npm/core/shapes.js +88 -0
  50. package/dist/npm/core/stagger.d.ts +19 -0
  51. package/dist/npm/core/stagger.js +77 -0
  52. package/dist/npm/core/tap.d.ts +19 -0
  53. package/dist/npm/core/tap.js +42 -0
  54. package/dist/npm/core/track.d.ts +4 -0
  55. package/dist/npm/core/track.js +23 -0
  56. package/dist/npm/dom/mount.d.ts +127 -0
  57. package/dist/npm/dom/mount.js +950 -0
  58. package/dist/npm/dom/page.d.ts +37 -0
  59. package/dist/npm/dom/page.js +77 -0
  60. package/dist/npm/dom/soundtrack.d.ts +13 -0
  61. package/dist/npm/dom/soundtrack.js +37 -0
  62. package/dist/npm/dom/stage.css.d.ts +1 -0
  63. package/dist/npm/dom/stage.css.js +44 -0
  64. package/dist/npm/dom/tokens.d.ts +10 -0
  65. package/dist/npm/dom/tokens.js +38 -0
  66. package/dist/npm/dom/ui-themes.css.d.ts +8 -0
  67. package/dist/npm/dom/ui-themes.css.js +9 -0
  68. package/dist/npm/film/beats.d.ts +64 -0
  69. package/dist/npm/film/beats.js +282 -0
  70. package/dist/npm/film/pace.d.ts +94 -0
  71. package/dist/npm/film/pace.js +396 -0
  72. package/dist/npm/film/resolve.d.ts +16 -0
  73. package/dist/npm/film/resolve.js +997 -0
  74. package/dist/npm/film/tempo.d.ts +19 -0
  75. package/dist/npm/film/tempo.js +34 -0
  76. package/dist/npm/film/tune.d.ts +17 -0
  77. package/dist/npm/film/tune.js +68 -0
  78. package/dist/npm/film/types.d.ts +416 -0
  79. package/dist/npm/film/types.js +16 -0
  80. package/dist/npm/index.d.ts +18 -0
  81. package/dist/npm/index.js +11 -0
  82. package/dist/npm/primitives/blur.d.ts +14 -0
  83. package/dist/npm/primitives/blur.js +59 -0
  84. package/dist/npm/primitives/canvas.d.ts +5 -0
  85. package/dist/npm/primitives/canvas.js +13 -0
  86. package/dist/npm/primitives/el/box.d.ts +2 -0
  87. package/dist/npm/primitives/el/box.js +24 -0
  88. package/dist/npm/primitives/el/frames.d.ts +15 -0
  89. package/dist/npm/primitives/el/frames.js +71 -0
  90. package/dist/npm/primitives/el/html.d.ts +2 -0
  91. package/dist/npm/primitives/el/html.js +14 -0
  92. package/dist/npm/primitives/el/image.d.ts +2 -0
  93. package/dist/npm/primitives/el/image.js +43 -0
  94. package/dist/npm/primitives/el/slot.d.ts +2 -0
  95. package/dist/npm/primitives/el/slot.js +25 -0
  96. package/dist/npm/primitives/el/text.d.ts +2 -0
  97. package/dist/npm/primitives/el/text.js +13 -0
  98. package/dist/npm/primitives/el/video.d.ts +6 -0
  99. package/dist/npm/primitives/el/video.js +179 -0
  100. package/dist/npm/primitives/fx/counter-roll.d.ts +2 -0
  101. package/dist/npm/primitives/fx/counter-roll.js +32 -0
  102. package/dist/npm/primitives/fx/depth-drift.d.ts +2 -0
  103. package/dist/npm/primitives/fx/depth-drift.js +44 -0
  104. package/dist/npm/primitives/fx/grid-ripple.d.ts +2 -0
  105. package/dist/npm/primitives/fx/grid-ripple.js +59 -0
  106. package/dist/npm/primitives/fx/odometer.d.ts +2 -0
  107. package/dist/npm/primitives/fx/odometer.js +80 -0
  108. package/dist/npm/primitives/fx/pan-across.d.ts +17 -0
  109. package/dist/npm/primitives/fx/pan-across.js +76 -0
  110. package/dist/npm/primitives/fx/path-draw.d.ts +2 -0
  111. package/dist/npm/primitives/fx/path-draw.js +105 -0
  112. package/dist/npm/primitives/fx/pin-drop.d.ts +2 -0
  113. package/dist/npm/primitives/fx/pin-drop.js +92 -0
  114. package/dist/npm/primitives/fx/shape-morph.d.ts +2 -0
  115. package/dist/npm/primitives/fx/shape-morph.js +65 -0
  116. package/dist/npm/primitives/fx/slow-push.d.ts +13 -0
  117. package/dist/npm/primitives/fx/slow-push.js +56 -0
  118. package/dist/npm/primitives/fx/stagger-fill.d.ts +2 -0
  119. package/dist/npm/primitives/fx/stagger-fill.js +33 -0
  120. package/dist/npm/primitives/index.d.ts +4 -0
  121. package/dist/npm/primitives/index.js +78 -0
  122. package/dist/npm/primitives/rig/browser-window.d.ts +2 -0
  123. package/dist/npm/primitives/rig/browser-window.js +142 -0
  124. package/dist/npm/primitives/rig/camera.d.ts +36 -0
  125. package/dist/npm/primitives/rig/camera.js +81 -0
  126. package/dist/npm/primitives/rig/footage-plane.d.ts +27 -0
  127. package/dist/npm/primitives/rig/footage-plane.js +257 -0
  128. package/dist/npm/primitives/rig/layer-stack.d.ts +39 -0
  129. package/dist/npm/primitives/rig/layer-stack.js +276 -0
  130. package/dist/npm/primitives/rig/orbit-ring.d.ts +2 -0
  131. package/dist/npm/primitives/rig/orbit-ring.js +59 -0
  132. package/dist/npm/primitives/rig/tab-stack.d.ts +9 -0
  133. package/dist/npm/primitives/rig/tab-stack.js +143 -0
  134. package/dist/npm/primitives/scene/bar-chart.d.ts +2 -0
  135. package/dist/npm/primitives/scene/bar-chart.js +83 -0
  136. package/dist/npm/primitives/scene/bento-grid.d.ts +49 -0
  137. package/dist/npm/primitives/scene/bento-grid.js +293 -0
  138. package/dist/npm/primitives/scene/grid-wall.d.ts +18 -0
  139. package/dist/npm/primitives/scene/grid-wall.js +110 -0
  140. package/dist/npm/primitives/scene/line-chart.d.ts +2 -0
  141. package/dist/npm/primitives/scene/line-chart.js +121 -0
  142. package/dist/npm/primitives/scene/logo-reveal.d.ts +2 -0
  143. package/dist/npm/primitives/scene/logo-reveal.js +117 -0
  144. package/dist/npm/primitives/scene/marquee-wall.d.ts +2 -0
  145. package/dist/npm/primitives/scene/marquee-wall.js +82 -0
  146. package/dist/npm/primitives/scene/post-carousel.d.ts +16 -0
  147. package/dist/npm/primitives/scene/post-carousel.js +195 -0
  148. package/dist/npm/primitives/scene/strip-cycle.d.ts +49 -0
  149. package/dist/npm/primitives/scene/strip-cycle.js +237 -0
  150. package/dist/npm/primitives/split.d.ts +34 -0
  151. package/dist/npm/primitives/split.js +105 -0
  152. package/dist/npm/primitives/texture/beat-field.d.ts +13 -0
  153. package/dist/npm/primitives/texture/beat-field.js +113 -0
  154. package/dist/npm/primitives/texture/gradient-drift.d.ts +2 -0
  155. package/dist/npm/primitives/texture/gradient-drift.js +56 -0
  156. package/dist/npm/primitives/texture/grain.d.ts +2 -0
  157. package/dist/npm/primitives/texture/grain.js +54 -0
  158. package/dist/npm/primitives/texture/halftone-field.d.ts +2 -0
  159. package/dist/npm/primitives/texture/halftone-field.js +36 -0
  160. package/dist/npm/primitives/texture/signal-field.d.ts +4 -0
  161. package/dist/npm/primitives/texture/signal-field.js +107 -0
  162. package/dist/npm/primitives/texture/vignette.d.ts +2 -0
  163. package/dist/npm/primitives/texture/vignette.js +23 -0
  164. package/dist/npm/primitives/transition/band-sweep.d.ts +22 -0
  165. package/dist/npm/primitives/transition/band-sweep.js +111 -0
  166. package/dist/npm/primitives/transition/beat-cut.d.ts +2 -0
  167. package/dist/npm/primitives/transition/beat-cut.js +10 -0
  168. package/dist/npm/primitives/transition/blur-dissolve.d.ts +2 -0
  169. package/dist/npm/primitives/transition/blur-dissolve.js +28 -0
  170. package/dist/npm/primitives/transition/camera-travel.d.ts +2 -0
  171. package/dist/npm/primitives/transition/camera-travel.js +69 -0
  172. package/dist/npm/primitives/transition/cover-reveal.d.ts +2 -0
  173. package/dist/npm/primitives/transition/cover-reveal.js +52 -0
  174. package/dist/npm/primitives/transition/curtain.d.ts +2 -0
  175. package/dist/npm/primitives/transition/curtain.js +40 -0
  176. package/dist/npm/primitives/transition/dive-in.d.ts +2 -0
  177. package/dist/npm/primitives/transition/dive-in.js +52 -0
  178. package/dist/npm/primitives/transition/fly-past.d.ts +2 -0
  179. package/dist/npm/primitives/transition/fly-past.js +87 -0
  180. package/dist/npm/primitives/transition/iris.d.ts +2 -0
  181. package/dist/npm/primitives/transition/iris.js +38 -0
  182. package/dist/npm/primitives/transition/overlay.d.ts +4 -0
  183. package/dist/npm/primitives/transition/overlay.js +24 -0
  184. package/dist/npm/primitives/transition/push.d.ts +2 -0
  185. package/dist/npm/primitives/transition/push.js +35 -0
  186. package/dist/npm/primitives/transition/signal-wipe.d.ts +2 -0
  187. package/dist/npm/primitives/transition/signal-wipe.js +67 -0
  188. package/dist/npm/primitives/transition/slant-wipe.d.ts +2 -0
  189. package/dist/npm/primitives/transition/slant-wipe.js +30 -0
  190. package/dist/npm/primitives/transition/stack-over.d.ts +2 -0
  191. package/dist/npm/primitives/transition/stack-over.js +38 -0
  192. package/dist/npm/primitives/transition/step-wipe.d.ts +2 -0
  193. package/dist/npm/primitives/transition/step-wipe.js +29 -0
  194. package/dist/npm/primitives/transition/strip-wipe.d.ts +40 -0
  195. package/dist/npm/primitives/transition/strip-wipe.js +121 -0
  196. package/dist/npm/primitives/transition/whip-pan.d.ts +2 -0
  197. package/dist/npm/primitives/transition/whip-pan.js +45 -0
  198. package/dist/npm/primitives/type/block-reveal.d.ts +2 -0
  199. package/dist/npm/primitives/type/block-reveal.js +61 -0
  200. package/dist/npm/primitives/type/char-cascade.d.ts +2 -0
  201. package/dist/npm/primitives/type/char-cascade.js +45 -0
  202. package/dist/npm/primitives/type/echo.d.ts +2 -0
  203. package/dist/npm/primitives/type/echo.js +57 -0
  204. package/dist/npm/primitives/type/fill-text.d.ts +14 -0
  205. package/dist/npm/primitives/type/fill-text.js +82 -0
  206. package/dist/npm/primitives/type/mask-reveal.d.ts +2 -0
  207. package/dist/npm/primitives/type/mask-reveal.js +58 -0
  208. package/dist/npm/primitives/type/scramble.d.ts +2 -0
  209. package/dist/npm/primitives/type/scramble.js +34 -0
  210. package/dist/npm/primitives/type/scribble-highlight.d.ts +2 -0
  211. package/dist/npm/primitives/type/scribble-highlight.js +84 -0
  212. package/dist/npm/primitives/type/shimmer.d.ts +2 -0
  213. package/dist/npm/primitives/type/shimmer.js +35 -0
  214. package/dist/npm/primitives/type/tracking-in.d.ts +2 -0
  215. package/dist/npm/primitives/type/tracking-in.js +37 -0
  216. package/dist/npm/primitives/type/typed-title.d.ts +2 -0
  217. package/dist/npm/primitives/type/typed-title.js +33 -0
  218. package/dist/npm/primitives/type/word-build.d.ts +2 -0
  219. package/dist/npm/primitives/type/word-build.js +44 -0
  220. package/dist/npm/primitives/type/word-roller.d.ts +2 -0
  221. package/dist/npm/primitives/type/word-roller.js +80 -0
  222. package/dist/npm/primitives/types.d.ts +183 -0
  223. package/dist/npm/primitives/types.js +5 -0
  224. package/dist/npm/primitives/ui/cursor-click.d.ts +4 -0
  225. package/dist/npm/primitives/ui/cursor-click.js +68 -0
  226. package/dist/npm/primitives/ui/page-scroll.d.ts +17 -0
  227. package/dist/npm/primitives/ui/page-scroll.js +98 -0
  228. package/dist/npm/review/fft.d.ts +4 -0
  229. package/dist/npm/review/fft.js +71 -0
  230. package/dist/npm/review/measure.d.ts +170 -0
  231. package/dist/npm/review/measure.js +577 -0
  232. package/dist/npm/tokens.d.ts +50 -0
  233. package/dist/npm/tokens.js +49 -0
  234. package/dist/npm/version.d.ts +1 -0
  235. package/dist/npm/version.js +1 -0
  236. package/examples/builder.film.mjs +18 -0
  237. package/films/feature-announcement.film.json +70 -0
  238. package/library/narratives/app-demo.md +64 -0
  239. package/library/narratives/brand-identity.md +78 -0
  240. package/library/narratives/capability-through-type.md +53 -0
  241. package/library/narratives/data-story.md +59 -0
  242. package/library/narratives/explainer.md +64 -0
  243. package/library/narratives/feature-announcement.md +68 -0
  244. package/library/narratives/infinite-loop.md +28 -0
  245. package/library/narratives/platform-launch.md +81 -0
  246. package/library/narratives/social-teaser.md +45 -0
  247. package/library/narratives/title-sequence.md +55 -0
  248. package/library/narratives/website-launch.md +65 -0
  249. package/library/primitives/fx/card-arrangements.md +26 -0
  250. package/library/primitives/fx/counter-roll.md +27 -0
  251. package/library/primitives/fx/depth-drift.md +32 -0
  252. package/library/primitives/fx/grid-ripple.md +58 -0
  253. package/library/primitives/fx/letter-interleave.md +26 -0
  254. package/library/primitives/fx/marquee-highlight.md +27 -0
  255. package/library/primitives/fx/mosaic-fill.md +23 -0
  256. package/library/primitives/fx/odometer.md +44 -0
  257. package/library/primitives/fx/pan-across.md +63 -0
  258. package/library/primitives/fx/path-draw.md +54 -0
  259. package/library/primitives/fx/pin-drop.md +51 -0
  260. package/library/primitives/fx/radial-burst.md +33 -0
  261. package/library/primitives/fx/shape-morph.md +45 -0
  262. package/library/primitives/fx/slow-push.md +63 -0
  263. package/library/primitives/fx/stagger-fill.md +28 -0
  264. package/library/primitives/rig/browser-window.md +113 -0
  265. package/library/primitives/rig/flip-ticker.md +26 -0
  266. package/library/primitives/rig/footage-plane.md +90 -0
  267. package/library/primitives/rig/layer-stack.md +168 -0
  268. package/library/primitives/rig/orbit-ring.md +43 -0
  269. package/library/primitives/rig/rolodex.md +31 -0
  270. package/library/primitives/rig/tab-stack.md +116 -0
  271. package/library/primitives/rig/tumbling-object.md +27 -0
  272. package/library/primitives/scene/bar-chart.md +49 -0
  273. package/library/primitives/scene/bento-grid.md +74 -0
  274. package/library/primitives/scene/end-card.md +28 -0
  275. package/library/primitives/scene/grid-wall.md +61 -0
  276. package/library/primitives/scene/hero-object.md +33 -0
  277. package/library/primitives/scene/kinetic-headline.md +34 -0
  278. package/library/primitives/scene/line-chart.md +47 -0
  279. package/library/primitives/scene/logo-reveal.md +53 -0
  280. package/library/primitives/scene/marquee-wall.md +33 -0
  281. package/library/primitives/scene/mosaic.md +28 -0
  282. package/library/primitives/scene/post-carousel.md +68 -0
  283. package/library/primitives/scene/specimen-grid.md +28 -0
  284. package/library/primitives/scene/stat-with-evidence.md +34 -0
  285. package/library/primitives/scene/strip-cycle.md +122 -0
  286. package/library/primitives/scene/zoomed-ui.md +29 -0
  287. package/library/primitives/texture/ascii.md +22 -0
  288. package/library/primitives/texture/beat-field.md +85 -0
  289. package/library/primitives/texture/depth-fade.md +23 -0
  290. package/library/primitives/texture/dither.md +27 -0
  291. package/library/primitives/texture/gradient-drift.md +50 -0
  292. package/library/primitives/texture/grain.md +39 -0
  293. package/library/primitives/texture/halftone-field.md +26 -0
  294. package/library/primitives/texture/signal-field.md +61 -0
  295. package/library/primitives/texture/vignette.md +53 -0
  296. package/library/primitives/transition/band-sweep.md +63 -0
  297. package/library/primitives/transition/beat-cut.md +27 -0
  298. package/library/primitives/transition/blur-dissolve.md +36 -0
  299. package/library/primitives/transition/camera-travel.md +57 -0
  300. package/library/primitives/transition/collapse-to-anchor.md +27 -0
  301. package/library/primitives/transition/cover-reveal.md +47 -0
  302. package/library/primitives/transition/curtain.md +42 -0
  303. package/library/primitives/transition/dive-in.md +51 -0
  304. package/library/primitives/transition/fly-past.md +51 -0
  305. package/library/primitives/transition/iris.md +49 -0
  306. package/library/primitives/transition/layout-locked-swap.md +28 -0
  307. package/library/primitives/transition/light-dark-flip.md +27 -0
  308. package/library/primitives/transition/push.md +47 -0
  309. package/library/primitives/transition/signal-wipe.md +52 -0
  310. package/library/primitives/transition/slant-wipe.md +44 -0
  311. package/library/primitives/transition/stack-over.md +51 -0
  312. package/library/primitives/transition/step-wipe.md +32 -0
  313. package/library/primitives/transition/strip-wipe.md +80 -0
  314. package/library/primitives/transition/torn-edge.md +26 -0
  315. package/library/primitives/transition/whip-pan.md +47 -0
  316. package/library/primitives/transition/zoom-through-letter.md +27 -0
  317. package/library/primitives/type/accent-number.md +22 -0
  318. package/library/primitives/type/block-reveal.md +41 -0
  319. package/library/primitives/type/char-cascade.md +65 -0
  320. package/library/primitives/type/echo.md +44 -0
  321. package/library/primitives/type/fill-text.md +63 -0
  322. package/library/primitives/type/focus-blur.md +22 -0
  323. package/library/primitives/type/inline-chips.md +27 -0
  324. package/library/primitives/type/mask-reveal.md +65 -0
  325. package/library/primitives/type/parting.md +23 -0
  326. package/library/primitives/type/per-word-restyle.md +28 -0
  327. package/library/primitives/type/scramble.md +26 -0
  328. package/library/primitives/type/scribble-highlight.md +47 -0
  329. package/library/primitives/type/shimmer.md +39 -0
  330. package/library/primitives/type/split-flap.md +26 -0
  331. package/library/primitives/type/style-multiply.md +23 -0
  332. package/library/primitives/type/tracking-in.md +40 -0
  333. package/library/primitives/type/typed-title.md +27 -0
  334. package/library/primitives/type/word-build.md +37 -0
  335. package/library/primitives/type/word-roller.md +52 -0
  336. package/library/primitives/type/writing-ticker.md +27 -0
  337. package/library/primitives/ui/collab-cursors.md +27 -0
  338. package/library/primitives/ui/cursor-click.md +61 -0
  339. package/library/primitives/ui/page-scroll.md +58 -0
  340. package/library/primitives/ui/prompt-typing.md +29 -0
  341. package/library/primitives/ui/streamed-result.md +23 -0
  342. package/library/primitives/ui/tour-hold.md +27 -0
  343. package/library/styles/brand-system.md +49 -0
  344. package/library/styles/clean-explainer.md +42 -0
  345. package/library/styles/dark-showcase.md +48 -0
  346. package/library/styles/editorial-type.md +37 -0
  347. package/library/styles/kinetic-poster.md +54 -0
  348. package/library/styles/product-ui.md +44 -0
  349. package/library/styles/studio-loop.md +41 -0
  350. package/library.json +1467 -0
  351. package/package.json +64 -4
  352. package/schema/film.schema.json +1316 -0
  353. package/showcase/vendor/DIALKIT-LICENSE +21 -0
  354. package/src/studio/theme/fonts/OFL.txt +94 -0
@@ -0,0 +1,36 @@
1
+ // texture/halftone-field. See library/primitives/texture/halftone-field.md.
2
+ import { progress } from "../../core/ease.js";
3
+ import { num, str } from "../types.js";
4
+ export const halftoneField = {
5
+ slug: 'texture/halftone-field',
6
+ summary: 'Squares or dots sized by a gradient.',
7
+ props: { edge: { type: 'string', default: 'top', label: 'Edge the field grows from: top or bottom' } },
8
+ params: {
9
+ cell: { type: 'number', default: 12, min: 8, max: 20, step: 1, unit: 'px', label: 'Cell size' },
10
+ grow: { type: 'number', default: 1.6, min: 0, max: 4, step: 0.1, unit: 's', label: 'Time to grow in' },
11
+ reach: { type: 'number', default: 0.6, min: 0.2, max: 1, step: 0.02, unit: 'ratio', label: 'How far into the frame it reaches' },
12
+ strength: { type: 'number', default: 1, min: 0, max: 1, step: 0.05, unit: 'ratio', label: 'Opacity' },
13
+ },
14
+ duration: (_props, p) => num(p.grow),
15
+ build(el, props, p, ctx) {
16
+ const ease = ctx.ease(ctx.tokens.ease_enter);
17
+ // The entry counts cells on a 1080-wide master; scale them with the stage.
18
+ const cell = num(p.cell) * (ctx.size[0] / 1080) * 1.6, grow = num(p.grow), reach = num(p.reach);
19
+ el.style.cssText += ';position:absolute;inset:0;max-width:none;pointer-events:none';
20
+ // Accent colour plus one grey, on two offset grids. Drawn on a child, so the
21
+ // layer's own enter, exit and tracks stay free to move it.
22
+ const field = document.createElement('div');
23
+ field.style.cssText = `position:absolute;inset:0;opacity:${num(p.strength)};` +
24
+ `background-image:radial-gradient(circle, var(--m-accent) ${cell * 0.13}px, transparent ${cell * 0.15}px),radial-gradient(circle, var(--m-text-muted) ${cell * 0.08}px, transparent ${cell * 0.1}px);` +
25
+ `background-size:${cell}px ${cell}px;background-position:0 0, ${cell / 2}px ${cell / 2}px${str(props.edge) === 'bottom' ? ';transform:scaleY(-1)' : ''}`;
26
+ el.appendChild(field);
27
+ return {
28
+ seek(t) {
29
+ const k = progress(t, 0, grow, ease) * reach;
30
+ const mask = `radial-gradient(ellipse 62% 52% at 50% -6%, #000 0%, transparent ${k * 100}%)`;
31
+ field.style.maskImage = mask;
32
+ field.style.setProperty('-webkit-mask-image', mask);
33
+ },
34
+ };
35
+ },
36
+ };
@@ -0,0 +1,4 @@
1
+ import { type Primitive } from '../types.ts';
2
+ /** Deterministic hash noise in [0, 1). */
3
+ export declare const hash: (a: number, b?: number) => number;
4
+ export declare const signalField: Primitive;
@@ -0,0 +1,107 @@
1
+ // texture/signal-field. See library/primitives/texture/signal-field.md.
2
+ //
3
+ // Signal out of noise: points jitter like static, torn now and then by a glitch
4
+ // band, then fall into a calm dot grid from the centre out. Once in order, a slow
5
+ // pulse travels down the grid, so the field never goes dead still. The field is
6
+ // drawn on a canvas; jitter is hashed from the frame number, so every frame is
7
+ // the same each time it is drawn.
8
+ import { clamp, lerp } from "../../core/ease.js";
9
+ import { fitBitmap } from "../canvas.js";
10
+ import { num } from "../types.js";
11
+ /** Deterministic hash noise in [0, 1). */
12
+ export const hash = (a, b = 0) => {
13
+ let h = Math.imul(a | 0, 0x27d4eb2d) ^ Math.imul((b | 0) + 0x9e3779b9, 0x85ebca6b);
14
+ h = Math.imul(h ^ (h >>> 15), 0x2c1b3c6d);
15
+ h = Math.imul(h ^ (h >>> 12), 0x297a2d39);
16
+ return ((h ^ (h >>> 15)) >>> 0) / 4294967296;
17
+ };
18
+ const inOut = (p) => (p < 0.5 ? 4 * p * p * p : 1 - (-2 * p + 2) ** 3 / 2);
19
+ /** A colour as the page resolves it (theme variables, light-dark()), read from a probe. */
20
+ function resolved(el, css) {
21
+ const probe = el.ownerDocument.createElement('span');
22
+ probe.style.color = css;
23
+ probe.style.display = 'none';
24
+ el.appendChild(probe);
25
+ const c = getComputedStyle(probe).color;
26
+ probe.remove();
27
+ return c;
28
+ }
29
+ /** `rgb(r, g, b)` as `r,g,b`, ready for an alpha. */
30
+ const channels = (rgb) => (rgb.match(/[\d.]+/g)?.slice(0, 3) ?? ['255', '255', '255']).join(',');
31
+ export const signalField = {
32
+ slug: 'texture/signal-field',
33
+ summary: 'Points jitter like static, then fall into a calm dot grid from the centre out.',
34
+ props: {},
35
+ params: {
36
+ cols: { type: 'number', default: 36, min: 16, max: 60, step: 1, unit: 'columns', label: 'Columns of the grid (rows follow the frame)' },
37
+ settle_at: { type: 'number', default: 0.6, min: 0, max: 4, step: 0.05, unit: 's', label: 'When the noise starts to settle' },
38
+ settle: { type: 'number', default: 1.2, min: 0.4, max: 3, step: 0.05, unit: 's', label: 'How long it takes to fall into the grid' },
39
+ jitter: { type: 'number', default: 26, min: 0, max: 60, step: 1, unit: 'px', label: 'How hard the static shakes' },
40
+ glitch: { type: 'number', default: 0.55, min: 0, max: 1, step: 0.05, unit: 'ratio', label: 'How often a glitch band tears the noise' },
41
+ pulse: { type: 'number', default: 0.5, min: 0, max: 1, step: 0.05, unit: 'ratio', label: 'Strength of the pulse that travels the grid once in order' },
42
+ accent: { type: 'number', default: 0.07, min: 0, max: 0.2, step: 0.01, unit: 'share', label: 'Share of points in the accent colour' },
43
+ },
44
+ duration: (_props, p) => num(p.settle_at) + num(p.settle),
45
+ build(el, _props, p, ctx) {
46
+ const doc = el.ownerDocument;
47
+ const [W, H] = ctx.size, u = W / 1080, fps = ctx.fps || 30;
48
+ el.style.cssText += ';position:absolute;inset:0;max-width:none;pointer-events:none';
49
+ const canvas = doc.createElement('canvas');
50
+ canvas.style.cssText = `position:absolute;left:0;top:0;width:${W}px;height:${H}px`;
51
+ el.appendChild(canvas);
52
+ const g = canvas.getContext('2d');
53
+ const ink = channels(resolved(el, 'currentColor')), accent = channels(resolved(el, 'var(--m-accent)'));
54
+ const GX = Math.max(2, Math.round(num(p.cols))), GY = Math.max(2, Math.round((GX * H) / W));
55
+ const cells = GX * GY, NP = Math.round(cells * 1.6), seed = ctx.seed * 7919;
56
+ const maxD = Math.hypot(W / 2, H / 2);
57
+ const accentShare = num(p.accent);
58
+ const parts = Array.from({ length: NP }, (_, i) => {
59
+ const c = i % cells, k = i + seed;
60
+ const gx = ((c % GX) + 0.5) * (W / GX), gy = (Math.floor(c / GX) + 0.5) * (H / GY);
61
+ return {
62
+ x: hash(k, 1) * W, y: hash(k, 2) * H, vx: (hash(k, 3) - 0.5) * 40 * u, vy: (hash(k, 4) - 0.5) * 24 * u,
63
+ gx, gy, d: Math.hypot(gx - W / 2, gy - H / 2) / maxD,
64
+ r: (0.7 + hash(k, 5) * 1.5) * u, a: 0.18 + hash(k, 6) * 0.5, hot: hash(k, 7) < accentShare,
65
+ };
66
+ });
67
+ const t0 = num(p.settle_at), span = Math.max(0.01, num(p.settle));
68
+ const jit = num(p.jitter) * u, glitch = num(p.glitch), pulse = num(p.pulse);
69
+ return {
70
+ seek(t) {
71
+ if (!g)
72
+ return;
73
+ const f = Math.round(t * fps);
74
+ fitBitmap(canvas, g, ctx.size, ctx);
75
+ g.clearRect(0, 0, W, H);
76
+ const order = inOut(clamp((t - t0) / span));
77
+ const shake = (1 - order) ** 1.5;
78
+ // A glitch band, re-rolled every 5 frames while the field is still noise.
79
+ const b = Math.floor(f / 5) + seed;
80
+ const bandY = hash(b, 11) * H, bandH = (20 + hash(b, 12) * 120) * u;
81
+ const bandDX = (hash(b, 13) - 0.5) * 140 * u * shake * (hash(b, 14) < glitch ? 1 : 0);
82
+ for (let i = 0; i < NP; i++) {
83
+ const q = parts[i], k = i + seed;
84
+ let nx = (q.x + q.vx * t + (hash(k, f) - 0.5) * jit * shake) % W;
85
+ let ny = (q.y + q.vy * t + (hash(k, f + 7777) - 0.5) * jit * shake) % H;
86
+ if (nx < 0)
87
+ nx += W;
88
+ if (ny < 0)
89
+ ny += H;
90
+ if (ny > bandY && ny < bandY + bandH)
91
+ nx += bandDX;
92
+ // Settles from the centre out.
93
+ const o = inOut(clamp(order * 1.35 - q.d * 0.35));
94
+ const x = lerp(nx, q.gx + Math.sin(t * 0.8 + q.gy * 0.01) * 2 * u, o);
95
+ const y = lerp(ny, q.gy, o);
96
+ // Once in order, a slow pulse travels down the grid.
97
+ const wave = Math.max(0, Math.sin((q.gy / H) * 7 - t * 3.2)) ** 6 * o * pulse;
98
+ const flick = lerp(0.35 + hash(k, f + 3) * 0.9, 0.55, o);
99
+ const a = lerp(q.a * flick * 1.25, 0.17 + wave, o);
100
+ const r = lerp(q.r, 1.05 * u, o);
101
+ g.fillStyle = `rgba(${q.hot ? accent : ink},${clamp(q.hot ? a * 1.6 : a).toFixed(3)})`;
102
+ g.fillRect(x - r, y - r, r * 2, r * 2);
103
+ }
104
+ },
105
+ };
106
+ },
107
+ };
@@ -0,0 +1,2 @@
1
+ import { type Primitive } from '../types.ts';
2
+ export declare const vignette: Primitive;
@@ -0,0 +1,23 @@
1
+ // texture/vignette. See library/primitives/texture/vignette.md.
2
+ import { num } from "../types.js";
3
+ export const vignette = {
4
+ slug: 'texture/vignette',
5
+ summary: 'The frame darkens towards its edges, holding the eye on the middle. Fixed to the screen.',
6
+ props: { color: { type: 'string', default: '#000000', label: 'CSS colour the edges darken to' } },
7
+ params: {
8
+ inner: { type: 'number', default: 48, min: 0, max: 90, step: 1, unit: '%', label: 'Where the darkening starts, from the centre to the corner' },
9
+ outer: { type: 'number', default: 82, min: 10, max: 100, step: 1, unit: '%', label: 'Where it reaches its middle strength' },
10
+ strength: { type: 'number', default: 0.85, min: 0, max: 1, step: 0.05, unit: 'ratio', label: 'Opacity at the corners' },
11
+ mid: { type: 'number', default: 0.55, min: 0, max: 1, step: 0.05, unit: 'ratio', label: 'Opacity at `outer`' },
12
+ center_x: { type: 'number', default: 50, min: 0, max: 100, step: 1, unit: '%', label: 'Centre, across' },
13
+ center_y: { type: 'number', default: 46, min: 0, max: 100, step: 1, unit: '%', label: 'Centre, down: a little above the middle reads as level' },
14
+ },
15
+ // Ambient: there for as long as the scene.
16
+ duration: () => 0,
17
+ build(el, props, p) {
18
+ const c = String(props.color ?? '#000000');
19
+ const at = (k) => `color-mix(in srgb, ${c} ${Math.round(k * 100)}%, transparent)`;
20
+ el.style.cssText += `;position:absolute;inset:0;max-width:none;pointer-events:none;background:radial-gradient(farthest-corner at ${num(p.center_x)}% ${num(p.center_y)}%, transparent ${num(p.inner)}%, ${at(num(p.mid))} ${Math.max(num(p.inner) + 1, num(p.outer))}%, ${at(num(p.strength))} 100%)`;
21
+ return { seek() { } };
22
+ },
23
+ };
@@ -0,0 +1,22 @@
1
+ import { type TransitionPrimitive } from '../types.ts';
2
+ export declare const bandColour: (i: number) => string;
3
+ /** Each band's tilt, in degrees: alternating sides, shrinking towards the middle, never two the same. */
4
+ export declare function bandAngles(n: number, angle: number): number[];
5
+ /**
6
+ * How thick a band must be at its widest so that n of them, centred an even step
7
+ * apart across `across` px and tilted by up to `angle`, leave no gap over `along` px.
8
+ * Flat bands (angle 0) are exactly a step thick, plus a pixel against seams, so
9
+ * their edges fall on the rows of a grid of n (or a multiple of n) rows.
10
+ */
11
+ export declare function coverThickness(n: number, across: number, along: number, angle: number): number;
12
+ /**
13
+ * Where band i is at progress k: `lead` and `trail` are how far its leading and
14
+ * trailing ends have travelled (0 to 1), `swell` how far it has grown from thin
15
+ * to covering. Every band is fully across and fully grown at k = 0.5.
16
+ */
17
+ export declare function bandAt(k: number, i: number, n: number, lag: number, ease: (x: number) => number): {
18
+ lead: number;
19
+ trail: number;
20
+ swell: number;
21
+ };
22
+ export declare const bandSweep: TransitionPrimitive;
@@ -0,0 +1,111 @@
1
+ // transition/band-sweep. See library/primitives/transition/band-sweep.md.
2
+ //
3
+ // Bands of colour run across the frame at slightly different angles, like
4
+ // ribbons thrown over it. Each one streams in along its own length, a step after
5
+ // the last, and swells as it goes until together they cover the frame; the cut
6
+ // happens under them. Then they run on out the far side, narrowing, and leave the
7
+ // next scene behind.
8
+ //
9
+ // Colours come from `--m-band-1` … `--m-band-6` when the film sets them (an
10
+ // identity's own palette), else from the stage's accent, inverse and surfaces.
11
+ import { clamp } from "../../core/ease.js";
12
+ import { num, str } from "../types.js";
13
+ import { clearOverlays, overlay } from "./overlay.js";
14
+ const KEY = 'bands';
15
+ const FALLBACK = ['var(--m-bg-accent)', 'var(--m-bg-inverse)', 'var(--m-bg-surface)', 'var(--m-bg-sunken)'];
16
+ export const bandColour = (i) => `var(--m-band-${(i % 6) + 1}, ${FALLBACK[i % FALLBACK.length]})`;
17
+ /** Each band's tilt, in degrees: alternating sides, shrinking towards the middle, never two the same. */
18
+ export function bandAngles(n, angle) {
19
+ return Array.from({ length: n }, (_, i) => {
20
+ const side = i % 2 === 0 ? 1 : -1;
21
+ const share = 1 - (0.55 * ((i * 7) % n)) / Math.max(1, n);
22
+ return side * angle * share;
23
+ });
24
+ }
25
+ /**
26
+ * How thick a band must be at its widest so that n of them, centred an even step
27
+ * apart across `across` px and tilted by up to `angle`, leave no gap over `along` px.
28
+ * Flat bands (angle 0) are exactly a step thick, plus a pixel against seams, so
29
+ * their edges fall on the rows of a grid of n (or a multiple of n) rows.
30
+ */
31
+ export function coverThickness(n, across, along, angle) {
32
+ const step = across / Math.max(1, n);
33
+ if (angle === 0)
34
+ return step + 1;
35
+ const tilt = Math.tan((Math.abs(angle) * 2 * Math.PI) / 180) * along * 0.5;
36
+ return step + tilt + step * 0.2;
37
+ }
38
+ /**
39
+ * Where band i is at progress k: `lead` and `trail` are how far its leading and
40
+ * trailing ends have travelled (0 to 1), `swell` how far it has grown from thin
41
+ * to covering. Every band is fully across and fully grown at k = 0.5.
42
+ */
43
+ export function bandAt(k, i, n, lag, ease) {
44
+ const win = Math.max(0.05, 0.5 - (n - 1) * lag);
45
+ const lead = ease(clamp((k - i * lag) / win));
46
+ const trail = ease(clamp((k - 0.5 - i * lag) / win));
47
+ // Grow late on the way in, shrink early on the way out, so the bands read as ribbons before they read as a wall.
48
+ const swell = Math.min(clamp((k - i * lag - win * 0.35) / (0.5 - i * lag - win * 0.35)), 1 - clamp((k - 0.5) / (win * 0.65)));
49
+ return { lead, trail, swell: ease(clamp(swell)) };
50
+ }
51
+ export const bandSweep = {
52
+ slug: 'transition/band-sweep',
53
+ summary: 'Bands of colour run across the frame at angles, swell to cover the cut, then run on.',
54
+ duration: 1,
55
+ calm: { angle: 6, lag: 0.03 },
56
+ params: {
57
+ duration: { type: 'number', default: 1, min: 0.5, max: 2, step: 0.05, unit: 's', label: 'Length of the hand-over' },
58
+ direction: { type: 'choice', default: 'left', options: ['left', 'right', 'up', 'down'], label: 'Which way the bands run' },
59
+ bands: { type: 'number', default: 5, min: 2, max: 8, step: 1, unit: 'bands', label: 'Bands across the frame' },
60
+ width: { type: 'number', default: 9, min: 2, max: 30, step: 0.5, unit: '% of frame', label: 'Thickness of a band as it enters' },
61
+ angle: { type: 'number', default: 14, min: 0, max: 30, step: 0.5, unit: 'deg', label: 'Largest tilt of a band' },
62
+ lag: { type: 'number', default: 0.05, min: 0, max: 0.09, step: 0.005, unit: 'ratio', label: 'How far each band trails the one before' },
63
+ },
64
+ apply(from, to, k, p, ctx) {
65
+ const n = Math.max(2, Math.round(num(p.bands, 5)));
66
+ const lag = Math.min(num(p.lag, 0.05), 0.45 / (n - 1));
67
+ const dir = str(p.direction, 'left');
68
+ const [W, H] = ctx.size;
69
+ const horizontal = dir === 'left' || dir === 'right';
70
+ // Bands run along the travel; they are stacked across it.
71
+ const along = horizontal ? W : H, across = horizontal ? H : W;
72
+ const angles = bandAngles(n, num(p.angle, 14));
73
+ const thin = (num(p.width, 9) / 100) * Math.min(W, H);
74
+ const full = Math.max(thin, coverThickness(n, across, along, num(p.angle, 14)));
75
+ const length = Math.hypot(W, H) * 1.25;
76
+ const ease = ctx.ease('quart.inOut');
77
+ const sign = dir === 'left' || dir === 'up' ? -1 : 1;
78
+ const bands = overlay(from, KEY, n);
79
+ bands.forEach((el, i) => {
80
+ const { lead, trail, swell } = bandAt(k, i, n, lag, ease);
81
+ const thick = thin + (full - thin) * swell;
82
+ // Centre of band i across the frame, and the band laid along the travel through it.
83
+ const c = ((i + 0.5) / n) * across;
84
+ const cx = horizontal ? W / 2 : c, cy = horizontal ? c : H / 2;
85
+ const rot = (horizontal ? 0 : 90) + angles[i];
86
+ el.style.background = bandColour(i);
87
+ el.style.inset = 'auto';
88
+ el.style.left = `${(cx - length / 2).toFixed(2)}px`;
89
+ el.style.top = `${(cy - thick / 2).toFixed(2)}px`;
90
+ el.style.width = `${length.toFixed(2)}px`;
91
+ el.style.height = `${thick.toFixed(2)}px`;
92
+ // Running in the band's own frame: the leading end enters from the far side, the trailing end follows it out.
93
+ const front = lead * 100, back = trail * 100;
94
+ el.style.clipPath = sign < 0 ? `inset(0 ${back.toFixed(3)}% 0 ${(100 - front).toFixed(3)}%)` : `inset(0 ${(100 - front).toFixed(3)}% 0 ${back.toFixed(3)}%)`;
95
+ el.style.transform = `rotate(${rot.toFixed(3)}deg)`;
96
+ el.style.visibility = lead <= 0 || trail >= 1 ? 'hidden' : 'visible';
97
+ });
98
+ // The cut happens under the bands, when all of them are across and grown.
99
+ const cut = k >= 0.5;
100
+ from.style.opacity = cut ? '0' : '1';
101
+ to.style.opacity = cut ? '1' : '0';
102
+ const settle = ease(clamp((k - 0.5) / 0.5));
103
+ to.style.transform = cut ? `scale(${(1.03 - 0.03 * settle).toFixed(4)})` : '';
104
+ from.style.transform = cut ? '' : `scale(${(1 + 0.02 * ease(clamp(k / 0.5))).toFixed(4)})`;
105
+ },
106
+ clear(el) {
107
+ clearOverlays(el, KEY);
108
+ el.style.transform = '';
109
+ el.style.opacity = '';
110
+ },
111
+ };
@@ -0,0 +1,2 @@
1
+ import type { TransitionPrimitive } from '../types.ts';
2
+ export declare const beatCut: TransitionPrimitive;
@@ -0,0 +1,10 @@
1
+ export const beatCut = {
2
+ slug: 'transition/beat-cut',
3
+ summary: 'A plain cut placed on a music beat.',
4
+ duration: 0,
5
+ params: {
6
+ duration: { type: 'number', default: 0, min: 0, max: 0, step: 0, unit: 's', label: 'Always zero: a cut' },
7
+ },
8
+ apply() { },
9
+ clear() { },
10
+ };
@@ -0,0 +1,2 @@
1
+ import { type TransitionPrimitive } from '../types.ts';
2
+ export declare const blurDissolve: TransitionPrimitive;
@@ -0,0 +1,28 @@
1
+ // transition/blur-dissolve. See library/primitives/transition/blur-dissolve.md.
2
+ import { clamp } from "../../core/ease.js";
3
+ import { num } from "../types.js";
4
+ export const blurDissolve = {
5
+ slug: 'transition/blur-dissolve',
6
+ summary: 'One scene blurs out while the next blurs in.',
7
+ duration: 0.4,
8
+ calm: { blur: 12 },
9
+ params: {
10
+ duration: { type: 'number', default: 0.4, min: 0.3, max: 0.6, step: 0.05, unit: 's', label: 'Length of the hand-over' },
11
+ blur: { type: 'number', default: 20, min: 12, max: 30, step: 1, unit: 'px', label: 'Blur at the midpoint' },
12
+ overlap: { type: 'number', default: 0.5, min: 0.3, max: 0.7, step: 0.05, unit: 'ratio', label: 'Share of the time both scenes are visible' },
13
+ },
14
+ apply(from, to, k, p, ctx) {
15
+ const ease = ctx.ease(ctx.tokens.ease_move);
16
+ const span = 0.5 + num(p.overlap) / 2; // each scene's fade takes this share of the hand-over
17
+ const out = ease(clamp(k / span)), inn = ease(clamp((k - (1 - span)) / span));
18
+ const blur = num(p.blur);
19
+ from.style.opacity = String(1 - out);
20
+ from.style.filter = out > 0 ? `blur(${out * blur}px)` : '';
21
+ to.style.opacity = String(inn);
22
+ to.style.filter = inn < 1 ? `blur(${(1 - inn) * blur}px)` : '';
23
+ },
24
+ clear(el) {
25
+ el.style.opacity = '';
26
+ el.style.filter = '';
27
+ },
28
+ };
@@ -0,0 +1,2 @@
1
+ import { type TransitionPrimitive } from '../types.ts';
2
+ export declare const cameraTravel: TransitionPrimitive;
@@ -0,0 +1,69 @@
1
+ // transition/camera-travel. See library/primitives/transition/camera-travel.md.
2
+ //
3
+ // Both scenes are sheets in one world, the next one beside the current one
4
+ // (below it, by default). Only the camera moves: it pulls back, tilts and
5
+ // travels from one sheet to the other, then settles square on the new one.
6
+ // Two layers animated separately read as two unrelated moves; one camera reads
7
+ // as one place.
8
+ import { clamp } from "../../core/ease.js";
9
+ import { directionalBlur, streak } from "../blur.js";
10
+ import { num, str } from "../types.js";
11
+ const DIRS = { down: [0, 1], up: [0, -1], right: [1, 0], left: [-1, 0] };
12
+ /** The camera at progress k: how far it has travelled (0–1), how far back it stands, how far it leans. */
13
+ function camera(k, p, ctx) {
14
+ const travel = ctx.ease('smooth')(k);
15
+ // A bump that leaves and arrives with zero speed: sin² of the progress.
16
+ const bump = Math.sin(Math.PI * clamp(k)) ** 2;
17
+ return { travel, scale: 1 - num(p.pull) * bump, tilt: num(p.tilt) * bump, edge: bump };
18
+ }
19
+ export const cameraTravel = {
20
+ slug: 'transition/camera-travel',
21
+ summary: 'The camera pulls back and travels to the next scene, laid beside this one in one world.',
22
+ duration: 1.4,
23
+ calm: { pull: 0.04, tilt: 5, gap: 0, shutter: 0.3 },
24
+ params: {
25
+ duration: { type: 'number', default: 1.4, min: 0.8, max: 2.4, step: 0.05, unit: 's', label: 'Length of the hand-over' },
26
+ direction: { type: 'choice', default: 'down', options: ['down', 'up', 'right', 'left'], label: 'Where the next scene lies' },
27
+ pull: { type: 'number', default: 0.32, min: 0, max: 0.6, step: 0.01, unit: 'ratio', label: 'How far the camera pulls back on the way' },
28
+ tilt: { type: 'number', default: 14, min: 0, max: 30, step: 1, unit: 'deg', label: 'How far the world leans while it travels' },
29
+ gap: { type: 'number', default: 0.18, min: 0, max: 0.6, step: 0.01, unit: 'of the frame', label: 'Space between the two scenes' },
30
+ shutter: { type: 'number', default: 0.5, min: 0, max: 1, step: 0.05, unit: 'ratio', label: 'Motion blur: share of a frame the move smears over' },
31
+ },
32
+ apply(from, to, k, p, ctx) {
33
+ const [W, H] = ctx.size;
34
+ const [dx, dy] = DIRS[str(p.direction)] ?? DIRS.down;
35
+ const span = (dy ? H : W) * (1 + num(p.gap));
36
+ const P = Math.max(W, H) * 2.2;
37
+ const pose = (c, at) => {
38
+ const off = (at - c.travel) * span;
39
+ // Lean along the travel: a vertical move tips the world back on X, a sideways one turns it on Y.
40
+ const lean = dy ? `rotateX(${(dy * c.tilt).toFixed(3)}deg) rotateZ(${(-0.12 * c.tilt).toFixed(3)}deg)` : `rotateY(${(-dx * c.tilt).toFixed(3)}deg) rotateZ(${(0.12 * c.tilt).toFixed(3)}deg)`;
41
+ return `perspective(${P}px) scale(${c.scale.toFixed(5)}) ${lean} translate(${(dx * off).toFixed(2)}px, ${(dy * off).toFixed(2)}px)`;
42
+ };
43
+ const c = camera(k, p, ctx);
44
+ from.style.transform = pose(c, 0);
45
+ to.style.transform = pose(c, 1);
46
+ // Sheets get an edge only while the camera is back: corners, a hairline and a shadow.
47
+ for (const el of [from, to]) {
48
+ el.style.transformOrigin = '50% 50%';
49
+ el.style.borderRadius = `${(Math.min(W, H) * 0.03 * c.edge).toFixed(2)}px`;
50
+ el.style.boxShadow = c.edge > 0.01
51
+ ? `0 0 0 1px rgba(255,255,255,${(0.08 * c.edge).toFixed(3)}), 0 ${(60 * c.edge).toFixed(1)}px ${(120 * c.edge).toFixed(1)}px rgba(0,0,0,${(0.5 * c.edge).toFixed(3)})`
52
+ : '';
53
+ }
54
+ // Motion blur from the camera's speed on screen, along the travel only.
55
+ const h = 0.5 / ctx.fps / num(p.duration);
56
+ const a = camera(clamp(k - h), p, ctx), b = camera(clamp(k + h), p, ctx);
57
+ const speed = (b.travel - a.travel) * span * c.scale;
58
+ const s = streak(speed, num(p.shutter));
59
+ from.style.filter = directionalBlur(from, dx ? s : 0, dy ? s : 0);
60
+ to.style.filter = directionalBlur(to, dx ? s : 0, dy ? s : 0);
61
+ },
62
+ clear(el) {
63
+ el.style.transform = '';
64
+ el.style.transformOrigin = '';
65
+ el.style.borderRadius = '';
66
+ el.style.boxShadow = '';
67
+ el.style.filter = '';
68
+ },
69
+ };
@@ -0,0 +1,2 @@
1
+ import { type TransitionPrimitive } from '../types.ts';
2
+ export declare const coverReveal: TransitionPrimitive;
@@ -0,0 +1,52 @@
1
+ // transition/cover-reveal. See library/primitives/transition/cover-reveal.md.
2
+ import { clamp } from "../../core/ease.js";
3
+ import { list, num, str } from "../types.js";
4
+ import { clearOverlays, fillOf, overlay } from "./overlay.js";
5
+ const KEY = 'cover';
6
+ export const coverReveal = {
7
+ slug: 'transition/cover-reveal',
8
+ summary: 'Colour panels sweep across and cover the cut, then sweep on to uncover the next scene.',
9
+ duration: 1,
10
+ calm: { lag: 0.06 },
11
+ params: {
12
+ duration: { type: 'number', default: 1, min: 0.6, max: 1.6, step: 0.05, unit: 's', label: 'Length of the hand-over' },
13
+ direction: { type: 'choice', default: 'up', options: ['up', 'down', 'left', 'right'], label: 'Which way the panels travel' },
14
+ panels: { type: 'number', default: 2, min: 1, max: 3, step: 1, unit: 'panels', label: 'Panels, one behind the other' },
15
+ lag: { type: 'number', default: 0.12, min: 0, max: 0.3, step: 0.01, unit: 'ratio', label: 'How far each panel trails the one before' },
16
+ },
17
+ apply(from, to, k, p, ctx) {
18
+ const n = Math.max(1, Math.round(num(p.panels))), lag = num(p.lag);
19
+ const colours = ['accent', 'inverse', 'surface'];
20
+ const panels = overlay(from, KEY, n);
21
+ const ease = ctx.ease('quart.inOut');
22
+ const dir = str(p.direction);
23
+ // Each panel covers in the first half of its window and uncovers in the second.
24
+ // The cut happens under the last panel, when it covers the whole frame.
25
+ const win = 1 - lag * (n - 1);
26
+ panels.forEach((el, i) => {
27
+ el.style.background = fillOf(list([colours[(n - 1 - i) % colours.length]])[0]);
28
+ const local = clamp((k - i * lag) / win);
29
+ const cover = ease(clamp(local * 2)), uncover = ease(clamp(local * 2 - 1));
30
+ // Two edges: the leading one comes in, the trailing one follows it out.
31
+ const lead = cover * 100, trail = uncover * 100;
32
+ const inset = dir === 'up' ? `${100 - lead}% 0 ${trail}% 0`
33
+ : dir === 'down' ? `${trail}% 0 ${100 - lead}% 0`
34
+ : dir === 'left' ? `0 ${trail}% 0 ${100 - lead}%`
35
+ : `0 ${100 - lead}% 0 ${trail}%`;
36
+ el.style.clipPath = `inset(${inset})`;
37
+ el.style.visibility = local <= 0 || local >= 1 ? 'hidden' : 'visible';
38
+ });
39
+ // The incoming scene is hidden until the last panel covers the frame.
40
+ const lastMid = (n - 1) * lag + win / 2;
41
+ to.style.opacity = k >= lastMid ? '1' : '0';
42
+ from.style.opacity = k >= lastMid ? '0' : '1';
43
+ // A slight push-in on the outgoing scene, settling on the incoming one.
44
+ const settle = ease(clamp((k - lastMid) / (1 - lastMid)));
45
+ to.style.transform = k >= lastMid ? `scale(${(1.04 - 0.04 * settle).toFixed(4)})` : '';
46
+ },
47
+ clear(el) {
48
+ clearOverlays(el, KEY);
49
+ el.style.transform = '';
50
+ el.style.opacity = '';
51
+ },
52
+ };
@@ -0,0 +1,2 @@
1
+ import { type TransitionPrimitive } from '../types.ts';
2
+ export declare const curtain: TransitionPrimitive;
@@ -0,0 +1,40 @@
1
+ // transition/curtain. See library/primitives/transition/curtain.md.
2
+ import { clamp } from "../../core/ease.js";
3
+ import { num, str } from "../types.js";
4
+ import { clearOverlays, fillOf, overlay } from "./overlay.js";
5
+ const KEY = 'curtain';
6
+ export const curtain = {
7
+ slug: 'transition/curtain',
8
+ summary: 'Two panels part or close.',
9
+ duration: 0.8,
10
+ params: {
11
+ duration: { type: 'number', default: 0.8, min: 0.5, max: 1.4, step: 0.05, unit: 's', label: 'Length of the hand-over' },
12
+ axis: { type: 'choice', default: 'vertical', options: ['vertical', 'horizontal'], label: 'Panels meet along a vertical or a horizontal line' },
13
+ fill: { type: 'choice', default: 'inverse', options: ['inverse', 'accent', 'surface', 'base'], label: 'Panel colour' },
14
+ },
15
+ apply(from, to, k, p, ctx) {
16
+ const [a, b] = overlay(from, KEY, 2);
17
+ if (!a || !b)
18
+ return;
19
+ const ease = ctx.ease('quint.inOut');
20
+ // Close over the outgoing scene, cut while closed, then part on the incoming one.
21
+ const close = ease(clamp(k / 0.46)), open = ease(clamp((k - 0.54) / 0.46));
22
+ const half = (close - open) * 50;
23
+ const vertical = str(p.axis) !== 'horizontal';
24
+ for (const el of [a, b])
25
+ el.style.background = fillOf(str(p.fill, 'inverse'));
26
+ a.style.clipPath = vertical ? `inset(0 ${100 - half}% 0 0)` : `inset(0 0 ${100 - half}% 0)`;
27
+ b.style.clipPath = vertical ? `inset(0 0 0 ${100 - half}%)` : `inset(${100 - half}% 0 0 0)`;
28
+ const shut = k >= 0.5;
29
+ from.style.opacity = shut ? '0' : '1';
30
+ to.style.opacity = shut ? '1' : '0';
31
+ // The incoming scene settles from a touch closer as the panels part.
32
+ to.style.transform = shut ? `scale(${(1.05 - 0.05 * open).toFixed(4)})` : '';
33
+ void num;
34
+ },
35
+ clear(el) {
36
+ clearOverlays(el, KEY);
37
+ el.style.opacity = '';
38
+ el.style.transform = '';
39
+ },
40
+ };
@@ -0,0 +1,2 @@
1
+ import { type TransitionPrimitive } from '../types.ts';
2
+ export declare const diveIn: TransitionPrimitive;
@@ -0,0 +1,52 @@
1
+ // transition/dive-in. See library/primitives/transition/dive-in.md.
2
+ import { clamp } from "../../core/ease.js";
3
+ import { num, str } from "../types.js";
4
+ export const diveIn = {
5
+ slug: 'transition/dive-in',
6
+ summary: 'The camera pushes into a point until it fills the frame.',
7
+ duration: 0.5,
8
+ calm: { scale_to: 3 },
9
+ params: {
10
+ duration: { type: 'number', default: 0.5, min: 0.4, max: 1.2, step: 0.05, unit: 's', label: 'Length of the hand-over' },
11
+ scale_to: { type: 'number', default: 8, min: 3, max: 12, step: 0.5, unit: 'x', label: 'How far the camera pushes in' },
12
+ x: { type: 'number', default: 50, min: 0, max: 100, step: 1, unit: '% of width', label: 'Point to dive into, across', pad: { name: 'point', axis: 'x' } },
13
+ y: { type: 'number', default: 50, min: 0, max: 100, step: 1, unit: '% of height', label: 'Point to dive into, down', pad: { name: 'point', axis: 'y' } },
14
+ pace: { type: 'choice', default: 'accelerate', options: ['accelerate', 'glide'], label: 'accelerate hits the cut at speed; glide eases in and out and arrives at rest' },
15
+ },
16
+ apply(from, to, k, p, ctx) {
17
+ const [W, H] = ctx.size, cx = (num(p.x) / 100) * W, cy = (num(p.y) / 100) * H;
18
+ from.style.transformOrigin = `${cx}px ${cy}px`;
19
+ to.style.transformOrigin = `${cx}px ${cy}px`;
20
+ if (str(p.pace) === 'glide') {
21
+ // One eased push that arrives at rest: the zoom is geometric, so its speed
22
+ // on screen is even; blur only while it moves, none at either end; the next
23
+ // scene is already at its own size when it shows, so it does not land.
24
+ const e = ctx.ease('sine.inOut')(k);
25
+ const zoom = Math.pow(num(p.scale_to), e);
26
+ const blur = 7 * Math.sin(Math.PI * k);
27
+ from.style.transform = `scale(${zoom.toFixed(4)})`;
28
+ from.style.filter = blur > 0.05 ? `blur(${blur.toFixed(2)}px)` : '';
29
+ from.style.opacity = String(1 - ctx.ease('smooth')(clamp((k - 0.55) / 0.35)));
30
+ to.style.transform = `scale(${(1.12 - 0.12 * ctx.ease('expo.out')(clamp((k - 0.5) / 0.5))).toFixed(4)})`;
31
+ to.style.filter = blur > 0.05 ? `blur(${blur.toFixed(2)}px)` : '';
32
+ to.style.opacity = String(ctx.ease('smooth')(clamp((k - 0.5) / 0.35)));
33
+ return;
34
+ }
35
+ const accel = ctx.ease('expo.in'), land = ctx.ease('expo.out');
36
+ // The push accelerates into the cut at the middle; the next scene lands out of a slight over-zoom.
37
+ const a = accel(clamp(k / 0.55)), b = land(clamp((k - 0.45) / 0.55));
38
+ const zoom = 1 + (num(p.scale_to) - 1) * a;
39
+ from.style.transform = `scale(${zoom.toFixed(4)})`;
40
+ from.style.filter = a > 0.02 ? `blur(${(a * 14).toFixed(2)}px)` : '';
41
+ from.style.opacity = String(1 - clamp((k - 0.4) / 0.15));
42
+ to.style.transform = `scale(${(1.35 - 0.35 * b).toFixed(4)})`;
43
+ to.style.filter = b < 0.98 ? `blur(${((1 - b) * 12).toFixed(2)}px)` : '';
44
+ to.style.opacity = String(clamp((k - 0.45) / 0.12));
45
+ },
46
+ clear(el) {
47
+ el.style.transform = '';
48
+ el.style.transformOrigin = '';
49
+ el.style.filter = '';
50
+ el.style.opacity = '';
51
+ },
52
+ };
@@ -0,0 +1,2 @@
1
+ import { type TransitionPrimitive } from '../types.ts';
2
+ export declare const flyPast: TransitionPrimitive;