@vysmo/transitions 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 (384) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +618 -0
  3. package/dist/index.d.ts +6 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +3 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/inputs/normalize.d.ts +2 -0
  8. package/dist/inputs/normalize.d.ts.map +1 -0
  9. package/dist/inputs/normalize.js +2 -0
  10. package/dist/inputs/normalize.js.map +1 -0
  11. package/dist/runner/gl.d.ts +7 -0
  12. package/dist/runner/gl.d.ts.map +1 -0
  13. package/dist/runner/gl.js +59 -0
  14. package/dist/runner/gl.js.map +1 -0
  15. package/dist/runner/mesh.d.ts +28 -0
  16. package/dist/runner/mesh.d.ts.map +1 -0
  17. package/dist/runner/mesh.js +96 -0
  18. package/dist/runner/mesh.js.map +1 -0
  19. package/dist/runner/runner.d.ts +107 -0
  20. package/dist/runner/runner.d.ts.map +1 -0
  21. package/dist/runner/runner.js +410 -0
  22. package/dist/runner/runner.js.map +1 -0
  23. package/dist/transitions/all.d.ts +9 -0
  24. package/dist/transitions/all.d.ts.map +1 -0
  25. package/dist/transitions/all.js +129 -0
  26. package/dist/transitions/all.js.map +1 -0
  27. package/dist/transitions/bloom-reveal.d.ts +27 -0
  28. package/dist/transitions/bloom-reveal.d.ts.map +1 -0
  29. package/dist/transitions/bloom-reveal.js +106 -0
  30. package/dist/transitions/bloom-reveal.js.map +1 -0
  31. package/dist/transitions/chromatic-pulse.d.ts +4 -0
  32. package/dist/transitions/chromatic-pulse.d.ts.map +1 -0
  33. package/dist/transitions/chromatic-pulse.js +40 -0
  34. package/dist/transitions/chromatic-pulse.js.map +1 -0
  35. package/dist/transitions/clock-wipe.d.ts +6 -0
  36. package/dist/transitions/clock-wipe.d.ts.map +1 -0
  37. package/dist/transitions/clock-wipe.js +33 -0
  38. package/dist/transitions/clock-wipe.js.map +1 -0
  39. package/dist/transitions/color-phase.d.ts +10 -0
  40. package/dist/transitions/color-phase.d.ts.map +1 -0
  41. package/dist/transitions/color-phase.js +24 -0
  42. package/dist/transitions/color-phase.js.map +1 -0
  43. package/dist/transitions/colour-distance.d.ts.map +1 -0
  44. package/dist/transitions/cross-warp.d.ts.map +1 -0
  45. package/dist/transitions/cross-zoom.d.ts +5 -0
  46. package/dist/transitions/cross-zoom.d.ts.map +1 -0
  47. package/dist/transitions/cross-zoom.js +59 -0
  48. package/dist/transitions/cross-zoom.js.map +1 -0
  49. package/dist/transitions/crosshatch.d.ts +12 -0
  50. package/dist/transitions/crosshatch.d.ts.map +1 -0
  51. package/dist/transitions/crosshatch.js +49 -0
  52. package/dist/transitions/crosshatch.js.map +1 -0
  53. package/dist/transitions/define.d.ts +35 -0
  54. package/dist/transitions/define.d.ts.map +1 -0
  55. package/dist/transitions/define.js +37 -0
  56. package/dist/transitions/define.js.map +1 -0
  57. package/dist/transitions/directional-burn.d.ts +14 -0
  58. package/dist/transitions/directional-burn.d.ts.map +1 -0
  59. package/dist/transitions/directional-burn.js +67 -0
  60. package/dist/transitions/directional-burn.js.map +1 -0
  61. package/dist/transitions/directional-warp.d.ts +12 -0
  62. package/dist/transitions/directional-warp.d.ts.map +1 -0
  63. package/dist/transitions/directional-warp.js +46 -0
  64. package/dist/transitions/directional-warp.js.map +1 -0
  65. package/dist/transitions/dissolve.d.ts +2 -0
  66. package/dist/transitions/dissolve.d.ts.map +1 -0
  67. package/dist/transitions/dissolve.js +16 -0
  68. package/dist/transitions/dissolve.js.map +1 -0
  69. package/dist/transitions/dreamy-zoom.d.ts +25 -0
  70. package/dist/transitions/dreamy-zoom.d.ts.map +1 -0
  71. package/dist/transitions/dreamy-zoom.js +66 -0
  72. package/dist/transitions/dreamy-zoom.js.map +1 -0
  73. package/dist/transitions/dreamy.d.ts +8 -0
  74. package/dist/transitions/dreamy.d.ts.map +1 -0
  75. package/dist/transitions/dreamy.js +26 -0
  76. package/dist/transitions/dreamy.js.map +1 -0
  77. package/dist/transitions/drip-wipe.d.ts +22 -0
  78. package/dist/transitions/drip-wipe.d.ts.map +1 -0
  79. package/dist/transitions/drip-wipe.js +109 -0
  80. package/dist/transitions/drip-wipe.js.map +1 -0
  81. package/dist/transitions/ember-scatter.d.ts +22 -0
  82. package/dist/transitions/ember-scatter.d.ts.map +1 -0
  83. package/dist/transitions/ember-scatter.js +94 -0
  84. package/dist/transitions/ember-scatter.js.map +1 -0
  85. package/dist/transitions/film-burn.d.ts +17 -0
  86. package/dist/transitions/film-burn.d.ts.map +1 -0
  87. package/dist/transitions/film-burn.js +101 -0
  88. package/dist/transitions/film-burn.js.map +1 -0
  89. package/dist/transitions/film-grain.d.ts +24 -0
  90. package/dist/transitions/film-grain.d.ts.map +1 -0
  91. package/dist/transitions/film-grain.js +78 -0
  92. package/dist/transitions/film-grain.js.map +1 -0
  93. package/dist/transitions/flow-warp.d.ts +20 -0
  94. package/dist/transitions/flow-warp.d.ts.map +1 -0
  95. package/dist/transitions/flow-warp.js +51 -0
  96. package/dist/transitions/flow-warp.js.map +1 -0
  97. package/dist/transitions/fluid-flow.d.ts +26 -0
  98. package/dist/transitions/fluid-flow.d.ts.map +1 -0
  99. package/dist/transitions/fluid-flow.js +94 -0
  100. package/dist/transitions/fluid-flow.js.map +1 -0
  101. package/dist/transitions/fly-eye.d.ts.map +1 -0
  102. package/dist/transitions/fly-eye.js +58 -0
  103. package/dist/transitions/fly-eye.js.map +1 -0
  104. package/dist/transitions/glass-shatter.d.ts +25 -0
  105. package/dist/transitions/glass-shatter.d.ts.map +1 -0
  106. package/dist/transitions/glass-shatter.js +86 -0
  107. package/dist/transitions/glass-shatter.js.map +1 -0
  108. package/dist/transitions/glitch.d.ts +6 -0
  109. package/dist/transitions/glitch.d.ts.map +1 -0
  110. package/dist/transitions/glitch.js +59 -0
  111. package/dist/transitions/glitch.js.map +1 -0
  112. package/dist/transitions/god-rays-reveal.d.ts +32 -0
  113. package/dist/transitions/god-rays-reveal.d.ts.map +1 -0
  114. package/dist/transitions/god-rays-reveal.js +110 -0
  115. package/dist/transitions/god-rays-reveal.js.map +1 -0
  116. package/dist/transitions/gravity-pull.d.ts +16 -0
  117. package/dist/transitions/gravity-pull.d.ts.map +1 -0
  118. package/dist/transitions/gravity-pull.js +65 -0
  119. package/dist/transitions/gravity-pull.js.map +1 -0
  120. package/dist/transitions/grid-reveal.d.ts +12 -0
  121. package/dist/transitions/grid-reveal.d.ts.map +1 -0
  122. package/dist/transitions/grid-reveal.js +53 -0
  123. package/dist/transitions/grid-reveal.js.map +1 -0
  124. package/dist/transitions/heat-haze.d.ts +13 -0
  125. package/dist/transitions/heat-haze.d.ts.map +1 -0
  126. package/dist/transitions/heat-haze.js +51 -0
  127. package/dist/transitions/heat-haze.js.map +1 -0
  128. package/dist/transitions/index.d.ts +64 -0
  129. package/dist/transitions/index.d.ts.map +1 -0
  130. package/dist/transitions/index.js +63 -0
  131. package/dist/transitions/index.js.map +1 -0
  132. package/dist/transitions/ink-bloom.d.ts +15 -0
  133. package/dist/transitions/ink-bloom.d.ts.map +1 -0
  134. package/dist/transitions/ink-bloom.js +76 -0
  135. package/dist/transitions/ink-bloom.js.map +1 -0
  136. package/dist/transitions/ink-diffuse.d.ts +26 -0
  137. package/dist/transitions/ink-diffuse.d.ts.map +1 -0
  138. package/dist/transitions/ink-diffuse.js +90 -0
  139. package/dist/transitions/ink-diffuse.js.map +1 -0
  140. package/dist/transitions/iris-zoom.d.ts +13 -0
  141. package/dist/transitions/iris-zoom.d.ts.map +1 -0
  142. package/dist/transitions/iris-zoom.js +67 -0
  143. package/dist/transitions/iris-zoom.js.map +1 -0
  144. package/dist/transitions/kinetic-bands.d.ts +7 -0
  145. package/dist/transitions/kinetic-bands.d.ts.map +1 -0
  146. package/dist/transitions/kinetic-bands.js +58 -0
  147. package/dist/transitions/kinetic-bands.js.map +1 -0
  148. package/dist/transitions/lenticular-flip.d.ts +22 -0
  149. package/dist/transitions/lenticular-flip.d.ts.map +1 -0
  150. package/dist/transitions/lenticular-flip.js +73 -0
  151. package/dist/transitions/lenticular-flip.js.map +1 -0
  152. package/dist/transitions/light-leak.d.ts +7 -0
  153. package/dist/transitions/light-leak.d.ts.map +1 -0
  154. package/dist/transitions/light-leak.js +43 -0
  155. package/dist/transitions/light-leak.js.map +1 -0
  156. package/dist/transitions/lightning-strike.d.ts +22 -0
  157. package/dist/transitions/lightning-strike.d.ts.map +1 -0
  158. package/dist/transitions/lightning-strike.js +90 -0
  159. package/dist/transitions/lightning-strike.js.map +1 -0
  160. package/dist/transitions/linear-blur.d.ts +11 -0
  161. package/dist/transitions/linear-blur.d.ts.map +1 -0
  162. package/dist/transitions/linear-blur.js +40 -0
  163. package/dist/transitions/linear-blur.js.map +1 -0
  164. package/dist/transitions/liquid-chrome.d.ts +22 -0
  165. package/dist/transitions/liquid-chrome.d.ts.map +1 -0
  166. package/dist/transitions/liquid-chrome.js +114 -0
  167. package/dist/transitions/liquid-chrome.js.map +1 -0
  168. package/dist/transitions/liquid-morph.d.ts +6 -0
  169. package/dist/transitions/liquid-morph.d.ts.map +1 -0
  170. package/dist/transitions/liquid-morph.js +50 -0
  171. package/dist/transitions/liquid-morph.js.map +1 -0
  172. package/dist/transitions/lumina-melt.d.ts +11 -0
  173. package/dist/transitions/lumina-melt.d.ts.map +1 -0
  174. package/dist/transitions/lumina-melt.js +36 -0
  175. package/dist/transitions/lumina-melt.js.map +1 -0
  176. package/dist/transitions/mosaic.d.ts +13 -0
  177. package/dist/transitions/mosaic.d.ts.map +1 -0
  178. package/dist/transitions/mosaic.js +58 -0
  179. package/dist/transitions/mosaic.js.map +1 -0
  180. package/dist/transitions/noise-dissolve.d.ts +5 -0
  181. package/dist/transitions/noise-dissolve.d.ts.map +1 -0
  182. package/dist/transitions/noise-dissolve.js +41 -0
  183. package/dist/transitions/noise-dissolve.js.map +1 -0
  184. package/dist/transitions/page-curl.d.ts +32 -0
  185. package/dist/transitions/page-curl.d.ts.map +1 -0
  186. package/dist/transitions/page-curl.js +165 -0
  187. package/dist/transitions/page-curl.js.map +1 -0
  188. package/dist/transitions/paint-bleed.d.ts +12 -0
  189. package/dist/transitions/paint-bleed.d.ts.map +1 -0
  190. package/dist/transitions/paint-bleed.js +59 -0
  191. package/dist/transitions/paint-bleed.js.map +1 -0
  192. package/dist/transitions/particle-assemble.d.ts +23 -0
  193. package/dist/transitions/particle-assemble.d.ts.map +1 -0
  194. package/dist/transitions/particle-assemble.js +65 -0
  195. package/dist/transitions/particle-assemble.js.map +1 -0
  196. package/dist/transitions/pinwheel.d.ts +11 -0
  197. package/dist/transitions/pinwheel.d.ts.map +1 -0
  198. package/dist/transitions/pinwheel.js +40 -0
  199. package/dist/transitions/pinwheel.js.map +1 -0
  200. package/dist/transitions/pixelate.d.ts +4 -0
  201. package/dist/transitions/pixelate.d.ts.map +1 -0
  202. package/dist/transitions/pixelate.js +26 -0
  203. package/dist/transitions/pixelate.js.map +1 -0
  204. package/dist/transitions/plasma-pulse.d.ts.map +1 -0
  205. package/dist/transitions/plasma-pulse.js +92 -0
  206. package/dist/transitions/plasma-pulse.js.map +1 -0
  207. package/dist/transitions/polka-dots-curtain.d.ts +13 -0
  208. package/dist/transitions/polka-dots-curtain.d.ts.map +1 -0
  209. package/dist/transitions/polka-dots-curtain.js +46 -0
  210. package/dist/transitions/polka-dots-curtain.js.map +1 -0
  211. package/dist/transitions/polygon-flip.d.ts +27 -0
  212. package/dist/transitions/polygon-flip.d.ts.map +1 -0
  213. package/dist/transitions/polygon-flip.js +97 -0
  214. package/dist/transitions/polygon-flip.js.map +1 -0
  215. package/dist/transitions/portal-dive.d.ts +18 -0
  216. package/dist/transitions/portal-dive.d.ts.map +1 -0
  217. package/dist/transitions/portal-dive.js +83 -0
  218. package/dist/transitions/portal-dive.js.map +1 -0
  219. package/dist/transitions/prism-split.d.ts +12 -0
  220. package/dist/transitions/prism-split.d.ts.map +1 -0
  221. package/dist/transitions/prism-split.js +52 -0
  222. package/dist/transitions/prism-split.js.map +1 -0
  223. package/dist/transitions/push.d.ts +4 -0
  224. package/dist/transitions/push.d.ts.map +1 -0
  225. package/dist/transitions/push.js +34 -0
  226. package/dist/transitions/push.js.map +1 -0
  227. package/dist/transitions/radial-reveal.d.ts +5 -0
  228. package/dist/transitions/radial-reveal.d.ts.map +1 -0
  229. package/dist/transitions/radial-reveal.js +31 -0
  230. package/dist/transitions/radial-reveal.js.map +1 -0
  231. package/dist/transitions/ripple-wave.d.ts +24 -0
  232. package/dist/transitions/ripple-wave.d.ts.map +1 -0
  233. package/dist/transitions/ripple-wave.js +135 -0
  234. package/dist/transitions/ripple-wave.js.map +1 -0
  235. package/dist/transitions/ripple.d.ts +7 -0
  236. package/dist/transitions/ripple.d.ts.map +1 -0
  237. package/dist/transitions/ripple.js +43 -0
  238. package/dist/transitions/ripple.js.map +1 -0
  239. package/dist/transitions/shape-reveal.d.ts +12 -0
  240. package/dist/transitions/shape-reveal.d.ts.map +1 -0
  241. package/dist/transitions/shape-reveal.js +53 -0
  242. package/dist/transitions/shape-reveal.js.map +1 -0
  243. package/dist/transitions/shockwave.d.ts +10 -0
  244. package/dist/transitions/shockwave.d.ts.map +1 -0
  245. package/dist/transitions/shockwave.js +56 -0
  246. package/dist/transitions/shockwave.js.map +1 -0
  247. package/dist/transitions/singularity.d.ts +22 -0
  248. package/dist/transitions/singularity.d.ts.map +1 -0
  249. package/dist/transitions/singularity.js +59 -0
  250. package/dist/transitions/singularity.js.map +1 -0
  251. package/dist/transitions/slide.d.ts +10 -0
  252. package/dist/transitions/slide.d.ts.map +1 -0
  253. package/dist/transitions/slide.js +76 -0
  254. package/dist/transitions/slide.js.map +1 -0
  255. package/dist/transitions/smoldering-edge.d.ts +15 -0
  256. package/dist/transitions/smoldering-edge.d.ts.map +1 -0
  257. package/dist/transitions/smoldering-edge.js +74 -0
  258. package/dist/transitions/smoldering-edge.js.map +1 -0
  259. package/dist/transitions/split.d.ts +14 -0
  260. package/dist/transitions/split.d.ts.map +1 -0
  261. package/dist/transitions/split.js +53 -0
  262. package/dist/transitions/split.js.map +1 -0
  263. package/dist/transitions/swirl.d.ts +12 -0
  264. package/dist/transitions/swirl.d.ts.map +1 -0
  265. package/dist/transitions/swirl.js +42 -0
  266. package/dist/transitions/swirl.js.map +1 -0
  267. package/dist/transitions/tangent-motion-blur.d.ts +13 -0
  268. package/dist/transitions/tangent-motion-blur.d.ts.map +1 -0
  269. package/dist/transitions/tangent-motion-blur.js +58 -0
  270. package/dist/transitions/tangent-motion-blur.js.map +1 -0
  271. package/dist/transitions/tile-scatter.d.ts +22 -0
  272. package/dist/transitions/tile-scatter.d.ts.map +1 -0
  273. package/dist/transitions/tile-scatter.js +122 -0
  274. package/dist/transitions/tile-scatter.js.map +1 -0
  275. package/dist/transitions/tilt-sweep.d.ts +11 -0
  276. package/dist/transitions/tilt-sweep.d.ts.map +1 -0
  277. package/dist/transitions/tilt-sweep.js +31 -0
  278. package/dist/transitions/tilt-sweep.js.map +1 -0
  279. package/dist/transitions/warp-zoom.d.ts +7 -0
  280. package/dist/transitions/warp-zoom.d.ts.map +1 -0
  281. package/dist/transitions/warp-zoom.js +70 -0
  282. package/dist/transitions/warp-zoom.js.map +1 -0
  283. package/dist/transitions/wave-stripes.d.ts +16 -0
  284. package/dist/transitions/wave-stripes.d.ts.map +1 -0
  285. package/dist/transitions/wave-stripes.js +55 -0
  286. package/dist/transitions/wave-stripes.js.map +1 -0
  287. package/dist/transitions/wave-wipe.d.ts +23 -0
  288. package/dist/transitions/wave-wipe.d.ts.map +1 -0
  289. package/dist/transitions/wave-wipe.js +84 -0
  290. package/dist/transitions/wave-wipe.js.map +1 -0
  291. package/dist/transitions/wind.d.ts +9 -0
  292. package/dist/transitions/wind.d.ts.map +1 -0
  293. package/dist/transitions/wind.js +48 -0
  294. package/dist/transitions/wind.js.map +1 -0
  295. package/dist/transitions/window-slice.d.ts +11 -0
  296. package/dist/transitions/window-slice.d.ts.map +1 -0
  297. package/dist/transitions/window-slice.js +34 -0
  298. package/dist/transitions/window-slice.js.map +1 -0
  299. package/dist/transitions/wipe-directional.d.ts +5 -0
  300. package/dist/transitions/wipe-directional.d.ts.map +1 -0
  301. package/dist/transitions/wipe-directional.js +26 -0
  302. package/dist/transitions/wipe-directional.js.map +1 -0
  303. package/dist/types.d.ts +78 -0
  304. package/dist/types.d.ts.map +1 -0
  305. package/dist/types.js +2 -0
  306. package/dist/types.js.map +1 -0
  307. package/package.json +56 -0
  308. package/src/__tests__/__screenshots__/endpoint-correctness.test.ts/endpoint-correctness---every-transition-must-be-pixel-pure-from-to-at-progress-0-1-rippleWave-at-progress-0-is-pure--from--1.png +0 -0
  309. package/src/__tests__/__screenshots__/endpoint-correctness.test.ts/endpoint-correctness---every-transition-must-be-pixel-pure-from-to-at-progress-0-1-rippleWave-at-progress-1-is-pure--to--1.png +0 -0
  310. package/src/__tests__/endpoint-correctness.test.ts +161 -0
  311. package/src/__tests__/readme.test.ts +39 -0
  312. package/src/__tests__/ssr.test.ts +45 -0
  313. package/src/index.ts +75 -0
  314. package/src/inputs/normalize.ts +1 -0
  315. package/src/runner/__tests__/__screenshots__/mesh.test.ts/buildSubdividedPlane-centroid-is-shared-across-a-face-and-equals-mean-of-its-3-positions-1.png +0 -0
  316. package/src/runner/__tests__/__screenshots__/mesh.test.ts/buildSubdividedPlane-uv-matches-aPosition---0-5---0-5-1.png +0 -0
  317. package/src/runner/__tests__/mesh.test.ts +128 -0
  318. package/src/runner/gl.ts +69 -0
  319. package/src/runner/mesh.ts +135 -0
  320. package/src/runner/runner.ts +528 -0
  321. package/src/transitions/all.ts +131 -0
  322. package/src/transitions/bloom-reveal.ts +106 -0
  323. package/src/transitions/chromatic-pulse.ts +40 -0
  324. package/src/transitions/clock-wipe.ts +33 -0
  325. package/src/transitions/color-phase.ts +24 -0
  326. package/src/transitions/cross-zoom.ts +59 -0
  327. package/src/transitions/crosshatch.ts +49 -0
  328. package/src/transitions/define.ts +56 -0
  329. package/src/transitions/directional-burn.ts +67 -0
  330. package/src/transitions/directional-warp.ts +46 -0
  331. package/src/transitions/dissolve.ts +16 -0
  332. package/src/transitions/dreamy-zoom.ts +66 -0
  333. package/src/transitions/dreamy.ts +26 -0
  334. package/src/transitions/drip-wipe.ts +109 -0
  335. package/src/transitions/ember-scatter.ts +94 -0
  336. package/src/transitions/film-burn.ts +101 -0
  337. package/src/transitions/film-grain.ts +78 -0
  338. package/src/transitions/flow-warp.ts +51 -0
  339. package/src/transitions/fluid-flow.ts +94 -0
  340. package/src/transitions/glass-shatter.ts +86 -0
  341. package/src/transitions/glitch.ts +59 -0
  342. package/src/transitions/god-rays-reveal.ts +110 -0
  343. package/src/transitions/gravity-pull.ts +65 -0
  344. package/src/transitions/grid-reveal.ts +53 -0
  345. package/src/transitions/heat-haze.ts +51 -0
  346. package/src/transitions/index.ts +63 -0
  347. package/src/transitions/ink-bloom.ts +76 -0
  348. package/src/transitions/ink-diffuse.ts +90 -0
  349. package/src/transitions/iris-zoom.ts +67 -0
  350. package/src/transitions/kinetic-bands.ts +58 -0
  351. package/src/transitions/lenticular-flip.ts +73 -0
  352. package/src/transitions/light-leak.ts +43 -0
  353. package/src/transitions/linear-blur.ts +40 -0
  354. package/src/transitions/liquid-chrome.ts +114 -0
  355. package/src/transitions/liquid-morph.ts +50 -0
  356. package/src/transitions/lumina-melt.ts +36 -0
  357. package/src/transitions/mosaic.ts +58 -0
  358. package/src/transitions/noise-dissolve.ts +41 -0
  359. package/src/transitions/page-curl.ts +165 -0
  360. package/src/transitions/paint-bleed.ts +59 -0
  361. package/src/transitions/pinwheel.ts +40 -0
  362. package/src/transitions/pixelate.ts +26 -0
  363. package/src/transitions/polka-dots-curtain.ts +46 -0
  364. package/src/transitions/polygon-flip.ts +97 -0
  365. package/src/transitions/portal-dive.ts +83 -0
  366. package/src/transitions/prism-split.ts +52 -0
  367. package/src/transitions/push.ts +34 -0
  368. package/src/transitions/radial-reveal.ts +31 -0
  369. package/src/transitions/ripple-wave.ts +135 -0
  370. package/src/transitions/ripple.ts +43 -0
  371. package/src/transitions/shape-reveal.ts +53 -0
  372. package/src/transitions/shockwave.ts +56 -0
  373. package/src/transitions/singularity.ts +59 -0
  374. package/src/transitions/slide.ts +76 -0
  375. package/src/transitions/smoldering-edge.ts +74 -0
  376. package/src/transitions/split.ts +53 -0
  377. package/src/transitions/swirl.ts +42 -0
  378. package/src/transitions/tangent-motion-blur.ts +58 -0
  379. package/src/transitions/tile-scatter.ts +122 -0
  380. package/src/transitions/warp-zoom.ts +70 -0
  381. package/src/transitions/wave-stripes.ts +55 -0
  382. package/src/transitions/wind.ts +48 -0
  383. package/src/transitions/wipe-directional.ts +26 -0
  384. package/src/types.ts +87 -0
@@ -0,0 +1,114 @@
1
+ import { defineTransition } from "./define.js";
2
+ /**
3
+ * A liquid-metal blob expands from the centre, showing `to` through its
4
+ * glossy surface. The silhouette is a three-lobe metaball with small
5
+ * orbital wobbles so the boundary feels organic rather than a clean
6
+ * circle. Inside the blob, a fake specular highlight (overhead-left
7
+ * light) and rim brightening derived from the sampled `to` luminance
8
+ * produce the T-1000 chrome read — all gain derived from sampled content,
9
+ * so the full-frame rule holds (no synthetic white).
10
+ *
11
+ * Sample UVs only ever shift inward, so the clamp stays a no-op (no
12
+ * radial streaks from out-of-bounds reads). Specular + rim + refraction
13
+ * all scale by a `4·p·(1-p)` envelope, so at progress 0 and 1 the
14
+ * mercury shading collapses to pure from/to respectively.
15
+ */
16
+ export const liquidChrome = defineTransition({
17
+ name: "liquid-chrome",
18
+ defaults: {
19
+ shine: 0.9,
20
+ rim: 0.25,
21
+ wobble: 0.12,
22
+ refraction: 0.035,
23
+ reflection: 0.0,
24
+ },
25
+ glsl: `
26
+ uniform float uShine;
27
+ uniform float uRim;
28
+ uniform float uWobble;
29
+ uniform float uRefraction;
30
+ uniform float uReflection;
31
+
32
+ // Polynomial smooth-min for organic metaball union.
33
+ float smin(float a, float b, float k) {
34
+ float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0);
35
+ return mix(b, a, h) - k * h * (1.0 - h);
36
+ }
37
+
38
+ vec4 transition(vec2 uv) {
39
+ float aspect = uResolution.x / uResolution.y;
40
+ vec2 c = vec2(0.5);
41
+ vec2 aDelta = vec2((uv.x - c.x) * aspect, uv.y - c.y);
42
+ float maxR = sqrt(aspect * aspect * 0.25 + 0.25);
43
+
44
+ // Blob radius grows from fully off-frame (negative) to comfortably
45
+ // past the farthest corner — guarantees clean endpoints.
46
+ float blobR = mix(-0.2, maxR + 0.25, uProgress);
47
+
48
+ // Orbital wobble: two small satellite blobs on curved paths. At
49
+ // progress=0 blobR is negative so they're already off-frame; at
50
+ // progress=1 blobR is huge so wobble is subsumed into the main mass.
51
+ float t = uProgress;
52
+ vec2 o1 = vec2(sin(t * 8.0), cos(t * 6.0)) * uWobble;
53
+ vec2 o2 = vec2(cos(t * 7.0), -sin(t * 5.0)) * uWobble;
54
+
55
+ // Three-lobe SDF, union via smooth-min.
56
+ float d1 = length(aDelta) - blobR;
57
+ float d2 = length(aDelta - o1 * 0.35) - blobR * 0.82;
58
+ float d3 = length(aDelta - o2 * 0.35) - blobR * 0.82;
59
+ float d = smin(smin(d1, d2, 0.08), d3, 0.08);
60
+
61
+ // Inside-blob membership, with a narrow soft edge so the silhouette
62
+ // doesn't alias but the body stays crisp.
63
+ float insideMask = 1.0 - smoothstep(-0.006, 0.006, d);
64
+
65
+ // Envelope so all surface shading vanishes at the endpoints.
66
+ float envelope = 4.0 * uProgress * (1.0 - uProgress);
67
+
68
+ // Depth within blob: 0 at centre, 1 at rim.
69
+ float depthT = clamp(1.0 + d / max(blobR, 0.001), 0.0, 1.0);
70
+
71
+ // Radial direction from blob core. Used for both refraction offset
72
+ // and as a cheap surface-normal approximation for shading.
73
+ vec2 nDir = length(aDelta) > 1e-4 ? aDelta / length(aDelta) : vec2(0.0);
74
+
75
+ // Refraction: sample to from slightly inward — depth-T weighted so
76
+ // the centre is undistorted and the rim bends sharpest. Stays in
77
+ // bounds because the shift is always toward the blob core.
78
+ float refract = uRefraction * depthT * envelope;
79
+ vec2 refractOffset = nDir * refract;
80
+ vec2 refractUv = clamp(uv - vec2(refractOffset.x / aspect, refractOffset.y), 0.0, 1.0);
81
+ vec4 toSample = getToColor(refractUv);
82
+
83
+ // Specular: fake overhead-left light bouncing off the "normal".
84
+ vec2 lightDir = vec2(-0.7071, -0.7071);
85
+ float lightDot = max(dot(nDir, lightDir), 0.0);
86
+ float specBand = smoothstep(0.35, 0.95, depthT);
87
+ float spec = pow(lightDot, 6.0) * specBand * envelope;
88
+
89
+ // Rim brightening near the silhouette. Ramp by depthT so only the
90
+ // outer shell of the blob catches the rim.
91
+ float rimShell = smoothstep(0.82, 1.0, depthT);
92
+ float rimAmt = rimShell * envelope * uRim;
93
+
94
+ // Apply gain from sampled luminance — keeps all output within content.
95
+ float lum = dot(toSample.rgb, vec3(0.299, 0.587, 0.114));
96
+ vec3 chromed = toSample.rgb + (1.0 - toSample.rgb) * lum * (spec * uShine + rimAmt);
97
+
98
+ // Environment reflection: sample the env map using the surface normal
99
+ // direction as a (coarse) env lookup, and blend stronger at the rim
100
+ // where fresnel would peak on a real dielectric. Gated by uReflection
101
+ // so the default (0) is a no-op; envelope keeps endpoints clean.
102
+ if (uReflection > 0.0) {
103
+ vec2 envUv = vec2(0.5 + 0.5 * nDir.x, 0.5 - 0.5 * nDir.y);
104
+ vec3 envColor = getEnvironment(envUv).rgb;
105
+ float reflectBand = mix(0.15, 0.9, depthT) * envelope * uReflection;
106
+ chromed = mix(chromed, envColor, reflectBand);
107
+ }
108
+
109
+ vec4 fromColor = getFromColor(uv);
110
+ return mix(fromColor, vec4(chromed, 1.0), insideMask);
111
+ }
112
+ `,
113
+ });
114
+ //# sourceMappingURL=liquid-chrome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liquid-chrome.js","sourceRoot":"","sources":["../../src/transitions/liquid-chrome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC;IAC3C,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE;QACR,KAAK,EAAE,GAAG;QACV,GAAG,EAAE,IAAI;QACT,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,GAAG;KAChB;IACD,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuFP;CACA,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const liquidMorph: import("../types.js").Transition<import("@vysmo/gl-core").Widen<{
2
+ readonly scale: 3;
3
+ readonly strength: 0.1;
4
+ readonly flow: 3;
5
+ }>>;
6
+ //# sourceMappingURL=liquid-morph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liquid-morph.d.ts","sourceRoot":"","sources":["../../src/transitions/liquid-morph.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;;GA+CtB,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { defineTransition } from "./define.js";
2
+ export const liquidMorph = defineTransition({
3
+ name: "liquid-morph",
4
+ defaults: {
5
+ scale: 3,
6
+ strength: 0.1,
7
+ flow: 3,
8
+ },
9
+ glsl: `
10
+ uniform float uScale;
11
+ uniform float uStrength;
12
+ uniform float uFlow;
13
+
14
+ float hash21(vec2 p) {
15
+ return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
16
+ }
17
+
18
+ float valueNoise(vec2 p) {
19
+ vec2 i = floor(p);
20
+ vec2 f = fract(p);
21
+ f = f * f * (3.0 - 2.0 * f);
22
+ float a = hash21(i);
23
+ float b = hash21(i + vec2(1.0, 0.0));
24
+ float c = hash21(i + vec2(0.0, 1.0));
25
+ float d = hash21(i + vec2(1.0, 1.0));
26
+ return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
27
+ }
28
+
29
+ // Evolving 2D flow field: noise shifts over progress so the distortion
30
+ // pattern moves, not just scales.
31
+ vec2 flow(vec2 p, float t) {
32
+ float nx = valueNoise(p + vec2(t, 0.0));
33
+ float ny = valueNoise(p + vec2(0.0, t) + vec2(13.7, 7.2));
34
+ return vec2(nx, ny) - 0.5;
35
+ }
36
+
37
+ vec4 transition(vec2 uv) {
38
+ // Envelope zeroes at endpoints, peaks mid-transition.
39
+ float env = 4.0 * uProgress * (1.0 - uProgress);
40
+ vec2 offset = flow(uv * uScale, uProgress * uFlow) * uStrength * env;
41
+
42
+ vec2 fromUv = clamp(uv + offset, 0.0, 1.0);
43
+ vec2 toUv = clamp(uv - offset, 0.0, 1.0);
44
+
45
+ float mixW = smoothstep(0.3, 0.7, uProgress);
46
+ return mix(getFromColor(fromUv), getToColor(toUv), mixW);
47
+ }
48
+ `,
49
+ });
50
+ //# sourceMappingURL=liquid-morph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liquid-morph.js","sourceRoot":"","sources":["../../src/transitions/liquid-morph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;IAC1C,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE;QACR,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,GAAG;QACb,IAAI,EAAE,CAAC;KACR;IACD,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCP;CACA,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Inspired by gl-transitions' luminamelt. Content-aware dissolve: each pixel
3
+ * transitions based on its brightness in the "from" image. Brighter pixels
4
+ * transition first, darker pixels last — creating a melt-like effect driven
5
+ * by image content, not a uniform or noise threshold.
6
+ */
7
+ export declare const luminaMelt: import("../types.js").Transition<import("@vysmo/gl-core").Widen<{
8
+ readonly softness: 0.15;
9
+ readonly invert: 0;
10
+ }>>;
11
+ //# sourceMappingURL=lumina-melt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lumina-melt.d.ts","sourceRoot":"","sources":["../../src/transitions/lumina-melt.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;GA2BrB,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { defineTransition } from "./define.js";
2
+ /**
3
+ * Inspired by gl-transitions' luminamelt. Content-aware dissolve: each pixel
4
+ * transitions based on its brightness in the "from" image. Brighter pixels
5
+ * transition first, darker pixels last — creating a melt-like effect driven
6
+ * by image content, not a uniform or noise threshold.
7
+ */
8
+ export const luminaMelt = defineTransition({
9
+ name: "lumina-melt",
10
+ defaults: {
11
+ softness: 0.15,
12
+ invert: 0,
13
+ },
14
+ glsl: `
15
+ uniform float uSoftness;
16
+ uniform float uInvert;
17
+
18
+ vec4 transition(vec2 uv) {
19
+ vec4 fromColor = getFromColor(uv);
20
+ vec4 toColor = getToColor(uv);
21
+
22
+ // ITU-R BT.601 luminance.
23
+ float luma = dot(fromColor.rgb, vec3(0.299, 0.587, 0.114));
24
+
25
+ // invert=0: bright pixels transition first (fieldValue = 1 - luma)
26
+ // invert=1: dark pixels transition first (fieldValue = luma)
27
+ float fieldValue = mix(1.0 - luma, luma, uInvert);
28
+
29
+ float threshold = uProgress * (1.0 + 2.0 * uSoftness) - uSoftness;
30
+ float w = smoothstep(threshold - uSoftness, threshold + uSoftness, fieldValue);
31
+ // w=1: pixel hasn't melted yet (still from)
32
+ return mix(toColor, fromColor, w);
33
+ }
34
+ `,
35
+ });
36
+ //# sourceMappingURL=lumina-melt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lumina-melt.js","sourceRoot":"","sources":["../../src/transitions/lumina-melt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC;IACzC,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE;QACR,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,CAAC;KACV;IACD,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;CAoBP;CACA,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Tile-shuffle reveal: the frame is partitioned into cells that transition
3
+ * on staggered start times. Each tile picks a random direction; its
4
+ * `from` sample slides OUT in that direction while its `to` sample
5
+ * arrives from the SAME direction — so every tile reads as one continuous
6
+ * flow from a to b instead of reversing at the midpoint.
7
+ */
8
+ export declare const mosaic: import("../types.js").Transition<import("@vysmo/gl-core").Widen<{
9
+ readonly count: 14;
10
+ readonly jitter: 0.08;
11
+ readonly stagger: 0.4;
12
+ }>>;
13
+ //# sourceMappingURL=mosaic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mosaic.d.ts","sourceRoot":"","sources":["../../src/transitions/mosaic.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;;;;GAgDjB,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { defineTransition } from "./define.js";
2
+ /**
3
+ * Tile-shuffle reveal: the frame is partitioned into cells that transition
4
+ * on staggered start times. Each tile picks a random direction; its
5
+ * `from` sample slides OUT in that direction while its `to` sample
6
+ * arrives from the SAME direction — so every tile reads as one continuous
7
+ * flow from a to b instead of reversing at the midpoint.
8
+ */
9
+ export const mosaic = defineTransition({
10
+ name: "mosaic",
11
+ defaults: {
12
+ count: 14,
13
+ jitter: 0.08,
14
+ stagger: 0.4,
15
+ },
16
+ glsl: `
17
+ uniform float uCount;
18
+ uniform float uJitter;
19
+ uniform float uStagger;
20
+
21
+ float hash21(vec2 p) {
22
+ return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
23
+ }
24
+ vec2 hash22(vec2 p) {
25
+ return vec2(
26
+ fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453),
27
+ fract(sin(dot(p, vec2(39.3468, 11.1357))) * 24678.1234)
28
+ );
29
+ }
30
+
31
+ vec4 transition(vec2 uv) {
32
+ // 1×1 = full fade, 2×2 = quad-split — neither reads as "mosaic".
33
+ // Clamp here so the transition is reliable regardless of caller input.
34
+ float count = max(uCount, 3.0);
35
+ vec2 cell = floor(uv * count);
36
+
37
+ // Random unit direction per cell.
38
+ vec2 rawDir = hash22(cell) * 2.0 - 1.0;
39
+ vec2 dir = rawDir / max(length(rawDir), 0.0001);
40
+
41
+ // Staggered per-cell transition, monotonic in uProgress.
42
+ float priority = hash21(cell);
43
+ float start = priority * uStagger;
44
+ float localP = clamp((uProgress - start) / max(1.0 - uStagger, 0.0001), 0.0, 1.0);
45
+
46
+ // One-way flow: from-sample slides out in dir, to-sample arrives from
47
+ // the same dir. Same velocity + direction through the crossfade, so the
48
+ // tile reads as one continuous movement instead of out-and-back.
49
+ // Mirror-sample so out-of-range UVs reflect into in-bounds content
50
+ // instead of clamping into edge-color streaks.
51
+ vec2 fromUv = mirrorUv(uv + dir * uJitter * localP);
52
+ vec2 toUv = mirrorUv(uv + dir * uJitter * (localP - 1.0));
53
+
54
+ return mix(getFromColor(fromUv), getToColor(toUv), localP);
55
+ }
56
+ `,
57
+ });
58
+ //# sourceMappingURL=mosaic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mosaic.js","sourceRoot":"","sources":["../../src/transitions/mosaic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,gBAAgB,CAAC;IACrC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,GAAG;KACb;IACD,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCP;CACA,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const noiseDissolve: import("../types.js").Transition<import("@vysmo/gl-core").Widen<{
2
+ readonly scale: 20;
3
+ readonly softness: 0.05;
4
+ }>>;
5
+ //# sourceMappingURL=noise-dissolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noise-dissolve.d.ts","sourceRoot":"","sources":["../../src/transitions/noise-dissolve.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;GAsCxB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { defineTransition } from "./define.js";
2
+ export const noiseDissolve = defineTransition({
3
+ name: "noise-dissolve",
4
+ defaults: {
5
+ scale: 20,
6
+ softness: 0.05,
7
+ },
8
+ glsl: `
9
+ uniform float uScale;
10
+ uniform float uSoftness;
11
+
12
+ float hash21(vec2 p) {
13
+ return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
14
+ }
15
+
16
+ // Bilinearly-smoothed value noise.
17
+ float valueNoise(vec2 p) {
18
+ vec2 i = floor(p);
19
+ vec2 f = fract(p);
20
+ f = f * f * (3.0 - 2.0 * f);
21
+ float a = hash21(i);
22
+ float b = hash21(i + vec2(1.0, 0.0));
23
+ float c = hash21(i + vec2(0.0, 1.0));
24
+ float d = hash21(i + vec2(1.0, 1.0));
25
+ return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
26
+ }
27
+
28
+ vec4 transition(vec2 uv) {
29
+ // Sample a noise field; each pixel gets a "transition time" in [0,1].
30
+ float n = valueNoise(uv * uScale);
31
+
32
+ // Threshold moves from just-below-0 to just-above-1, so the feather
33
+ // is fully off the noise range at the endpoints.
34
+ float threshold = uProgress * (1.0 + 2.0 * uSoftness) - uSoftness;
35
+ float w = smoothstep(threshold - uSoftness, threshold + uSoftness, n);
36
+
37
+ return mix(getToColor(uv), getFromColor(uv), w);
38
+ }
39
+ `,
40
+ });
41
+ //# sourceMappingURL=noise-dissolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noise-dissolve.js","sourceRoot":"","sources":["../../src/transitions/noise-dissolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAC;IAC5C,IAAI,EAAE,gBAAgB;IACtB,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,IAAI;KACf;IACD,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BP;CACA,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Classic book-page curl — impossible in a fragment shader because it
3
+ * needs real geometry deformation, silhouette, and depth-ordered self-
4
+ * occlusion.
5
+ *
6
+ * A tilted hinge line sweeps across the plane. Vertices on the curled
7
+ * side wrap around a cylinder whose effective radius grows with the
8
+ * fraction of the sweep completed (sqrt growth: a real rolled page
9
+ * starts tight and fattens as more length wraps). Front face samples
10
+ * `from` with Lambert-ish shading; back face uses the configurable
11
+ * `backColor` with softened shading so it reads as bright paper even
12
+ * where the key light can't reach.
13
+ *
14
+ * Instance 0 is a back plane showing `to`; it also casts a soft drop
15
+ * shadow from the curl, so the rolled paper visibly floats above the
16
+ * revealed page. Shadow envelope is 4·p·(1-p) so it gates cleanly to
17
+ * zero at both endpoints.
18
+ *
19
+ * Mesh is densely subdivided along the curl direction (128 cells) so
20
+ * the cylinder silhouette reads smooth at typical canvas sizes.
21
+ *
22
+ * Endpoints: progress 0 → every foreground vertex flat at z=0, front-
23
+ * facing, `from` at its uv, vLight=1; shadow mask zero. Pixel-pure
24
+ * from. Progress 1 → every foreground vertex curled past the viewport
25
+ * edge (clipped out), back plane visible with shadow mask zero. Pixel-
26
+ * pure to.
27
+ */
28
+ export declare const pageCurl: import("../types.js").Transition<import("@vysmo/gl-core").Widen<{
29
+ readonly tilt: 0.12;
30
+ readonly backColor: readonly [0.97, 0.96, 0.94];
31
+ }>>;
32
+ //# sourceMappingURL=page-curl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-curl.d.ts","sourceRoot":"","sources":["../../src/transitions/page-curl.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,QAAQ;;;GAuInB,CAAC"}
@@ -0,0 +1,165 @@
1
+ import { defineTransition } from "./define.js";
2
+ /**
3
+ * Classic book-page curl — impossible in a fragment shader because it
4
+ * needs real geometry deformation, silhouette, and depth-ordered self-
5
+ * occlusion.
6
+ *
7
+ * A tilted hinge line sweeps across the plane. Vertices on the curled
8
+ * side wrap around a cylinder whose effective radius grows with the
9
+ * fraction of the sweep completed (sqrt growth: a real rolled page
10
+ * starts tight and fattens as more length wraps). Front face samples
11
+ * `from` with Lambert-ish shading; back face uses the configurable
12
+ * `backColor` with softened shading so it reads as bright paper even
13
+ * where the key light can't reach.
14
+ *
15
+ * Instance 0 is a back plane showing `to`; it also casts a soft drop
16
+ * shadow from the curl, so the rolled paper visibly floats above the
17
+ * revealed page. Shadow envelope is 4·p·(1-p) so it gates cleanly to
18
+ * zero at both endpoints.
19
+ *
20
+ * Mesh is densely subdivided along the curl direction (128 cells) so
21
+ * the cylinder silhouette reads smooth at typical canvas sizes.
22
+ *
23
+ * Endpoints: progress 0 → every foreground vertex flat at z=0, front-
24
+ * facing, `from` at its uv, vLight=1; shadow mask zero. Pixel-pure
25
+ * from. Progress 1 → every foreground vertex curled past the viewport
26
+ * edge (clipped out), back plane visible with shadow mask zero. Pixel-
27
+ * pure to.
28
+ */
29
+ export const pageCurl = defineTransition({
30
+ name: "page-curl",
31
+ mesh: { subdivisions: [128, 32], instances: 2 },
32
+ defaults: {
33
+ tilt: 0.12,
34
+ backColor: [0.97, 0.96, 0.94],
35
+ },
36
+ vertex: `
37
+ uniform float uTilt;
38
+ const float uRadius = 0.5;
39
+
40
+ out float vLight;
41
+ out float vAlpha;
42
+ flat out int vInstance;
43
+
44
+ #define PI 3.14159265359
45
+
46
+ void main() {
47
+ vInstance = gl_InstanceID;
48
+ vUv = aUv;
49
+
50
+ if (gl_InstanceID == 0) {
51
+ gl_Position = vec4(aPosition, 0.99, 1.0);
52
+ vLight = 1.0;
53
+ vAlpha = 1.0;
54
+ return;
55
+ }
56
+
57
+ vec2 sweepDir = vec2(cos(uTilt), sin(uTilt));
58
+ vec2 hingeDir = vec2(-sweepDir.y, sweepDir.x);
59
+
60
+ float s = dot(aPosition, sweepDir);
61
+ float h = dot(aPosition, hingeDir);
62
+
63
+ float maxExtent = abs(sweepDir.x) + abs(sweepDir.y);
64
+ float hingePos = mix(
65
+ maxExtent + uRadius,
66
+ -maxExtent - 2.0 * uRadius,
67
+ uProgress
68
+ );
69
+
70
+ float d = s - hingePos;
71
+
72
+ if (d <= 0.0) {
73
+ gl_Position = vec4(aPosition, 0.0, 1.0);
74
+ vLight = 1.0;
75
+ vAlpha = 1.0;
76
+ return;
77
+ }
78
+
79
+ float totalTravel = 2.0 * maxExtent + 3.0 * uRadius;
80
+ float traveled = maxExtent + uRadius - hingePos;
81
+ float rEff = uRadius * (0.18 + 0.82 * sqrt(traveled / totalTravel));
82
+
83
+ float theta = d / rEff;
84
+ float newS = hingePos + rEff * sin(theta);
85
+ float newZ = rEff * (cos(theta) - 1.0);
86
+
87
+ vec2 newPos = newS * sweepDir + h * hingeDir;
88
+ gl_Position = vec4(newPos, newZ, 1.0);
89
+
90
+ vec3 normal = vec3(sin(theta) * sweepDir, -cos(theta));
91
+ vec3 lightDir = normalize(vec3(0.35, 0.55, -1.0));
92
+ vLight = clamp(0.5 + 0.55 * dot(normal, lightDir), 0.3, 1.0);
93
+
94
+ vAlpha = 1.0 - smoothstep(PI, PI * 2.0, theta);
95
+ }
96
+ `,
97
+ glsl: `
98
+ uniform float uTilt;
99
+ uniform vec3 uBackColor;
100
+ const float uRadius = 0.5;
101
+
102
+ in float vLight;
103
+ in float vAlpha;
104
+ flat in int vInstance;
105
+
106
+ vec4 transition(vec2 uv) {
107
+ if (vInstance == 0) {
108
+ // Back plane: the destination page, with a soft drop shadow cast
109
+ // by the curl floating above it. Shadow is strongest right past
110
+ // the hinge (where the curl overhangs) and fades over a few
111
+ // effective radii. 4·p·(1-p) envelope keeps endpoints pure.
112
+ vec3 col = getToColor(uv).rgb;
113
+
114
+ vec2 sweepDir = vec2(cos(uTilt), sin(uTilt));
115
+ float maxExtent = abs(sweepDir.x) + abs(sweepDir.y);
116
+ float hingePos = mix(
117
+ maxExtent + uRadius,
118
+ -maxExtent - 2.0 * uRadius,
119
+ uProgress
120
+ );
121
+
122
+ vec2 clipPos = uv * 2.0 - 1.0;
123
+ float s = dot(clipPos, sweepDir);
124
+ float d = s - hingePos;
125
+
126
+ float totalTravel = 2.0 * maxExtent + 3.0 * uRadius;
127
+ float traveled = max(maxExtent + uRadius - hingePos, 0.0);
128
+ float rEff = uRadius * (0.18 + 0.82 * sqrt(traveled / totalTravel));
129
+
130
+ float distPastHinge = max(d, 0.0);
131
+ float shadow = 1.0 - smoothstep(0.0, 3.5 * rEff, distPastHinge);
132
+ float envelope = 4.0 * uProgress * (1.0 - uProgress);
133
+ col *= 1.0 - shadow * 0.55 * envelope;
134
+
135
+ return vec4(col, 1.0);
136
+ }
137
+
138
+ if (vAlpha < 0.01) discard;
139
+
140
+ vec3 col;
141
+ float alpha;
142
+ if (gl_FrontFacing) {
143
+ col = getFromColor(uv).rgb * vLight;
144
+ // Smooth fade on the image side so the seam at the wrap-around
145
+ // (theta ≈ 2π, page disappearing past itself) doesn't read as a
146
+ // hard edge.
147
+ alpha = vAlpha;
148
+ } else {
149
+ // Paper back: author-chosen colour with gentle shading that never
150
+ // drops below ~85%, so the back reads as diffusely lit paper even
151
+ // where the key light can't reach (the far side of the curl).
152
+ float backLight = 0.85 + 0.15 * vLight;
153
+ col = uBackColor * backLight;
154
+ // Always opaque inside the visible mesh — paper isn't transparent.
155
+ // Letting the back's alpha follow vAlpha lets the next page bleed
156
+ // through the back during the wrap-around fade, breaking the
157
+ // illusion of a solid page. Hard discard above (vAlpha < 0.01)
158
+ // already handles culling for fully wrapped vertices.
159
+ alpha = 1.0;
160
+ }
161
+ return vec4(col, alpha);
162
+ }
163
+ `,
164
+ });
165
+ //# sourceMappingURL=page-curl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-curl.js","sourceRoot":"","sources":["../../src/transitions/page-curl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,gBAAgB,CAAC;IACvC,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,EAAE,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE;IAC/C,QAAQ,EAAE;QACR,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU;KACvC;IACD,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DT;IACC,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEP;CACA,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Ink-like directional bleed: a dominant gradient sweeps across, with noise
3
+ * perturbing the wavefront edge so it feels organic (watercolor / ink on
4
+ * paper) rather than a clean wipe or a uniform dissolve.
5
+ */
6
+ export declare const paintBleed: import("../types.js").Transition<import("@vysmo/gl-core").Widen<{
7
+ readonly direction: readonly [-1, 0];
8
+ readonly scale: 10;
9
+ readonly softness: 0.02;
10
+ readonly noiseStrength: 0.35;
11
+ }>>;
12
+ //# sourceMappingURL=paint-bleed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paint-bleed.d.ts","sourceRoot":"","sources":["../../src/transitions/paint-bleed.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;GAmDrB,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { defineTransition } from "./define.js";
2
+ /**
3
+ * Ink-like directional bleed: a dominant gradient sweeps across, with noise
4
+ * perturbing the wavefront edge so it feels organic (watercolor / ink on
5
+ * paper) rather than a clean wipe or a uniform dissolve.
6
+ */
7
+ export const paintBleed = defineTransition({
8
+ name: "paint-bleed",
9
+ defaults: {
10
+ direction: [-1, 0],
11
+ scale: 10,
12
+ softness: 0.02,
13
+ noiseStrength: 0.35,
14
+ },
15
+ glsl: `
16
+ uniform vec2 uDirection;
17
+ uniform float uScale;
18
+ uniform float uSoftness;
19
+ uniform float uNoiseStrength;
20
+
21
+ float hash21(vec2 p) {
22
+ return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
23
+ }
24
+
25
+ float valueNoise(vec2 p) {
26
+ vec2 i = floor(p);
27
+ vec2 f = fract(p);
28
+ f = f * f * (3.0 - 2.0 * f);
29
+ float a = hash21(i);
30
+ float b = hash21(i + vec2(1.0, 0.0));
31
+ float c = hash21(i + vec2(0.0, 1.0));
32
+ float d = hash21(i + vec2(1.0, 1.0));
33
+ return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
34
+ }
35
+
36
+ vec4 transition(vec2 uv) {
37
+ vec2 d = normalize(uDirection);
38
+ // Max |dot(uv - 0.5, -d)| over uv ∈ [0,1]² is (|dx| + |dy|) * 0.5.
39
+ // Without dividing by it, gradient extends beyond [0, 1] for diagonal
40
+ // directions and the threshold-based smoothstep can't fully reveal the
41
+ // corners at progress=1 — leaving a sliver of the previous image.
42
+ float maxProj = max((abs(d.x) + abs(d.y)) * 0.5, 0.0001);
43
+ float gradient = 0.5 + dot(uv - 0.5, -d) / (2.0 * maxProj);
44
+
45
+ // Noise only perturbs the wavefront edge, not the overall progression.
46
+ float perturbation = (valueNoise(uv * uScale) - 0.5) * uNoiseStrength;
47
+ float fieldValue = gradient + perturbation;
48
+
49
+ // Extend threshold range to accommodate noise extrema → endpoints stay clean.
50
+ float noiseRange = uNoiseStrength * 0.5;
51
+ float totalEdge = uSoftness + noiseRange;
52
+ float threshold = uProgress * (1.0 + 2.0 * totalEdge) - totalEdge;
53
+ float w = smoothstep(threshold - uSoftness, threshold + uSoftness, fieldValue);
54
+
55
+ return mix(getToColor(uv), getFromColor(uv), w);
56
+ }
57
+ `,
58
+ });
59
+ //# sourceMappingURL=paint-bleed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paint-bleed.js","sourceRoot":"","sources":["../../src/transitions/paint-bleed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC;IACzC,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE;QACR,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,IAAI;KACpB;IACD,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CP;CACA,CAAC,CAAC"}