@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.
- package/LICENSE +21 -0
- package/README.md +618 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/inputs/normalize.d.ts +2 -0
- package/dist/inputs/normalize.d.ts.map +1 -0
- package/dist/inputs/normalize.js +2 -0
- package/dist/inputs/normalize.js.map +1 -0
- package/dist/runner/gl.d.ts +7 -0
- package/dist/runner/gl.d.ts.map +1 -0
- package/dist/runner/gl.js +59 -0
- package/dist/runner/gl.js.map +1 -0
- package/dist/runner/mesh.d.ts +28 -0
- package/dist/runner/mesh.d.ts.map +1 -0
- package/dist/runner/mesh.js +96 -0
- package/dist/runner/mesh.js.map +1 -0
- package/dist/runner/runner.d.ts +107 -0
- package/dist/runner/runner.d.ts.map +1 -0
- package/dist/runner/runner.js +410 -0
- package/dist/runner/runner.js.map +1 -0
- package/dist/transitions/all.d.ts +9 -0
- package/dist/transitions/all.d.ts.map +1 -0
- package/dist/transitions/all.js +129 -0
- package/dist/transitions/all.js.map +1 -0
- package/dist/transitions/bloom-reveal.d.ts +27 -0
- package/dist/transitions/bloom-reveal.d.ts.map +1 -0
- package/dist/transitions/bloom-reveal.js +106 -0
- package/dist/transitions/bloom-reveal.js.map +1 -0
- package/dist/transitions/chromatic-pulse.d.ts +4 -0
- package/dist/transitions/chromatic-pulse.d.ts.map +1 -0
- package/dist/transitions/chromatic-pulse.js +40 -0
- package/dist/transitions/chromatic-pulse.js.map +1 -0
- package/dist/transitions/clock-wipe.d.ts +6 -0
- package/dist/transitions/clock-wipe.d.ts.map +1 -0
- package/dist/transitions/clock-wipe.js +33 -0
- package/dist/transitions/clock-wipe.js.map +1 -0
- package/dist/transitions/color-phase.d.ts +10 -0
- package/dist/transitions/color-phase.d.ts.map +1 -0
- package/dist/transitions/color-phase.js +24 -0
- package/dist/transitions/color-phase.js.map +1 -0
- package/dist/transitions/colour-distance.d.ts.map +1 -0
- package/dist/transitions/cross-warp.d.ts.map +1 -0
- package/dist/transitions/cross-zoom.d.ts +5 -0
- package/dist/transitions/cross-zoom.d.ts.map +1 -0
- package/dist/transitions/cross-zoom.js +59 -0
- package/dist/transitions/cross-zoom.js.map +1 -0
- package/dist/transitions/crosshatch.d.ts +12 -0
- package/dist/transitions/crosshatch.d.ts.map +1 -0
- package/dist/transitions/crosshatch.js +49 -0
- package/dist/transitions/crosshatch.js.map +1 -0
- package/dist/transitions/define.d.ts +35 -0
- package/dist/transitions/define.d.ts.map +1 -0
- package/dist/transitions/define.js +37 -0
- package/dist/transitions/define.js.map +1 -0
- package/dist/transitions/directional-burn.d.ts +14 -0
- package/dist/transitions/directional-burn.d.ts.map +1 -0
- package/dist/transitions/directional-burn.js +67 -0
- package/dist/transitions/directional-burn.js.map +1 -0
- package/dist/transitions/directional-warp.d.ts +12 -0
- package/dist/transitions/directional-warp.d.ts.map +1 -0
- package/dist/transitions/directional-warp.js +46 -0
- package/dist/transitions/directional-warp.js.map +1 -0
- package/dist/transitions/dissolve.d.ts +2 -0
- package/dist/transitions/dissolve.d.ts.map +1 -0
- package/dist/transitions/dissolve.js +16 -0
- package/dist/transitions/dissolve.js.map +1 -0
- package/dist/transitions/dreamy-zoom.d.ts +25 -0
- package/dist/transitions/dreamy-zoom.d.ts.map +1 -0
- package/dist/transitions/dreamy-zoom.js +66 -0
- package/dist/transitions/dreamy-zoom.js.map +1 -0
- package/dist/transitions/dreamy.d.ts +8 -0
- package/dist/transitions/dreamy.d.ts.map +1 -0
- package/dist/transitions/dreamy.js +26 -0
- package/dist/transitions/dreamy.js.map +1 -0
- package/dist/transitions/drip-wipe.d.ts +22 -0
- package/dist/transitions/drip-wipe.d.ts.map +1 -0
- package/dist/transitions/drip-wipe.js +109 -0
- package/dist/transitions/drip-wipe.js.map +1 -0
- package/dist/transitions/ember-scatter.d.ts +22 -0
- package/dist/transitions/ember-scatter.d.ts.map +1 -0
- package/dist/transitions/ember-scatter.js +94 -0
- package/dist/transitions/ember-scatter.js.map +1 -0
- package/dist/transitions/film-burn.d.ts +17 -0
- package/dist/transitions/film-burn.d.ts.map +1 -0
- package/dist/transitions/film-burn.js +101 -0
- package/dist/transitions/film-burn.js.map +1 -0
- package/dist/transitions/film-grain.d.ts +24 -0
- package/dist/transitions/film-grain.d.ts.map +1 -0
- package/dist/transitions/film-grain.js +78 -0
- package/dist/transitions/film-grain.js.map +1 -0
- package/dist/transitions/flow-warp.d.ts +20 -0
- package/dist/transitions/flow-warp.d.ts.map +1 -0
- package/dist/transitions/flow-warp.js +51 -0
- package/dist/transitions/flow-warp.js.map +1 -0
- package/dist/transitions/fluid-flow.d.ts +26 -0
- package/dist/transitions/fluid-flow.d.ts.map +1 -0
- package/dist/transitions/fluid-flow.js +94 -0
- package/dist/transitions/fluid-flow.js.map +1 -0
- package/dist/transitions/fly-eye.d.ts.map +1 -0
- package/dist/transitions/fly-eye.js +58 -0
- package/dist/transitions/fly-eye.js.map +1 -0
- package/dist/transitions/glass-shatter.d.ts +25 -0
- package/dist/transitions/glass-shatter.d.ts.map +1 -0
- package/dist/transitions/glass-shatter.js +86 -0
- package/dist/transitions/glass-shatter.js.map +1 -0
- package/dist/transitions/glitch.d.ts +6 -0
- package/dist/transitions/glitch.d.ts.map +1 -0
- package/dist/transitions/glitch.js +59 -0
- package/dist/transitions/glitch.js.map +1 -0
- package/dist/transitions/god-rays-reveal.d.ts +32 -0
- package/dist/transitions/god-rays-reveal.d.ts.map +1 -0
- package/dist/transitions/god-rays-reveal.js +110 -0
- package/dist/transitions/god-rays-reveal.js.map +1 -0
- package/dist/transitions/gravity-pull.d.ts +16 -0
- package/dist/transitions/gravity-pull.d.ts.map +1 -0
- package/dist/transitions/gravity-pull.js +65 -0
- package/dist/transitions/gravity-pull.js.map +1 -0
- package/dist/transitions/grid-reveal.d.ts +12 -0
- package/dist/transitions/grid-reveal.d.ts.map +1 -0
- package/dist/transitions/grid-reveal.js +53 -0
- package/dist/transitions/grid-reveal.js.map +1 -0
- package/dist/transitions/heat-haze.d.ts +13 -0
- package/dist/transitions/heat-haze.d.ts.map +1 -0
- package/dist/transitions/heat-haze.js +51 -0
- package/dist/transitions/heat-haze.js.map +1 -0
- package/dist/transitions/index.d.ts +64 -0
- package/dist/transitions/index.d.ts.map +1 -0
- package/dist/transitions/index.js +63 -0
- package/dist/transitions/index.js.map +1 -0
- package/dist/transitions/ink-bloom.d.ts +15 -0
- package/dist/transitions/ink-bloom.d.ts.map +1 -0
- package/dist/transitions/ink-bloom.js +76 -0
- package/dist/transitions/ink-bloom.js.map +1 -0
- package/dist/transitions/ink-diffuse.d.ts +26 -0
- package/dist/transitions/ink-diffuse.d.ts.map +1 -0
- package/dist/transitions/ink-diffuse.js +90 -0
- package/dist/transitions/ink-diffuse.js.map +1 -0
- package/dist/transitions/iris-zoom.d.ts +13 -0
- package/dist/transitions/iris-zoom.d.ts.map +1 -0
- package/dist/transitions/iris-zoom.js +67 -0
- package/dist/transitions/iris-zoom.js.map +1 -0
- package/dist/transitions/kinetic-bands.d.ts +7 -0
- package/dist/transitions/kinetic-bands.d.ts.map +1 -0
- package/dist/transitions/kinetic-bands.js +58 -0
- package/dist/transitions/kinetic-bands.js.map +1 -0
- package/dist/transitions/lenticular-flip.d.ts +22 -0
- package/dist/transitions/lenticular-flip.d.ts.map +1 -0
- package/dist/transitions/lenticular-flip.js +73 -0
- package/dist/transitions/lenticular-flip.js.map +1 -0
- package/dist/transitions/light-leak.d.ts +7 -0
- package/dist/transitions/light-leak.d.ts.map +1 -0
- package/dist/transitions/light-leak.js +43 -0
- package/dist/transitions/light-leak.js.map +1 -0
- package/dist/transitions/lightning-strike.d.ts +22 -0
- package/dist/transitions/lightning-strike.d.ts.map +1 -0
- package/dist/transitions/lightning-strike.js +90 -0
- package/dist/transitions/lightning-strike.js.map +1 -0
- package/dist/transitions/linear-blur.d.ts +11 -0
- package/dist/transitions/linear-blur.d.ts.map +1 -0
- package/dist/transitions/linear-blur.js +40 -0
- package/dist/transitions/linear-blur.js.map +1 -0
- package/dist/transitions/liquid-chrome.d.ts +22 -0
- package/dist/transitions/liquid-chrome.d.ts.map +1 -0
- package/dist/transitions/liquid-chrome.js +114 -0
- package/dist/transitions/liquid-chrome.js.map +1 -0
- package/dist/transitions/liquid-morph.d.ts +6 -0
- package/dist/transitions/liquid-morph.d.ts.map +1 -0
- package/dist/transitions/liquid-morph.js +50 -0
- package/dist/transitions/liquid-morph.js.map +1 -0
- package/dist/transitions/lumina-melt.d.ts +11 -0
- package/dist/transitions/lumina-melt.d.ts.map +1 -0
- package/dist/transitions/lumina-melt.js +36 -0
- package/dist/transitions/lumina-melt.js.map +1 -0
- package/dist/transitions/mosaic.d.ts +13 -0
- package/dist/transitions/mosaic.d.ts.map +1 -0
- package/dist/transitions/mosaic.js +58 -0
- package/dist/transitions/mosaic.js.map +1 -0
- package/dist/transitions/noise-dissolve.d.ts +5 -0
- package/dist/transitions/noise-dissolve.d.ts.map +1 -0
- package/dist/transitions/noise-dissolve.js +41 -0
- package/dist/transitions/noise-dissolve.js.map +1 -0
- package/dist/transitions/page-curl.d.ts +32 -0
- package/dist/transitions/page-curl.d.ts.map +1 -0
- package/dist/transitions/page-curl.js +165 -0
- package/dist/transitions/page-curl.js.map +1 -0
- package/dist/transitions/paint-bleed.d.ts +12 -0
- package/dist/transitions/paint-bleed.d.ts.map +1 -0
- package/dist/transitions/paint-bleed.js +59 -0
- package/dist/transitions/paint-bleed.js.map +1 -0
- package/dist/transitions/particle-assemble.d.ts +23 -0
- package/dist/transitions/particle-assemble.d.ts.map +1 -0
- package/dist/transitions/particle-assemble.js +65 -0
- package/dist/transitions/particle-assemble.js.map +1 -0
- package/dist/transitions/pinwheel.d.ts +11 -0
- package/dist/transitions/pinwheel.d.ts.map +1 -0
- package/dist/transitions/pinwheel.js +40 -0
- package/dist/transitions/pinwheel.js.map +1 -0
- package/dist/transitions/pixelate.d.ts +4 -0
- package/dist/transitions/pixelate.d.ts.map +1 -0
- package/dist/transitions/pixelate.js +26 -0
- package/dist/transitions/pixelate.js.map +1 -0
- package/dist/transitions/plasma-pulse.d.ts.map +1 -0
- package/dist/transitions/plasma-pulse.js +92 -0
- package/dist/transitions/plasma-pulse.js.map +1 -0
- package/dist/transitions/polka-dots-curtain.d.ts +13 -0
- package/dist/transitions/polka-dots-curtain.d.ts.map +1 -0
- package/dist/transitions/polka-dots-curtain.js +46 -0
- package/dist/transitions/polka-dots-curtain.js.map +1 -0
- package/dist/transitions/polygon-flip.d.ts +27 -0
- package/dist/transitions/polygon-flip.d.ts.map +1 -0
- package/dist/transitions/polygon-flip.js +97 -0
- package/dist/transitions/polygon-flip.js.map +1 -0
- package/dist/transitions/portal-dive.d.ts +18 -0
- package/dist/transitions/portal-dive.d.ts.map +1 -0
- package/dist/transitions/portal-dive.js +83 -0
- package/dist/transitions/portal-dive.js.map +1 -0
- package/dist/transitions/prism-split.d.ts +12 -0
- package/dist/transitions/prism-split.d.ts.map +1 -0
- package/dist/transitions/prism-split.js +52 -0
- package/dist/transitions/prism-split.js.map +1 -0
- package/dist/transitions/push.d.ts +4 -0
- package/dist/transitions/push.d.ts.map +1 -0
- package/dist/transitions/push.js +34 -0
- package/dist/transitions/push.js.map +1 -0
- package/dist/transitions/radial-reveal.d.ts +5 -0
- package/dist/transitions/radial-reveal.d.ts.map +1 -0
- package/dist/transitions/radial-reveal.js +31 -0
- package/dist/transitions/radial-reveal.js.map +1 -0
- package/dist/transitions/ripple-wave.d.ts +24 -0
- package/dist/transitions/ripple-wave.d.ts.map +1 -0
- package/dist/transitions/ripple-wave.js +135 -0
- package/dist/transitions/ripple-wave.js.map +1 -0
- package/dist/transitions/ripple.d.ts +7 -0
- package/dist/transitions/ripple.d.ts.map +1 -0
- package/dist/transitions/ripple.js +43 -0
- package/dist/transitions/ripple.js.map +1 -0
- package/dist/transitions/shape-reveal.d.ts +12 -0
- package/dist/transitions/shape-reveal.d.ts.map +1 -0
- package/dist/transitions/shape-reveal.js +53 -0
- package/dist/transitions/shape-reveal.js.map +1 -0
- package/dist/transitions/shockwave.d.ts +10 -0
- package/dist/transitions/shockwave.d.ts.map +1 -0
- package/dist/transitions/shockwave.js +56 -0
- package/dist/transitions/shockwave.js.map +1 -0
- package/dist/transitions/singularity.d.ts +22 -0
- package/dist/transitions/singularity.d.ts.map +1 -0
- package/dist/transitions/singularity.js +59 -0
- package/dist/transitions/singularity.js.map +1 -0
- package/dist/transitions/slide.d.ts +10 -0
- package/dist/transitions/slide.d.ts.map +1 -0
- package/dist/transitions/slide.js +76 -0
- package/dist/transitions/slide.js.map +1 -0
- package/dist/transitions/smoldering-edge.d.ts +15 -0
- package/dist/transitions/smoldering-edge.d.ts.map +1 -0
- package/dist/transitions/smoldering-edge.js +74 -0
- package/dist/transitions/smoldering-edge.js.map +1 -0
- package/dist/transitions/split.d.ts +14 -0
- package/dist/transitions/split.d.ts.map +1 -0
- package/dist/transitions/split.js +53 -0
- package/dist/transitions/split.js.map +1 -0
- package/dist/transitions/swirl.d.ts +12 -0
- package/dist/transitions/swirl.d.ts.map +1 -0
- package/dist/transitions/swirl.js +42 -0
- package/dist/transitions/swirl.js.map +1 -0
- package/dist/transitions/tangent-motion-blur.d.ts +13 -0
- package/dist/transitions/tangent-motion-blur.d.ts.map +1 -0
- package/dist/transitions/tangent-motion-blur.js +58 -0
- package/dist/transitions/tangent-motion-blur.js.map +1 -0
- package/dist/transitions/tile-scatter.d.ts +22 -0
- package/dist/transitions/tile-scatter.d.ts.map +1 -0
- package/dist/transitions/tile-scatter.js +122 -0
- package/dist/transitions/tile-scatter.js.map +1 -0
- package/dist/transitions/tilt-sweep.d.ts +11 -0
- package/dist/transitions/tilt-sweep.d.ts.map +1 -0
- package/dist/transitions/tilt-sweep.js +31 -0
- package/dist/transitions/tilt-sweep.js.map +1 -0
- package/dist/transitions/warp-zoom.d.ts +7 -0
- package/dist/transitions/warp-zoom.d.ts.map +1 -0
- package/dist/transitions/warp-zoom.js +70 -0
- package/dist/transitions/warp-zoom.js.map +1 -0
- package/dist/transitions/wave-stripes.d.ts +16 -0
- package/dist/transitions/wave-stripes.d.ts.map +1 -0
- package/dist/transitions/wave-stripes.js +55 -0
- package/dist/transitions/wave-stripes.js.map +1 -0
- package/dist/transitions/wave-wipe.d.ts +23 -0
- package/dist/transitions/wave-wipe.d.ts.map +1 -0
- package/dist/transitions/wave-wipe.js +84 -0
- package/dist/transitions/wave-wipe.js.map +1 -0
- package/dist/transitions/wind.d.ts +9 -0
- package/dist/transitions/wind.d.ts.map +1 -0
- package/dist/transitions/wind.js +48 -0
- package/dist/transitions/wind.js.map +1 -0
- package/dist/transitions/window-slice.d.ts +11 -0
- package/dist/transitions/window-slice.d.ts.map +1 -0
- package/dist/transitions/window-slice.js +34 -0
- package/dist/transitions/window-slice.js.map +1 -0
- package/dist/transitions/wipe-directional.d.ts +5 -0
- package/dist/transitions/wipe-directional.d.ts.map +1 -0
- package/dist/transitions/wipe-directional.js +26 -0
- package/dist/transitions/wipe-directional.js.map +1 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +56 -0
- 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
- 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
- package/src/__tests__/endpoint-correctness.test.ts +161 -0
- package/src/__tests__/readme.test.ts +39 -0
- package/src/__tests__/ssr.test.ts +45 -0
- package/src/index.ts +75 -0
- package/src/inputs/normalize.ts +1 -0
- 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
- package/src/runner/__tests__/__screenshots__/mesh.test.ts/buildSubdividedPlane-uv-matches-aPosition---0-5---0-5-1.png +0 -0
- package/src/runner/__tests__/mesh.test.ts +128 -0
- package/src/runner/gl.ts +69 -0
- package/src/runner/mesh.ts +135 -0
- package/src/runner/runner.ts +528 -0
- package/src/transitions/all.ts +131 -0
- package/src/transitions/bloom-reveal.ts +106 -0
- package/src/transitions/chromatic-pulse.ts +40 -0
- package/src/transitions/clock-wipe.ts +33 -0
- package/src/transitions/color-phase.ts +24 -0
- package/src/transitions/cross-zoom.ts +59 -0
- package/src/transitions/crosshatch.ts +49 -0
- package/src/transitions/define.ts +56 -0
- package/src/transitions/directional-burn.ts +67 -0
- package/src/transitions/directional-warp.ts +46 -0
- package/src/transitions/dissolve.ts +16 -0
- package/src/transitions/dreamy-zoom.ts +66 -0
- package/src/transitions/dreamy.ts +26 -0
- package/src/transitions/drip-wipe.ts +109 -0
- package/src/transitions/ember-scatter.ts +94 -0
- package/src/transitions/film-burn.ts +101 -0
- package/src/transitions/film-grain.ts +78 -0
- package/src/transitions/flow-warp.ts +51 -0
- package/src/transitions/fluid-flow.ts +94 -0
- package/src/transitions/glass-shatter.ts +86 -0
- package/src/transitions/glitch.ts +59 -0
- package/src/transitions/god-rays-reveal.ts +110 -0
- package/src/transitions/gravity-pull.ts +65 -0
- package/src/transitions/grid-reveal.ts +53 -0
- package/src/transitions/heat-haze.ts +51 -0
- package/src/transitions/index.ts +63 -0
- package/src/transitions/ink-bloom.ts +76 -0
- package/src/transitions/ink-diffuse.ts +90 -0
- package/src/transitions/iris-zoom.ts +67 -0
- package/src/transitions/kinetic-bands.ts +58 -0
- package/src/transitions/lenticular-flip.ts +73 -0
- package/src/transitions/light-leak.ts +43 -0
- package/src/transitions/linear-blur.ts +40 -0
- package/src/transitions/liquid-chrome.ts +114 -0
- package/src/transitions/liquid-morph.ts +50 -0
- package/src/transitions/lumina-melt.ts +36 -0
- package/src/transitions/mosaic.ts +58 -0
- package/src/transitions/noise-dissolve.ts +41 -0
- package/src/transitions/page-curl.ts +165 -0
- package/src/transitions/paint-bleed.ts +59 -0
- package/src/transitions/pinwheel.ts +40 -0
- package/src/transitions/pixelate.ts +26 -0
- package/src/transitions/polka-dots-curtain.ts +46 -0
- package/src/transitions/polygon-flip.ts +97 -0
- package/src/transitions/portal-dive.ts +83 -0
- package/src/transitions/prism-split.ts +52 -0
- package/src/transitions/push.ts +34 -0
- package/src/transitions/radial-reveal.ts +31 -0
- package/src/transitions/ripple-wave.ts +135 -0
- package/src/transitions/ripple.ts +43 -0
- package/src/transitions/shape-reveal.ts +53 -0
- package/src/transitions/shockwave.ts +56 -0
- package/src/transitions/singularity.ts +59 -0
- package/src/transitions/slide.ts +76 -0
- package/src/transitions/smoldering-edge.ts +74 -0
- package/src/transitions/split.ts +53 -0
- package/src/transitions/swirl.ts +42 -0
- package/src/transitions/tangent-motion-blur.ts +58 -0
- package/src/transitions/tile-scatter.ts +122 -0
- package/src/transitions/warp-zoom.ts +70 -0
- package/src/transitions/wave-stripes.ts +55 -0
- package/src/transitions/wind.ts +48 -0
- package/src/transitions/wipe-directional.ts +26 -0
- package/src/types.ts +87 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Multi-pass transition. As to reveals through a noise mask, its
|
|
5
|
+
* bright highlights emit volumetric-looking light shafts toward a
|
|
6
|
+
* source point, built up by iterative radial blur — each pass samples
|
|
7
|
+
* from the previous pass's output at progressively finer steps along
|
|
8
|
+
* the ray from every pixel to the source. Impossible single-pass: a
|
|
9
|
+
* full-length radial streak would need ~30 samples across the ray,
|
|
10
|
+
* and after five iterations of 6 samples each, the shafts have
|
|
11
|
+
* progressively-refined spatial frequencies that a one-pass sampling
|
|
12
|
+
* of the source texture cannot produce.
|
|
13
|
+
*
|
|
14
|
+
* pass 0 — seed: to-highlights gated by the reveal
|
|
15
|
+
* mask AND a 4·p·(1-p) envelope.
|
|
16
|
+
* pass 1..passCount-2 — iterative radial blur. Pass i samples 6
|
|
17
|
+
* points along uv→source at step = 1/(5 · 2^(i-1)),
|
|
18
|
+
* reading from uPrevious so the shafts
|
|
19
|
+
* accumulate across passes.
|
|
20
|
+
* final pass — composite = mix(from, to, mask) +
|
|
21
|
+
* rays * intensity.
|
|
22
|
+
*
|
|
23
|
+
* Endpoints: seed envelope is 0 at progress 0 and 1, so the blur
|
|
24
|
+
* chain carries zeros and the composite resolves to pure from/to.
|
|
25
|
+
*/
|
|
26
|
+
export const godRaysReveal = defineTransition({
|
|
27
|
+
name: "god-rays-reveal",
|
|
28
|
+
passes: 7,
|
|
29
|
+
defaults: {
|
|
30
|
+
scale: 5,
|
|
31
|
+
softness: 0.08,
|
|
32
|
+
threshold: 0.45,
|
|
33
|
+
intensity: 1.6,
|
|
34
|
+
decay: 0.92,
|
|
35
|
+
source: [0.5, 0.5],
|
|
36
|
+
},
|
|
37
|
+
glsl: `
|
|
38
|
+
uniform float uScale;
|
|
39
|
+
uniform float uSoftness;
|
|
40
|
+
uniform float uThreshold;
|
|
41
|
+
uniform float uIntensity;
|
|
42
|
+
uniform float uDecay;
|
|
43
|
+
uniform vec2 uSource;
|
|
44
|
+
|
|
45
|
+
float hash21(vec2 p) {
|
|
46
|
+
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
float valNoise(vec2 p) {
|
|
50
|
+
vec2 i = floor(p);
|
|
51
|
+
vec2 f = fract(p);
|
|
52
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
53
|
+
float a = hash21(i);
|
|
54
|
+
float b = hash21(i + vec2(1.0, 0.0));
|
|
55
|
+
float c = hash21(i + vec2(0.0, 1.0));
|
|
56
|
+
float d = hash21(i + vec2(1.0, 1.0));
|
|
57
|
+
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
float fbm(vec2 p) {
|
|
61
|
+
return valNoise(p) * 0.55 +
|
|
62
|
+
valNoise(p * 2.1) * 0.28 +
|
|
63
|
+
valNoise(p * 4.3) * 0.17;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
float revealMask(vec2 uv) {
|
|
67
|
+
float safeLow = uSoftness + 0.005;
|
|
68
|
+
float safeHigh = 1.0 - uSoftness - 0.005;
|
|
69
|
+
float n = mix(safeLow, safeHigh, clamp(fbm(uv * uScale), 0.0, 1.0));
|
|
70
|
+
return smoothstep(n - uSoftness, n + uSoftness, uProgress);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
vec4 transition(vec2 uv) {
|
|
74
|
+
// Final pass: composite rays on top of the from→to reveal.
|
|
75
|
+
if (uPass == uPassCount - 1) {
|
|
76
|
+
vec3 rays = getPrevious(uv).rgb;
|
|
77
|
+
float mask = revealMask(uv);
|
|
78
|
+
vec3 base = mix(getFromColor(uv).rgb, getToColor(uv).rgb, mask);
|
|
79
|
+
return vec4(base + rays * uIntensity, 1.0);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Seed pass: bright highlights of to, gated by reveal mask and
|
|
83
|
+
// a 4·p·(1-p) envelope so endpoints contribute zero.
|
|
84
|
+
if (uPass == 0) {
|
|
85
|
+
vec3 toC = getToColor(uv).rgb;
|
|
86
|
+
float lum = dot(toC, vec3(0.299, 0.587, 0.114));
|
|
87
|
+
float bright = smoothstep(uThreshold - 0.1, uThreshold + 0.1, lum);
|
|
88
|
+
float mask = revealMask(uv);
|
|
89
|
+
float envelope = 4.0 * uProgress * (1.0 - uProgress);
|
|
90
|
+
return vec4(toC * bright * mask * envelope, 1.0);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Iterative radial blur: each pass samples 6 points along uv→source
|
|
94
|
+
// with step shrinking by 2× each pass. Over 5 passes, shafts span
|
|
95
|
+
// the full ray with well-refined density.
|
|
96
|
+
vec2 toSource = uSource - uv;
|
|
97
|
+
float passStep = 1.0 / (5.0 * pow(2.0, float(uPass - 1)));
|
|
98
|
+
|
|
99
|
+
vec3 accum = vec3(0.0);
|
|
100
|
+
float weightSum = 0.0;
|
|
101
|
+
for (int i = 0; i < 6; i++) {
|
|
102
|
+
float t = passStep * float(i);
|
|
103
|
+
float w = pow(uDecay, float(i));
|
|
104
|
+
accum += getPrevious(uv + toSource * t).rgb * w;
|
|
105
|
+
weightSum += w;
|
|
106
|
+
}
|
|
107
|
+
return vec4(accum / weightSum, 1.0);
|
|
108
|
+
}
|
|
109
|
+
`,
|
|
110
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Port of akella demo8. Pixels are pulled vertically toward `center` over
|
|
5
|
+
* the transition: from-image moves toward center by `progress * intensity`,
|
|
6
|
+
* to-image starts displaced AWAY from center and converges back. A fine
|
|
7
|
+
* noise field perturbs the magnitude per pixel so the pull reads as
|
|
8
|
+
* organic. Crossfade is linear so there's no freeze through the midpoint.
|
|
9
|
+
*
|
|
10
|
+
* Shrink-to-center: at midpoint the canvas samples from a smaller central
|
|
11
|
+
* region so the to-image's away-from-center displacement never samples
|
|
12
|
+
* outside `[0,1]` and clamps into vertical bars at the top/bottom edges.
|
|
13
|
+
*/
|
|
14
|
+
export const gravityPull = defineTransition({
|
|
15
|
+
name: "gravity-pull",
|
|
16
|
+
defaults: {
|
|
17
|
+
center: [0.5, 0.5],
|
|
18
|
+
intensity: 0.15,
|
|
19
|
+
},
|
|
20
|
+
glsl: `
|
|
21
|
+
uniform vec2 uCenter;
|
|
22
|
+
uniform float uIntensity;
|
|
23
|
+
|
|
24
|
+
float hash21(vec2 p) {
|
|
25
|
+
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
float valueNoise(vec2 p) {
|
|
29
|
+
vec2 i = floor(p);
|
|
30
|
+
vec2 f = fract(p);
|
|
31
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
32
|
+
float a = hash21(i);
|
|
33
|
+
float b = hash21(i + vec2(1.0, 0.0));
|
|
34
|
+
float c = hash21(i + vec2(0.0, 1.0));
|
|
35
|
+
float d = hash21(i + vec2(1.0, 1.0));
|
|
36
|
+
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
vec4 transition(vec2 uv) {
|
|
40
|
+
float env = 4.0 * uProgress * (1.0 - uProgress);
|
|
41
|
+
float n = valueNoise(uv * 10.0);
|
|
42
|
+
|
|
43
|
+
// Vertical signed unit vector pointing toward the center.
|
|
44
|
+
vec2 toCenter = uCenter - uv;
|
|
45
|
+
float lenTC = length(toCenter);
|
|
46
|
+
float dy = lenTC > 0.001 ? toCenter.y / lenTC : 0.0;
|
|
47
|
+
vec2 d = vec2(0.0, dy);
|
|
48
|
+
|
|
49
|
+
float pullMag = uIntensity * (1.0 + n * 0.5);
|
|
50
|
+
|
|
51
|
+
// Shrink-to-center at midpoint so the away-from-center displacement
|
|
52
|
+
// stays in source bounds. At endpoints env=0 → shrunkUv=uv (no zoom),
|
|
53
|
+
// so endpoints are pixel-pure. Capped to keep image visible at high
|
|
54
|
+
// intensities.
|
|
55
|
+
float maxPull = uIntensity * 1.5;
|
|
56
|
+
float shrinkAmount = max(1.0 - env * 2.0 * maxPull, 0.2);
|
|
57
|
+
vec2 shrunkUv = (uv - 0.5) * shrinkAmount + 0.5;
|
|
58
|
+
|
|
59
|
+
vec2 fromUv = clamp(shrunkUv + d * uProgress * pullMag, 0.0, 1.0);
|
|
60
|
+
vec2 toUv = clamp(shrunkUv - d * (1.0 - uProgress) * pullMag, 0.0, 1.0);
|
|
61
|
+
|
|
62
|
+
return mix(getFromColor(fromUv), getToColor(toUv), uProgress);
|
|
63
|
+
}
|
|
64
|
+
`,
|
|
65
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pattern values:
|
|
5
|
+
* 0 = sequential (left-to-right, top-to-bottom)
|
|
6
|
+
* 1 = radial (from center outward)
|
|
7
|
+
* 2 = pseudo-random
|
|
8
|
+
*/
|
|
9
|
+
export const gridReveal = defineTransition({
|
|
10
|
+
name: "grid-reveal",
|
|
11
|
+
defaults: {
|
|
12
|
+
count: 8,
|
|
13
|
+
stagger: 0.7,
|
|
14
|
+
pattern: 1,
|
|
15
|
+
},
|
|
16
|
+
glsl: `
|
|
17
|
+
uniform float uCount;
|
|
18
|
+
uniform float uStagger;
|
|
19
|
+
uniform float uPattern;
|
|
20
|
+
|
|
21
|
+
float hash21(vec2 p) {
|
|
22
|
+
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
vec4 transition(vec2 uv) {
|
|
26
|
+
// 1×1 is a fade and 2×2 is a quad-split — neither reads as "grid".
|
|
27
|
+
// Clamp here so the transition is reliable regardless of caller input.
|
|
28
|
+
float count = max(uCount, 3.0);
|
|
29
|
+
vec2 cell = floor(uv * count);
|
|
30
|
+
|
|
31
|
+
float priority;
|
|
32
|
+
if (uPattern < 0.5) {
|
|
33
|
+
// Sequential left-to-right, top-to-bottom
|
|
34
|
+
priority = (cell.y * count + cell.x) / (count * count);
|
|
35
|
+
} else if (uPattern < 1.5) {
|
|
36
|
+
// Radial from center of the grid
|
|
37
|
+
vec2 center = vec2(count * 0.5 - 0.5);
|
|
38
|
+
float dist = length(cell - center);
|
|
39
|
+
float maxDist = length(center);
|
|
40
|
+
priority = dist / max(maxDist, 0.0001);
|
|
41
|
+
} else {
|
|
42
|
+
// Pseudo-random per cell
|
|
43
|
+
priority = hash21(cell);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
float start = priority * uStagger;
|
|
47
|
+
float window = max(0.0001, 1.0 - uStagger);
|
|
48
|
+
float localProgress = clamp((uProgress - start) / window, 0.0, 1.0);
|
|
49
|
+
|
|
50
|
+
return mix(getFromColor(uv), getToColor(uv), localProgress);
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Heat-haze shimmer: horizontal displacement driven by an animated noise
|
|
5
|
+
* field that flows upward over progress, simulating the look-through-
|
|
6
|
+
* hot-air effect. Both images receive the same displacement so they
|
|
7
|
+
* blend through a shared shimmer at the midpoint. Displacement envelope
|
|
8
|
+
* gates the effect to zero at endpoints.
|
|
9
|
+
*/
|
|
10
|
+
export const heatHaze = defineTransition({
|
|
11
|
+
name: "heat-haze",
|
|
12
|
+
defaults: {
|
|
13
|
+
intensity: 0.04,
|
|
14
|
+
frequency: 14,
|
|
15
|
+
flow: 5.0,
|
|
16
|
+
},
|
|
17
|
+
glsl: `
|
|
18
|
+
uniform float uIntensity;
|
|
19
|
+
uniform float uFrequency;
|
|
20
|
+
uniform float uFlow;
|
|
21
|
+
|
|
22
|
+
float hash21(vec2 p) {
|
|
23
|
+
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
float valueNoise(vec2 p) {
|
|
27
|
+
vec2 i = floor(p);
|
|
28
|
+
vec2 f = fract(p);
|
|
29
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
30
|
+
float a = hash21(i);
|
|
31
|
+
float b = hash21(i + vec2(1.0, 0.0));
|
|
32
|
+
float c = hash21(i + vec2(0.0, 1.0));
|
|
33
|
+
float d = hash21(i + vec2(1.0, 1.0));
|
|
34
|
+
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
vec4 transition(vec2 uv) {
|
|
38
|
+
float env = 4.0 * uProgress * (1.0 - uProgress);
|
|
39
|
+
|
|
40
|
+
// Horizontal column noise that drifts upward over progress (noise sampled
|
|
41
|
+
// at uv.y - progress*flow → rising pattern). Vertical frequency lower so
|
|
42
|
+
// bands are tall and column-like, matching real heat-haze.
|
|
43
|
+
float n = valueNoise(vec2(uv.x * uFrequency, uv.y * uFrequency * 0.4 - uProgress * uFlow));
|
|
44
|
+
float disp = (n - 0.5) * uIntensity * env;
|
|
45
|
+
|
|
46
|
+
vec2 sampleUv = clamp(vec2(uv.x + disp, uv.y), 0.0, 1.0);
|
|
47
|
+
|
|
48
|
+
return mix(getFromColor(sampleUv), getToColor(sampleUv), uProgress);
|
|
49
|
+
}
|
|
50
|
+
`,
|
|
51
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export { dissolve } from "./dissolve.js";
|
|
2
|
+
export { wipeDirectional } from "./wipe-directional.js";
|
|
3
|
+
export { slide } from "./slide.js";
|
|
4
|
+
export { radialReveal } from "./radial-reveal.js";
|
|
5
|
+
export { crossZoom } from "./cross-zoom.js";
|
|
6
|
+
export { glitch } from "./glitch.js";
|
|
7
|
+
export { noiseDissolve } from "./noise-dissolve.js";
|
|
8
|
+
export { clockWipe } from "./clock-wipe.js";
|
|
9
|
+
export { ripple } from "./ripple.js";
|
|
10
|
+
export { pixelate } from "./pixelate.js";
|
|
11
|
+
export { kineticBands } from "./kinetic-bands.js";
|
|
12
|
+
export { lightLeak } from "./light-leak.js";
|
|
13
|
+
export { liquidMorph } from "./liquid-morph.js";
|
|
14
|
+
export { gridReveal } from "./grid-reveal.js";
|
|
15
|
+
export { warpZoom } from "./warp-zoom.js";
|
|
16
|
+
export { chromaticPulse } from "./chromatic-pulse.js";
|
|
17
|
+
export { push } from "./push.js";
|
|
18
|
+
export { shapeReveal } from "./shape-reveal.js";
|
|
19
|
+
export { paintBleed } from "./paint-bleed.js";
|
|
20
|
+
export { shockwave } from "./shockwave.js";
|
|
21
|
+
export { swirl } from "./swirl.js";
|
|
22
|
+
export { split } from "./split.js";
|
|
23
|
+
export { directionalWarp } from "./directional-warp.js";
|
|
24
|
+
export { wind } from "./wind.js";
|
|
25
|
+
export { linearBlur } from "./linear-blur.js";
|
|
26
|
+
export { luminaMelt } from "./lumina-melt.js";
|
|
27
|
+
export { pinwheel } from "./pinwheel.js";
|
|
28
|
+
export { dreamy } from "./dreamy.js";
|
|
29
|
+
export { tangentMotionBlur } from "./tangent-motion-blur.js";
|
|
30
|
+
export { colorPhase } from "./color-phase.js";
|
|
31
|
+
export { filmBurn } from "./film-burn.js";
|
|
32
|
+
export { mosaic } from "./mosaic.js";
|
|
33
|
+
export { emberScatter } from "./ember-scatter.js";
|
|
34
|
+
export { directionalBurn } from "./directional-burn.js";
|
|
35
|
+
export { inkBloom } from "./ink-bloom.js";
|
|
36
|
+
export { smolderingEdge } from "./smoldering-edge.js";
|
|
37
|
+
export { polkaDotsCurtain } from "./polka-dots-curtain.js";
|
|
38
|
+
export { crosshatch } from "./crosshatch.js";
|
|
39
|
+
export { dreamyZoom } from "./dreamy-zoom.js";
|
|
40
|
+
export { heatHaze } from "./heat-haze.js";
|
|
41
|
+
export { prismSplit } from "./prism-split.js";
|
|
42
|
+
export { irisZoom } from "./iris-zoom.js";
|
|
43
|
+
export { gravityPull } from "./gravity-pull.js";
|
|
44
|
+
export { waveStripes } from "./wave-stripes.js";
|
|
45
|
+
export { flowWarp } from "./flow-warp.js";
|
|
46
|
+
export { dripWipe } from "./drip-wipe.js";
|
|
47
|
+
export { portalDive } from "./portal-dive.js";
|
|
48
|
+
export { liquidChrome } from "./liquid-chrome.js";
|
|
49
|
+
export { glassShatter } from "./glass-shatter.js";
|
|
50
|
+
export { inkDiffuse } from "./ink-diffuse.js";
|
|
51
|
+
export { bloomReveal } from "./bloom-reveal.js";
|
|
52
|
+
export { godRaysReveal } from "./god-rays-reveal.js";
|
|
53
|
+
export { fluidFlow } from "./fluid-flow.js";
|
|
54
|
+
export { lenticularFlip } from "./lenticular-flip.js";
|
|
55
|
+
export { filmGrain } from "./film-grain.js";
|
|
56
|
+
export { singularity } from "./singularity.js";
|
|
57
|
+
export { polygonFlip } from "./polygon-flip.js";
|
|
58
|
+
export { pageCurl } from "./page-curl.js";
|
|
59
|
+
export { rippleWave } from "./ripple-wave.js";
|
|
60
|
+
export { tileScatter } from "./tile-scatter.js";
|
|
61
|
+
export { defineTransition } from "./define.js";
|
|
62
|
+
export type { DefineTransitionSpec } from "./define.js";
|
|
63
|
+
export { ALL_TRANSITIONS } from "./all.js";
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cold fluid sibling to film-burn: a radial bloom expands from a center
|
|
5
|
+
* point with a dark deeply-tinted ring at the advancing boundary instead
|
|
6
|
+
* of a bright flame. Feels like ink diffusing through water. The ink
|
|
7
|
+
* color tint is multiplicative (darkens toward uInkColor) rather than
|
|
8
|
+
* additive bright glow.
|
|
9
|
+
*/
|
|
10
|
+
export const inkBloom = defineTransition({
|
|
11
|
+
name: "ink-bloom",
|
|
12
|
+
defaults: {
|
|
13
|
+
center: [0.5, 0.5],
|
|
14
|
+
scale: 5,
|
|
15
|
+
edgeWidth: 0.07,
|
|
16
|
+
bloomWidth: 0.12,
|
|
17
|
+
inkColor: [0.25, 0.08, 0.45],
|
|
18
|
+
},
|
|
19
|
+
glsl: `
|
|
20
|
+
uniform vec2 uCenter;
|
|
21
|
+
uniform float uScale;
|
|
22
|
+
uniform float uEdgeWidth;
|
|
23
|
+
uniform float uBloomWidth;
|
|
24
|
+
uniform vec3 uInkColor;
|
|
25
|
+
|
|
26
|
+
float hash21(vec2 p) {
|
|
27
|
+
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
float valueNoise(vec2 p) {
|
|
31
|
+
vec2 i = floor(p);
|
|
32
|
+
vec2 f = fract(p);
|
|
33
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
34
|
+
float a = hash21(i);
|
|
35
|
+
float b = hash21(i + vec2(1.0, 0.0));
|
|
36
|
+
float c = hash21(i + vec2(0.0, 1.0));
|
|
37
|
+
float d = hash21(i + vec2(1.0, 1.0));
|
|
38
|
+
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
vec4 transition(vec2 uv) {
|
|
42
|
+
vec2 pixel = uv * uResolution;
|
|
43
|
+
vec2 centerPx = uCenter * uResolution;
|
|
44
|
+
float dist = distance(pixel, centerPx);
|
|
45
|
+
float maxDist = max(
|
|
46
|
+
max(length(centerPx), length(centerPx - vec2(uResolution.x, 0.0))),
|
|
47
|
+
max(length(centerPx - vec2(0.0, uResolution.y)), length(centerPx - uResolution))
|
|
48
|
+
);
|
|
49
|
+
float normalizedDist = dist / max(maxDist, 0.0001);
|
|
50
|
+
|
|
51
|
+
// Soft/low-frequency noise for fluid-like edge deformation.
|
|
52
|
+
float noiseStrength = 0.18;
|
|
53
|
+
float n = valueNoise(uv * uScale);
|
|
54
|
+
float perturbed = normalizedDist - (n - 0.5) * noiseStrength;
|
|
55
|
+
|
|
56
|
+
float totalEdge = uEdgeWidth + noiseStrength * 0.5;
|
|
57
|
+
float bloomRadius = uProgress * (1.0 + 2.0 * totalEdge) - totalEdge;
|
|
58
|
+
float signedDist = perturbed - bloomRadius;
|
|
59
|
+
|
|
60
|
+
float w = smoothstep(-uEdgeWidth, uEdgeWidth, -signedDist);
|
|
61
|
+
vec4 base = mix(getFromColor(uv), getToColor(uv), w);
|
|
62
|
+
|
|
63
|
+
// Wide dark bloom band — uBloomWidth controls how far the tint diffuses
|
|
64
|
+
// off the hard edge. env-gated so endpoints remain untouched.
|
|
65
|
+
float bandX = signedDist / max(uBloomWidth, 0.0001);
|
|
66
|
+
float bloomBand = exp(-bandX * bandX * 1.5);
|
|
67
|
+
float env = 4.0 * uProgress * (1.0 - uProgress);
|
|
68
|
+
float tint = bloomBand * env * 0.85;
|
|
69
|
+
|
|
70
|
+
vec3 darkened = base.rgb * uInkColor;
|
|
71
|
+
vec3 result = mix(base.rgb, darkened, tint);
|
|
72
|
+
|
|
73
|
+
return vec4(result, base.a);
|
|
74
|
+
}
|
|
75
|
+
`,
|
|
76
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Multi-pass transition. A noise-seeded mask grows outward via iterated
|
|
5
|
+
* dilation with an expanding kernel, producing an ink-in-water spread
|
|
6
|
+
* that can't be computed in a single pass (each pixel has to read its
|
|
7
|
+
* neighbours' mask values from the previous iteration).
|
|
8
|
+
*
|
|
9
|
+
* pass 0 — seed the mask by thresholding a noise field
|
|
10
|
+
* against progress. At progress 0 all zero;
|
|
11
|
+
* at progress 1 all one; in between, a noisy
|
|
12
|
+
* boundary seeded where noise ≈ progress.
|
|
13
|
+
* pass 1..passCount-2 — dilate the mask with an expanding kernel
|
|
14
|
+
* (step doubles each pass: 1, 2, 4, 8, 16 px),
|
|
15
|
+
* biased with a light smoothing so edges
|
|
16
|
+
* stay organic.
|
|
17
|
+
* final pass — use the diffused mask to mix from → to.
|
|
18
|
+
*
|
|
19
|
+
* Endpoints: seed saturates to 0 at progress 0 and 1 at progress 1
|
|
20
|
+
* regardless of the noise field. Dilation is monotone on constants,
|
|
21
|
+
* so the mask stays saturated through every pass, and the final
|
|
22
|
+
* composition resolves to pure from / to.
|
|
23
|
+
*/
|
|
24
|
+
export const inkDiffuse = defineTransition({
|
|
25
|
+
name: "ink-diffuse",
|
|
26
|
+
passes: 7,
|
|
27
|
+
defaults: {
|
|
28
|
+
scale: 7,
|
|
29
|
+
softness: 0.08,
|
|
30
|
+
},
|
|
31
|
+
glsl: `
|
|
32
|
+
uniform float uScale;
|
|
33
|
+
uniform float uSoftness;
|
|
34
|
+
|
|
35
|
+
float hash21(vec2 p) {
|
|
36
|
+
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
float valNoise(vec2 p) {
|
|
40
|
+
vec2 i = floor(p);
|
|
41
|
+
vec2 f = fract(p);
|
|
42
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
43
|
+
float a = hash21(i);
|
|
44
|
+
float b = hash21(i + vec2(1.0, 0.0));
|
|
45
|
+
float c = hash21(i + vec2(0.0, 1.0));
|
|
46
|
+
float d = hash21(i + vec2(1.0, 1.0));
|
|
47
|
+
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
float fbm(vec2 p) {
|
|
51
|
+
return valNoise(p) * 0.55 +
|
|
52
|
+
valNoise(p * 2.1) * 0.28 +
|
|
53
|
+
valNoise(p * 4.3) * 0.17;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
vec4 transition(vec2 uv) {
|
|
57
|
+
// Final pass: use the diffused mask to composite from/to.
|
|
58
|
+
if (uPass == uPassCount - 1) {
|
|
59
|
+
float mask = getPrevious(uv).r;
|
|
60
|
+
return mix(getFromColor(uv), getToColor(uv), mask);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Seed pass: threshold noise by progress. Clamped noise range
|
|
64
|
+
// [0.05, 0.95] plus a soft edge guarantees the mask saturates to 0
|
|
65
|
+
// at progress=0 and 1 at progress=1, for every pixel.
|
|
66
|
+
if (uPass == 0) {
|
|
67
|
+
float n = clamp(fbm(uv * uScale) * 0.9 + 0.05, 0.05, 0.95);
|
|
68
|
+
float mask = smoothstep(n - uSoftness, n + uSoftness, uProgress);
|
|
69
|
+
return vec4(mask, 0.0, 0.0, 1.0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Diffusion pass: expanding-kernel dilation blended with light
|
|
73
|
+
// neighbour-averaging. Step doubles each pass for an effective
|
|
74
|
+
// reach of ~2^(passCount-2) pixels by the last iteration.
|
|
75
|
+
float step = pow(2.0, float(uPass - 1));
|
|
76
|
+
vec2 px = vec2(step) / uResolution;
|
|
77
|
+
float c = getPrevious(uv).r;
|
|
78
|
+
float e = getPrevious(uv + vec2(px.x, 0.0)).r;
|
|
79
|
+
float w = getPrevious(uv - vec2(px.x, 0.0)).r;
|
|
80
|
+
float n = getPrevious(uv + vec2(0.0, px.y)).r;
|
|
81
|
+
float s = getPrevious(uv - vec2(0.0, px.y)).r;
|
|
82
|
+
|
|
83
|
+
float dilated = max(c, max(max(e, w), max(n, s)));
|
|
84
|
+
float avg = (c + e + w + n + s) * 0.2;
|
|
85
|
+
float nextMask = mix(dilated, avg, 0.3);
|
|
86
|
+
|
|
87
|
+
return vec4(nextMask, 0.0, 0.0, 1.0);
|
|
88
|
+
}
|
|
89
|
+
`,
|
|
90
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Inspired by akella demo3 (made procedural — original used a baked
|
|
5
|
+
* displacement-map texture that we don't yet support). Circular reveal
|
|
6
|
+
* with a noise-perturbed edge AND bidirectional zoom: from-image shrinks
|
|
7
|
+
* to center while to-image grows from center. Sibling to film-burn but
|
|
8
|
+
* without the flame glow and with the akella zoom-shift on top.
|
|
9
|
+
*/
|
|
10
|
+
export const irisZoom = defineTransition({
|
|
11
|
+
name: "iris-zoom",
|
|
12
|
+
defaults: {
|
|
13
|
+
center: [0.5, 0.5],
|
|
14
|
+
width: 0.08,
|
|
15
|
+
scale: 8,
|
|
16
|
+
},
|
|
17
|
+
glsl: `
|
|
18
|
+
uniform vec2 uCenter;
|
|
19
|
+
uniform float uWidth;
|
|
20
|
+
uniform float uScale;
|
|
21
|
+
|
|
22
|
+
float hash21(vec2 p) {
|
|
23
|
+
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
float valueNoise(vec2 p) {
|
|
27
|
+
vec2 i = floor(p);
|
|
28
|
+
vec2 f = fract(p);
|
|
29
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
30
|
+
float a = hash21(i);
|
|
31
|
+
float b = hash21(i + vec2(1.0, 0.0));
|
|
32
|
+
float c = hash21(i + vec2(0.0, 1.0));
|
|
33
|
+
float d = hash21(i + vec2(1.0, 1.0));
|
|
34
|
+
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
vec4 transition(vec2 uv) {
|
|
38
|
+
// Aspect-correct distance from the iris center, normalized to [0,1] by
|
|
39
|
+
// the farthest canvas corner.
|
|
40
|
+
vec2 pixel = uv * uResolution;
|
|
41
|
+
vec2 centerPx = uCenter * uResolution;
|
|
42
|
+
float dist = distance(pixel, centerPx);
|
|
43
|
+
float maxDist = max(
|
|
44
|
+
max(length(centerPx), length(centerPx - vec2(uResolution.x, 0.0))),
|
|
45
|
+
max(length(centerPx - vec2(0.0, uResolution.y)), length(centerPx - uResolution))
|
|
46
|
+
);
|
|
47
|
+
float normalizedDist = dist / max(maxDist, 0.0001);
|
|
48
|
+
|
|
49
|
+
float noiseStrength = 0.12;
|
|
50
|
+
float n = valueNoise(uv * uScale);
|
|
51
|
+
float perturbed = normalizedDist - (n - 0.5) * noiseStrength;
|
|
52
|
+
|
|
53
|
+
float totalEdge = uWidth + noiseStrength * 0.5;
|
|
54
|
+
float radius = uProgress * (1.0 + 2.0 * totalEdge) - totalEdge;
|
|
55
|
+
float signedDist = perturbed - radius;
|
|
56
|
+
|
|
57
|
+
// intpl: 0 = unburned (from), 1 = revealed (to).
|
|
58
|
+
float intpl = 1.0 - smoothstep(-uWidth, uWidth, signedDist);
|
|
59
|
+
|
|
60
|
+
// Bidirectional zoom: from shrinks to center, to grows from center.
|
|
61
|
+
vec2 fromUv = clamp((uv - 0.5) * (1.0 - intpl) + 0.5, 0.0, 1.0);
|
|
62
|
+
vec2 toUv = clamp((uv - 0.5) * intpl + 0.5, 0.0, 1.0);
|
|
63
|
+
|
|
64
|
+
return mix(getFromColor(fromUv), getToColor(toUv), intpl);
|
|
65
|
+
}
|
|
66
|
+
`,
|
|
67
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
export const kineticBands = defineTransition({
|
|
4
|
+
name: "kinetic-bands",
|
|
5
|
+
defaults: {
|
|
6
|
+
count: 12,
|
|
7
|
+
stagger: 0.6,
|
|
8
|
+
softness: 0.02,
|
|
9
|
+
direction: [1, 0],
|
|
10
|
+
},
|
|
11
|
+
glsl: `
|
|
12
|
+
uniform float uCount;
|
|
13
|
+
uniform float uStagger;
|
|
14
|
+
uniform float uSoftness;
|
|
15
|
+
uniform vec2 uDirection;
|
|
16
|
+
|
|
17
|
+
// Snap to nearest axis-aligned unit. Diagonals would tilt the bands away
|
|
18
|
+
// from the natural horizontal stack and the boundary math would no longer
|
|
19
|
+
// align with the band's own progress envelope. Enforced in-shader so the
|
|
20
|
+
// UI's axis-only picker matches.
|
|
21
|
+
vec2 snapAxis(vec2 v) {
|
|
22
|
+
vec2 dn = normalize(v);
|
|
23
|
+
return abs(dn.x) > abs(dn.y) ? vec2(sign(dn.x), 0.0) : vec2(0.0, sign(dn.y));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
vec4 transition(vec2 uv) {
|
|
27
|
+
// count=1 collapses to a single full-frame slide; not "kinetic bands".
|
|
28
|
+
// Clamp here so the transition is reliable regardless of caller input.
|
|
29
|
+
float count = max(uCount, 2.0);
|
|
30
|
+
|
|
31
|
+
vec2 d = snapAxis(uDirection);
|
|
32
|
+
|
|
33
|
+
// Bands run perpendicular to the sweep direction. For a horizontal sweep
|
|
34
|
+
// (Right/Left), bands are horizontal stripes stacked vertically (indexed
|
|
35
|
+
// by uv.y). For a vertical sweep (Up/Down), bands are vertical stripes
|
|
36
|
+
// stacked horizontally (indexed by uv.x). Otherwise the bands and sweep
|
|
37
|
+
// axis are mismatched and the effect looks broken.
|
|
38
|
+
bool horizontalBands = abs(d.x) > abs(d.y);
|
|
39
|
+
float bandCoord = horizontalBands ? uv.y : uv.x;
|
|
40
|
+
float band = floor(bandCoord * count);
|
|
41
|
+
float bandPos = (band + 0.5) / count;
|
|
42
|
+
|
|
43
|
+
// Each band starts at bandPos * stagger and runs for (1 - stagger) of time.
|
|
44
|
+
float start = bandPos * uStagger;
|
|
45
|
+
float window = max(0.0001, 1.0 - uStagger);
|
|
46
|
+
float localProgress = clamp((uProgress - start) / window, 0.0, 1.0);
|
|
47
|
+
|
|
48
|
+
// Within the band, run a slide-style sweep so each band has its own
|
|
49
|
+
// endpoint-correct mini-transition.
|
|
50
|
+
float maxProj = 0.5;
|
|
51
|
+
float projected = dot(uv - 0.5, -d);
|
|
52
|
+
float boundary = (maxProj + uSoftness) * (1.0 - 2.0 * localProgress);
|
|
53
|
+
float w = smoothstep(boundary - uSoftness, boundary + uSoftness, projected);
|
|
54
|
+
|
|
55
|
+
return mix(getFromColor(uv), getToColor(uv), w);
|
|
56
|
+
}
|
|
57
|
+
`,
|
|
58
|
+
});
|