@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,40 @@
1
+ import { defineTransition } from "./define.js";
2
+
3
+ /**
4
+ * Multi-spoke angular sweep: `spokes` wedges each open simultaneously around
5
+ * a center, sweeping through their angular slice as progress grows. A
6
+ * rotating "fan" reveal, aspect-corrected so spokes stay radial.
7
+ */
8
+ export const pinwheel = defineTransition({
9
+ name: "pinwheel",
10
+ defaults: {
11
+ center: [0.5, 0.5],
12
+ spokes: 8,
13
+ softness: 0.05,
14
+ },
15
+ glsl: `
16
+ uniform vec2 uCenter;
17
+ uniform float uSpokes;
18
+ uniform float uSoftness;
19
+
20
+ const float TWO_PI = 6.2831853;
21
+
22
+ vec4 transition(vec2 uv) {
23
+ // Aspect-correct so spokes remain radial on non-square canvases.
24
+ vec2 delta = (uv - uCenter) * vec2(uResolution.x / uResolution.y, 1.0);
25
+ float angle = atan(delta.y, delta.x);
26
+ float slice = TWO_PI / max(uSpokes, 2.0);
27
+
28
+ // Position within a single spoke's angular range, 0 to slice.
29
+ float folded = mod(angle, slice);
30
+
31
+ // Softness expressed as a fraction of the slice so it scales with spoke count.
32
+ float s = slice * uSoftness;
33
+ // Threshold sweeps from -s (outside range) to slice+s (outside range), so
34
+ // feather never reaches visible pixels at the endpoints.
35
+ float threshold = -s + uProgress * (slice + 2.0 * s);
36
+ float w = smoothstep(threshold - s, threshold + s, folded);
37
+ return mix(getToColor(uv), getFromColor(uv), w);
38
+ }
39
+ `,
40
+ });
@@ -0,0 +1,26 @@
1
+ import { defineTransition } from "./define.js";
2
+
3
+ export const pixelate = defineTransition({
4
+ name: "pixelate",
5
+ defaults: {
6
+ maxBlockSize: 40,
7
+ },
8
+ glsl: `
9
+ uniform float uMaxBlockSize;
10
+
11
+ vec4 transition(vec2 uv) {
12
+ // Block size peaks at midpoint, 1px at endpoints.
13
+ float env = 4.0 * uProgress * (1.0 - uProgress);
14
+ float blockSize = max(1.0, uMaxBlockSize * env);
15
+
16
+ // Quantize to a grid of blockSize-pixel cells, sample from cell centers.
17
+ vec2 pixel = uv * uResolution;
18
+ vec2 quantized = floor(pixel / blockSize) * blockSize + blockSize * 0.5;
19
+ vec2 quantUv = quantized / uResolution;
20
+
21
+ // Crossfade concentrated in the middle 40% when pixelation is heaviest.
22
+ float mixW = smoothstep(0.3, 0.7, uProgress);
23
+ return mix(getFromColor(quantUv), getToColor(quantUv), mixW);
24
+ }
25
+ `,
26
+ });
@@ -0,0 +1,46 @@
1
+ import { defineTransition } from "./define.js";
2
+
3
+ /**
4
+ * Radial dot-grid reveal: every cell of an N×N grid contains a dot that
5
+ * grows to cover its cell, with cells near the center revealing first.
6
+ * Stylized but kept premium by softening the dot edge with smoothstep
7
+ * and bounding maxDotRadius so each dot fully covers its cell at the
8
+ * end (no leftover background between dots).
9
+ */
10
+ export const polkaDotsCurtain = defineTransition({
11
+ name: "polka-dots-curtain",
12
+ defaults: {
13
+ dots: 15,
14
+ center: [0.5, 0.5],
15
+ softness: 0.05,
16
+ },
17
+ glsl: `
18
+ uniform float uDots;
19
+ uniform vec2 uCenter;
20
+ uniform float uSoftness;
21
+
22
+ vec4 transition(vec2 uv) {
23
+ // dots=0 produces degenerate cellPos math (uv*0=0, all pixels in same cell);
24
+ // floor at 1. Clamp here so the transition is reliable regardless of caller input.
25
+ float dots = max(uDots, 1.0);
26
+ vec2 cellPos = fract(uv * dots);
27
+ float dotDist = distance(cellPos, vec2(0.5));
28
+ float distToCenter = distance(uv, uCenter);
29
+
30
+ // Per-cell ignition time: cells near uCenter reveal first.
31
+ float cellRevealTime = distToCenter / 1.4142136;
32
+ float window = 0.6;
33
+ float start = cellRevealTime * (1.0 - window);
34
+ float localP = clamp((uProgress - start) / max(window, 0.0001), 0.0, 1.0);
35
+
36
+ // Dot radius grows from -softness (off) to maxDotRadius+softness (covers
37
+ // cell corners cleanly). 0.85 > sqrt(2)/2 so corners are guaranteed inside.
38
+ float maxDotRadius = 0.85;
39
+ float radius = localP * (maxDotRadius + 2.0 * uSoftness) - uSoftness;
40
+
41
+ float w = 1.0 - smoothstep(radius - uSoftness, radius + uSoftness, dotDist);
42
+
43
+ return mix(getFromColor(uv), getToColor(uv), w);
44
+ }
45
+ `,
46
+ });
@@ -0,0 +1,97 @@
1
+ import { defineTransition } from "./define.js";
2
+
3
+ /**
4
+ * Subdivided plane of square tiles. Each tile flips 180° around a
5
+ * horizontal axis through its centre, staggered by a diagonal wavefront
6
+ * so the flip sweeps top-left → bottom-right with per-tile jitter.
7
+ *
8
+ * Because a tile (quad) is self-symmetric under 180° horizontal flip,
9
+ * its canvas footprint is invariant across the rotation — no "screwed
10
+ * rect" overlap with neighbours. The two triangles that compose each
11
+ * tile share the same per-quad centroid, so they flip together.
12
+ *
13
+ * Front face (angle 0 → π/2) samples `from` at the tile's own uv —
14
+ * source content rides on the flipping card. Back face (angle π/2 → π)
15
+ * samples `to` at gl_FragCoord-based screen uv — destination stays
16
+ * pinned to the canvas, so at progress=1 every pixel is exactly to.
17
+ *
18
+ * Instance 0 is a back plane at z=0.9 cross-fading from → to; it fills
19
+ * the thin moments when a tile is edge-on so the full-frame rule holds.
20
+ *
21
+ * Endpoints: progress 0 → all tiles flat, front-facing, sampling from
22
+ * at aUv = pixel-pure from. Progress 1 → all tiles flat-mirrored (tile
23
+ * is self-symmetric), back-facing, sampling to at screen uv = pixel-
24
+ * pure to.
25
+ */
26
+ export const polygonFlip = defineTransition({
27
+ name: "polygon-flip",
28
+ mesh: { subdivisions: [24, 14], instances: 2 },
29
+ defaults: {
30
+ rim: 0.25,
31
+ },
32
+ vertex: `
33
+ out float vFlip;
34
+ flat out int vInstance;
35
+
36
+ #define PI 3.14159265359
37
+
38
+ void main() {
39
+ vInstance = gl_InstanceID;
40
+ vUv = aUv;
41
+
42
+ if (gl_InstanceID == 0) {
43
+ gl_Position = vec4(aPosition, 0.9, 1.0);
44
+ vFlip = 0.0;
45
+ return;
46
+ }
47
+
48
+ // Diagonal wavefront top-left → bottom-right, plus a strong per-tile
49
+ // jitter so neighbours don't all finish together. aCentroid is per-
50
+ // quad (same for all 6 vertices of a tile) so the whole tile flips
51
+ // as one unit.
52
+ float waveX = (aCentroid.x + 1.0) * 0.5;
53
+ float waveY = 1.0 - (aCentroid.y + 1.0) * 0.5; // top → bottom
54
+ float wave = waveX * 0.55 + waveY * 0.35 + (aOffset - 0.5) * 0.35;
55
+ wave = clamp(wave, 0.0, 1.0);
56
+
57
+ float window = 0.22;
58
+ float start = wave * (1.0 - window);
59
+ float t = smoothstep(start, start + window, uProgress);
60
+ vFlip = t;
61
+
62
+ float angle = t * PI;
63
+ float c = cos(angle);
64
+ float s = sin(angle);
65
+
66
+ vec2 p = aPosition - aCentroid;
67
+ vec3 q = vec3(p.x, p.y * c, p.y * s);
68
+ q.xy += aCentroid;
69
+
70
+ // Slight z-bias forward of the back plane; in-plane rotation produces
71
+ // a small depth spread that helps adjacent tiles resolve cleanly.
72
+ gl_Position = vec4(q.x, q.y, q.z * 0.4 + 0.05, 1.0);
73
+ }
74
+ `,
75
+ glsl: `
76
+ in float vFlip;
77
+ flat in int vInstance;
78
+ uniform float uRim;
79
+
80
+ vec4 transition(vec2 uv) {
81
+ if (vInstance == 0) {
82
+ return mix(getFromColor(uv), getToColor(uv), smoothstep(0.0, 1.0, uProgress));
83
+ }
84
+
85
+ vec2 screenUv = gl_FragCoord.xy / uResolution;
86
+ vec4 col = gl_FrontFacing ? getFromColor(uv) : getToColor(screenUv);
87
+
88
+ // Subtle rim darkening across the flip window — tiles read as
89
+ // tilted cards catching light, without the hard wireframe look
90
+ // that fwidth(bary) edge highlights produce.
91
+ float amt = 4.0 * vFlip * (1.0 - vFlip);
92
+ col.rgb *= 1.0 - amt * uRim;
93
+
94
+ return col;
95
+ }
96
+ `,
97
+ });
@@ -0,0 +1,83 @@
1
+ import { defineTransition } from "./define.js";
2
+
3
+ /**
4
+ * Polar-coordinate portal. A circular reveal front sweeps from the centre
5
+ * outward, and around the front a narrow radial band swirls + magnifies
6
+ * the sampled content to evoke a tunnel mouth. Swirl and magnification
7
+ * fall off both radially (gaussian band around the reveal front) and
8
+ * temporally (zero at progress 0 and 1), which keeps every sample in
9
+ * bounds — no clamp streaks, no empty frame regions.
10
+ *
11
+ * Endpoints: at progress 0/1 the envelope is zero so the sample UV is
12
+ * identity, and the reveal edge sits well outside the frame on both
13
+ * sides, so output is pixel-pure from/to.
14
+ */
15
+ export const portalDive = defineTransition({
16
+ name: "portal-dive",
17
+ defaults: {
18
+ twist: 3.14159,
19
+ depth: 1.0,
20
+ reflection: 0.0,
21
+ },
22
+ glsl: `
23
+ uniform float uTwist;
24
+ uniform float uDepth;
25
+ uniform float uReflection;
26
+
27
+ vec4 transition(vec2 uv) {
28
+ float aspect = uResolution.x / uResolution.y;
29
+ vec2 c = vec2(0.5);
30
+ vec2 aDelta = vec2((uv.x - c.x) * aspect, uv.y - c.y);
31
+ float r = length(aDelta);
32
+ float theta = atan(aDelta.y, aDelta.x);
33
+ float maxR = sqrt(aspect * aspect * 0.25 + 0.25);
34
+
35
+ // Portal front position: negative at progress=0, past the farthest
36
+ // corner at progress=1, for any aspect ratio.
37
+ float portalR = mix(-0.15, maxR + 0.15, uProgress);
38
+
39
+ // Strength of distortion: gaussian band around the portal front,
40
+ // zero at progress 0/1. Both falloffs together guarantee sample UVs
41
+ // stay in-bounds everywhere (keeps clamp streaks out).
42
+ float bandWidth = 0.25;
43
+ float band = exp(-pow((r - portalR) / bandWidth, 2.0));
44
+ float envelope = 4.0 * uProgress * (1.0 - uProgress);
45
+ float strength = band * envelope;
46
+
47
+ // Swirl: rotate sample direction around centre.
48
+ float swirlAngle = strength * uTwist;
49
+ float newTheta = theta + swirlAngle;
50
+
51
+ // Inward pull: sample from a slightly smaller radius so content appears
52
+ // to be drawn toward the portal mouth (magnification = depth feel).
53
+ // Radius only ever DECREASES, so a pixel in bounds stays in bounds.
54
+ float pulledR = r * (1.0 - strength * uDepth * 0.3);
55
+
56
+ vec2 newAD = vec2(cos(newTheta), sin(newTheta)) * pulledR;
57
+ vec2 sampleUv = c + vec2(newAD.x / aspect, newAD.y);
58
+ // Defensive clamp — should be a no-op given the analysis above.
59
+ sampleUv = clamp(sampleUv, 0.0, 1.0);
60
+
61
+ vec4 fromColor = getFromColor(sampleUv);
62
+ vec4 toColor = getToColor(sampleUv);
63
+
64
+ // Soft radial reveal: centre crosses to to first, expanding outward.
65
+ float fade = smoothstep(portalR - 0.08, portalR + 0.08, r);
66
+ vec4 result = mix(toColor, fromColor, fade);
67
+
68
+ // Env glint at the tunnel mouth: use the radial direction as a
69
+ // surface-normal-like lookup into the env map, so the rim reads as a
70
+ // curved glass lip catching reflections. Gated by strength (= band *
71
+ // envelope), which is already zero at endpoints and away from the
72
+ // tunnel mouth — clean endpoints, no global tint bleed.
73
+ if (uReflection > 0.0) {
74
+ vec2 nDir = r > 1e-4 ? aDelta / r : vec2(0.0);
75
+ vec2 envUv = vec2(0.5 + 0.5 * nDir.x, 0.5 - 0.5 * nDir.y);
76
+ vec3 envColor = getEnvironment(envUv).rgb;
77
+ result.rgb = mix(result.rgb, envColor, strength * uReflection);
78
+ }
79
+
80
+ return result;
81
+ }
82
+ `,
83
+ });
@@ -0,0 +1,52 @@
1
+ import { defineTransition } from "./define.js";
2
+
3
+ /**
4
+ * Directional RGB chromatic split. Like looking through a prism along a
5
+ * fixed axis: red and blue channels separate along `direction` while
6
+ * green stays put, then recombine on the to-image. Distinct from
7
+ * chromatic-pulse (which is radial outward from center).
8
+ */
9
+ export const prismSplit = defineTransition({
10
+ name: "prism-split",
11
+ defaults: {
12
+ direction: [1, 0],
13
+ intensity: 0.04,
14
+ softness: 0.2,
15
+ },
16
+ glsl: `
17
+ uniform vec2 uDirection;
18
+ uniform float uIntensity;
19
+ uniform float uSoftness;
20
+
21
+ vec4 transition(vec2 uv) {
22
+ vec2 d = normalize(uDirection);
23
+ float env = 4.0 * uProgress * (1.0 - uProgress);
24
+ // Cap the per-channel split. Past ~0.07 the R/B samples come from
25
+ // unrelated parts of the scene and edge clamping turns the offsets into
26
+ // colored stripes — no longer reads as chromatic aberration. Hard-clamp
27
+ // here so the transition is reliable regardless of caller input.
28
+ float split = env * min(uIntensity, 0.07);
29
+
30
+ vec2 offR = clamp(uv + d * split, 0.0, 1.0);
31
+ vec2 offB = clamp(uv - d * split, 0.0, 1.0);
32
+
33
+ vec3 fromRGB = vec3(
34
+ getFromColor(offR).r,
35
+ getFromColor(uv).g,
36
+ getFromColor(offB).b
37
+ );
38
+ vec3 toRGB = vec3(
39
+ getToColor(offR).r,
40
+ getToColor(uv).g,
41
+ getToColor(offB).b
42
+ );
43
+
44
+ // Crossfade width controlled by softness: 0.7 → fade across middle 70%
45
+ // of progress (range [0.15, 0.85]); higher = gentler, lower = punchier.
46
+ float fadeHalf = clamp(uSoftness, 0.05, 0.95) * 0.5;
47
+ float mixW = smoothstep(0.5 - fadeHalf, 0.5 + fadeHalf, uProgress);
48
+ vec3 rgb = mix(fromRGB, toRGB, mixW);
49
+ return vec4(rgb, 1.0);
50
+ }
51
+ `,
52
+ });
@@ -0,0 +1,34 @@
1
+ import { defineTransition } from "./define.js";
2
+
3
+ export const push = defineTransition({
4
+ name: "push",
5
+ defaults: {
6
+ direction: [1, 0],
7
+ },
8
+ glsl: `
9
+ uniform vec2 uDirection;
10
+
11
+ // Snap a direction vector to the nearest axis-aligned unit (Right/Left/Down/Up).
12
+ // Translation transitions only look right axis-aligned; diagonal inputs leave
13
+ // triangular gaps at corners. Snapping in-shader keeps the visual reliable
14
+ // regardless of caller input, so the UI's axis-only picker matches.
15
+ vec2 snapAxis(vec2 v) {
16
+ vec2 d = normalize(v);
17
+ return abs(d.x) > abs(d.y) ? vec2(sign(d.x), 0.0) : vec2(0.0, sign(d.y));
18
+ }
19
+
20
+ vec4 transition(vec2 uv) {
21
+ vec2 d = snapAxis(uDirection);
22
+ // Both images scroll together in direction -d over time.
23
+ // At progress=0: from fills the frame; to is at +d offset (off-screen).
24
+ // At progress=1: to fills the frame; from is at -d offset (off-screen).
25
+ vec2 fromUv = uv + d * uProgress;
26
+ vec2 toUv = uv - d * (1.0 - uProgress);
27
+
28
+ bool fromVisible = fromUv.x >= 0.0 && fromUv.x <= 1.0
29
+ && fromUv.y >= 0.0 && fromUv.y <= 1.0;
30
+ if (fromVisible) return getFromColor(fromUv);
31
+ return getToColor(toUv);
32
+ }
33
+ `,
34
+ });
@@ -0,0 +1,31 @@
1
+ import { defineTransition } from "./define.js";
2
+
3
+ export const radialReveal = defineTransition({
4
+ name: "radial-reveal",
5
+ defaults: {
6
+ center: [0.5, 0.5],
7
+ softness: 0.05,
8
+ },
9
+ glsl: `
10
+ uniform vec2 uCenter;
11
+ uniform float uSoftness;
12
+
13
+ vec4 transition(vec2 uv) {
14
+ // Measure distance in screen (pixel) space so the reveal stays a true circle
15
+ // on non-square canvases.
16
+ vec2 pixel = uv * uResolution;
17
+ vec2 pixelCenter = uCenter * uResolution;
18
+
19
+ float maxDist = max(
20
+ max(length(pixelCenter), length(pixelCenter - vec2(uResolution.x, 0.0))),
21
+ max(length(pixelCenter - vec2(0.0, uResolution.y)), length(pixelCenter - uResolution))
22
+ );
23
+ float dist = length(pixel - pixelCenter) / maxDist;
24
+
25
+ float radius = uProgress * (1.0 + 2.0 * uSoftness) - uSoftness;
26
+ float w = smoothstep(radius - uSoftness, radius + uSoftness, dist);
27
+
28
+ return mix(getToColor(uv), getFromColor(uv), w);
29
+ }
30
+ `,
31
+ });
@@ -0,0 +1,135 @@
1
+ import { defineTransition } from "./define.js";
2
+
3
+ /**
4
+ * A water-like ripple emanates from a source point. The mesh deforms
5
+ * in z so the wave has real geometric presence (depth, lighting), but
6
+ * the wave shape, surface normal, and refraction are all recomputed
7
+ * per-fragment — so the refraction stays smooth even at high amplitude
8
+ * regardless of mesh subdivision. No faceting, no interpolation
9
+ * crystalline artifacts.
10
+ *
11
+ * Wave profile is asymmetric around the travelling front: sharp cut-
12
+ * off ahead (no pre-wave ripple) and moderate Gaussian decay behind
13
+ * (one dominant leading ring followed by a fading secondary ring).
14
+ * Refraction shifts the sample uv along the in-plane surface normal,
15
+ * so the image visibly bends through the water. A tight specular
16
+ * highlight adds a crest sparkle.
17
+ *
18
+ * Endpoints: envelope = 4·p·(1-p) gates z, refraction, lighting and
19
+ * specular all to zero at progress 0 and 1. The mask is pinned to
20
+ * saturated 0 and 1 respectively — pixel-pure endpoints.
21
+ */
22
+ export const rippleWave = defineTransition({
23
+ name: "ripple-wave",
24
+ mesh: { subdivisions: [48, 48], instances: 1 },
25
+ defaults: {
26
+ amplitude: 0.1,
27
+ source: [0.5, 0.5] as const,
28
+ },
29
+ vertex: `
30
+ uniform float uAmplitude;
31
+ uniform vec2 uSource;
32
+
33
+ out vec2 vClipPos;
34
+
35
+ #define PI 3.14159265359
36
+ #define WAVELENGTH 0.35
37
+ #define MAX_R 3.0
38
+ #define TRANSITION_WIDTH 0.03
39
+
40
+ void main() {
41
+ vUv = aUv;
42
+ vClipPos = aPosition;
43
+
44
+ // Mesh still deforms in z for real 3D presence; fragment will do
45
+ // the smooth per-pixel wave. Both use the same analytic wave.
46
+ vec2 sourceClip = uSource * 2.0 - 1.0;
47
+ float r = distance(aPosition, sourceClip);
48
+ float frontR = mix(
49
+ -TRANSITION_WIDTH,
50
+ MAX_R + TRANSITION_WIDTH,
51
+ uProgress
52
+ );
53
+ float phase = (r - frontR) / WAVELENGTH;
54
+ float k = mix(0.5, 4.0, step(0.0, phase));
55
+ float decay = exp(-phase * phase * k);
56
+ float envelope = 4.0 * uProgress * (1.0 - uProgress);
57
+ float wave = sin(phase * 2.0 * PI) * decay;
58
+ float z = uAmplitude * envelope * wave;
59
+
60
+ gl_Position = vec4(aPosition, -z, 1.0);
61
+ }
62
+ `,
63
+ glsl: `
64
+ uniform float uAmplitude;
65
+ uniform vec2 uSource;
66
+
67
+ in vec2 vClipPos;
68
+
69
+ #define PI 3.14159265359
70
+ #define WAVELENGTH 0.35
71
+ #define MAX_R 3.0
72
+ #define TRANSITION_WIDTH 0.03
73
+
74
+ vec4 transition(vec2 uv) {
75
+ vec2 sourceClip = uSource * 2.0 - 1.0;
76
+ vec2 toSource = vClipPos - sourceClip;
77
+ float r = length(toSource);
78
+ vec2 radialDir = r > 1e-5 ? toSource / r : vec2(0.0);
79
+
80
+ float frontR = mix(
81
+ -TRANSITION_WIDTH,
82
+ MAX_R + TRANSITION_WIDTH,
83
+ uProgress
84
+ );
85
+ float phase = (r - frontR) / WAVELENGTH;
86
+
87
+ // Asymmetric decay: sharp ahead of front (k=4, no pre-wave), moderate
88
+ // behind (k=0.5, one dominant ring + soft fading second ring).
89
+ float k = mix(0.5, 4.0, step(0.0, phase));
90
+ float decay = exp(-phase * phase * k);
91
+ float envelope = 4.0 * uProgress * (1.0 - uProgress);
92
+ float sinP = sin(phase * 2.0 * PI);
93
+ float cosP = cos(phase * 2.0 * PI);
94
+
95
+ // d(wave)/d(phase) = 2π·cos·decay − 2·phase·k·sin·decay
96
+ float dWave = decay * (2.0 * PI * cosP - 2.0 * phase * k * sinP);
97
+ float dzdr = uAmplitude * envelope * dWave / WAVELENGTH;
98
+
99
+ vec3 normal = normalize(vec3(-dzdr * radialDir, 1.0));
100
+
101
+ float mask = smoothstep(
102
+ -TRANSITION_WIDTH,
103
+ TRANSITION_WIDTH,
104
+ frontR - r
105
+ );
106
+
107
+ // Refraction: gentle in-plane offset, clamped so high amplitudes
108
+ // don't generate wild UV jumps that would moire through even mipmapped
109
+ // trilinear sampling.
110
+ vec2 refractOffset = normal.xy * 0.22;
111
+ refractOffset = clamp(refractOffset, vec2(-0.08), vec2(0.08));
112
+ vec2 sampleUv = clamp(uv + refractOffset, 0.0, 1.0);
113
+
114
+ // Diffuse lighting referenced so flat = 1.0 exactly.
115
+ vec3 lightDir = normalize(vec3(0.3, 0.5, -1.0));
116
+ float directional = dot(normal, -lightDir);
117
+ float flatDot = -lightDir.z;
118
+ float rippleGain = (directional - flatDot) * 0.6;
119
+ float vLight = clamp(1.0 + rippleGain * envelope, 0.6, 1.35);
120
+
121
+ // Tight specular highlight on the crest — zero at endpoints (envelope),
122
+ // zero on flat water (normal parallel to z).
123
+ vec3 refl = reflect(lightDir, normal);
124
+ vec3 viewDir = vec3(0.0, 0.0, 1.0);
125
+ float spec = pow(max(dot(refl, viewDir), 0.0), 48.0);
126
+ float specBase = pow(max(dot(vec3(0, 0, 1), -lightDir), 0.0), 48.0);
127
+ float specGain = max(spec - specBase, 0.0) * envelope * 0.7;
128
+
129
+ vec3 fromCol = getFromColor(sampleUv).rgb;
130
+ vec3 toCol = getToColor(sampleUv).rgb;
131
+ vec3 col = mix(fromCol, toCol, mask) * vLight + vec3(specGain);
132
+ return vec4(col, 1.0);
133
+ }
134
+ `,
135
+ });
@@ -0,0 +1,43 @@
1
+ import { defineTransition } from "./define.js";
2
+
3
+ export const ripple = defineTransition({
4
+ name: "ripple",
5
+ defaults: {
6
+ center: [0.5, 0.5],
7
+ amplitude: 0.03,
8
+ frequency: 6,
9
+ speed: 8,
10
+ },
11
+ glsl: `
12
+ uniform vec2 uCenter;
13
+ uniform float uAmplitude;
14
+ uniform float uFrequency;
15
+ uniform float uSpeed;
16
+
17
+ const float TWO_PI = 6.2831853;
18
+
19
+ vec4 transition(vec2 uv) {
20
+ vec2 delta = uv - uCenter;
21
+ float dist = length(delta);
22
+ vec2 dir = dist > 0.0001 ? delta / dist : vec2(1.0, 0.0);
23
+
24
+ // Velocity-scaled envelope: zero at endpoints, peak at midpoint.
25
+ float env = 4.0 * uProgress * (1.0 - uProgress);
26
+
27
+ // Radial sinusoid traveling outward as progress grows.
28
+ float phase = dist * uFrequency * TWO_PI - uProgress * uSpeed;
29
+ float wave = sin(phase);
30
+
31
+ // From pushes outward with the wave; to pulls inward (opposite sign).
32
+ vec2 displacement = dir * wave * uAmplitude * env;
33
+
34
+ vec4 fromColor = getFromColor(clamp(uv + displacement, 0.0, 1.0));
35
+ vec4 toColor = getToColor(clamp(uv - displacement, 0.0, 1.0));
36
+
37
+ // Crossfade concentrated in the middle 40%, so both images are ripple-warped
38
+ // throughout the overlap region.
39
+ float mixW = smoothstep(0.3, 0.7, uProgress);
40
+ return mix(fromColor, toColor, mixW);
41
+ }
42
+ `,
43
+ });
@@ -0,0 +1,53 @@
1
+ import { defineTransition } from "./define.js";
2
+
3
+ /**
4
+ * Geometric shape reveal from a center point. `sides` controls the shape:
5
+ * 3 = triangle, 4 = diamond (with rotation 45°), 5 = pentagon, 6 = hexagon,
6
+ * 8 = octagon, 12 = dodecagon, 20+ approaches a circle.
7
+ */
8
+ export const shapeReveal = defineTransition({
9
+ name: "shape-reveal",
10
+ defaults: {
11
+ center: [0.5, 0.5],
12
+ sides: 6,
13
+ rotation: 0,
14
+ softness: 0.05,
15
+ },
16
+ glsl: `
17
+ uniform vec2 uCenter;
18
+ uniform float uSides;
19
+ uniform float uRotation;
20
+ uniform float uSoftness;
21
+
22
+ const float TWO_PI = 6.2831853;
23
+
24
+ vec4 transition(vec2 uv) {
25
+ // Work in screen pixel space so the polygon is geometrically regular
26
+ // regardless of canvas aspect ratio.
27
+ vec2 pixel = uv * uResolution;
28
+ vec2 pixelCenter = uCenter * uResolution;
29
+ vec2 delta = pixel - pixelCenter;
30
+
31
+ float slice = TWO_PI / max(uSides, 3.0);
32
+ float halfSlice = slice * 0.5;
33
+
34
+ // Fold the pixel's angle into one polygon sector; distance to the sector's
35
+ // edge midpoint direction gives the regular-polygon distance from center.
36
+ float angle = atan(delta.y, delta.x) - uRotation;
37
+ float folded = mod(angle + halfSlice, slice) - halfSlice;
38
+
39
+ // Normalize so canvas corners map to ≤ 1 (guaranteed by the max-corner
40
+ // division, since cos(folded) ≤ 1).
41
+ float maxDist = max(
42
+ max(length(pixelCenter), length(pixelCenter - vec2(uResolution.x, 0.0))),
43
+ max(length(pixelCenter - vec2(0.0, uResolution.y)), length(pixelCenter - uResolution))
44
+ );
45
+ float dist = length(delta) * cos(folded) / max(maxDist, 0.0001);
46
+
47
+ float radius = uProgress * (1.0 + 2.0 * uSoftness) - uSoftness;
48
+ float w = smoothstep(radius - uSoftness, radius + uSoftness, dist);
49
+
50
+ return mix(getToColor(uv), getFromColor(uv), w);
51
+ }
52
+ `,
53
+ });