@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,56 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A concentric wavefront expands from a center point, distorting pixels
|
|
5
|
+
* radially at the wavefront's crest. Behind the wave: `to`. Ahead: `from`.
|
|
6
|
+
*/
|
|
7
|
+
export const shockwave = defineTransition({
|
|
8
|
+
name: "shockwave",
|
|
9
|
+
defaults: {
|
|
10
|
+
center: [0.5, 0.5],
|
|
11
|
+
thickness: 0.15,
|
|
12
|
+
strength: 0.04,
|
|
13
|
+
},
|
|
14
|
+
glsl: `
|
|
15
|
+
uniform vec2 uCenter;
|
|
16
|
+
uniform float uThickness;
|
|
17
|
+
uniform float uStrength;
|
|
18
|
+
|
|
19
|
+
vec4 transition(vec2 uv) {
|
|
20
|
+
vec2 pixel = uv * uResolution;
|
|
21
|
+
vec2 pixelCenter = uCenter * uResolution;
|
|
22
|
+
vec2 delta = pixel - pixelCenter;
|
|
23
|
+
float r = length(delta);
|
|
24
|
+
vec2 dir = r > 0.5 ? delta / r : vec2(1.0, 0.0);
|
|
25
|
+
|
|
26
|
+
float maxR = max(
|
|
27
|
+
max(length(pixelCenter), length(pixelCenter - vec2(uResolution.x, 0.0))),
|
|
28
|
+
max(length(pixelCenter - vec2(0.0, uResolution.y)), length(pixelCenter - uResolution))
|
|
29
|
+
);
|
|
30
|
+
float normalizedR = r / max(maxR, 0.0001);
|
|
31
|
+
|
|
32
|
+
// Wavefront position sweeps from outside-at-center (-thickness) to
|
|
33
|
+
// outside-at-corner (1+thickness) so distortion & seam fully exit the frame
|
|
34
|
+
// at the endpoints.
|
|
35
|
+
float wavePos = uProgress * (1.0 + 2.0 * uThickness) - uThickness;
|
|
36
|
+
float distToWave = normalizedR - wavePos;
|
|
37
|
+
|
|
38
|
+
// Distortion magnitude peaks at the wavefront and zeroes at endpoints.
|
|
39
|
+
float env = 4.0 * uProgress * (1.0 - uProgress);
|
|
40
|
+
float waveX = distToWave / max(uThickness, 0.001);
|
|
41
|
+
float waveMag = exp(-waveX * waveX * 4.0) * env * uStrength;
|
|
42
|
+
|
|
43
|
+
// Displace each image radially away from center by the wave magnitude.
|
|
44
|
+
vec2 disp = dir * waveMag;
|
|
45
|
+
|
|
46
|
+
// Behind the wavefront (distToWave < 0): show "to". Ahead: show "from".
|
|
47
|
+
// 1 - smoothstep form (smoothstep(high, low) is GLSL UB).
|
|
48
|
+
float sweep = 1.0 - smoothstep(-uThickness, uThickness, distToWave);
|
|
49
|
+
|
|
50
|
+
vec4 fromColor = getFromColor(clamp(uv + disp, 0.0, 1.0));
|
|
51
|
+
vec4 toColor = getToColor(clamp(uv - disp, 0.0, 1.0));
|
|
52
|
+
|
|
53
|
+
return mix(fromColor, toColor, sweep);
|
|
54
|
+
}
|
|
55
|
+
`,
|
|
56
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The image collapses to a single point and re-expands as the other.
|
|
5
|
+
* A scale factor runs from 1 at progress 0 to 0 at progress 0.5 to 1
|
|
6
|
+
* again at progress 1. Sampling from / to at
|
|
7
|
+
*
|
|
8
|
+
* sampleUv = center + (uv - center) · scale
|
|
9
|
+
*
|
|
10
|
+
* means that as scale approaches 0 the whole frame converges on
|
|
11
|
+
* whatever from/to looks like at the centre pixel — so the image
|
|
12
|
+
* visibly shrinks to a dot, flashes, and re-expands as the other
|
|
13
|
+
* content. A content-derived whitening pulse at progress ≈ 0.5
|
|
14
|
+
* sells the event-horizon moment without injecting synthetic
|
|
15
|
+
* colour. Crossfade happens in a narrow window around progress 0.5
|
|
16
|
+
* so from and to don't visibly coexist except at the flash instant.
|
|
17
|
+
*
|
|
18
|
+
* Endpoints: scale = 1 at progress 0/1, so the sample UV is identity
|
|
19
|
+
* and we render pure from / to. The flash envelope is zero there too.
|
|
20
|
+
*/
|
|
21
|
+
export const singularity = defineTransition({
|
|
22
|
+
name: "singularity",
|
|
23
|
+
defaults: {
|
|
24
|
+
center: [0.5, 0.5],
|
|
25
|
+
},
|
|
26
|
+
glsl: `
|
|
27
|
+
uniform vec2 uCenter;
|
|
28
|
+
|
|
29
|
+
vec4 transition(vec2 uv) {
|
|
30
|
+
// Scale: 1 at endpoints, 0 at progress 0.5. Clamped above epsilon so
|
|
31
|
+
// the flash frame still samples a real texel instead of hitting the
|
|
32
|
+
// exact centre pixel (and to give the collapse a tiny residual
|
|
33
|
+
// chromatic core rather than a hard dot).
|
|
34
|
+
float raw = abs(uProgress - 0.5) * 2.0;
|
|
35
|
+
float scale = max(raw, 1e-3);
|
|
36
|
+
|
|
37
|
+
vec2 sampleUv = clamp(uCenter + (uv - uCenter) * scale, 0.0, 1.0);
|
|
38
|
+
|
|
39
|
+
vec4 fromC = getFromColor(sampleUv);
|
|
40
|
+
vec4 toC = getToColor(sampleUv);
|
|
41
|
+
|
|
42
|
+
// Tight crossfade around the collapse — from dominates until almost
|
|
43
|
+
// progress 0.5, to takes over just after. This keeps the geometry
|
|
44
|
+
// (shrinking → dot → growing) as the dominant narrative, not a
|
|
45
|
+
// mushy overlap.
|
|
46
|
+
float blend = smoothstep(0.48, 0.52, uProgress);
|
|
47
|
+
vec3 result = mix(fromC.rgb, toC.rgb, blend);
|
|
48
|
+
|
|
49
|
+
// Event-horizon whitening: content-derived gain that peaks at the
|
|
50
|
+
// instant of collapse. Smooth falloff to zero by progress 0.3/0.7
|
|
51
|
+
// so there's no residual brightness outside the flash.
|
|
52
|
+
float flash = 1.0 - smoothstep(0.0, 0.2, raw);
|
|
53
|
+
float lum = dot(result, vec3(0.299, 0.587, 0.114));
|
|
54
|
+
result += (1.0 - result) * lum * flash;
|
|
55
|
+
|
|
56
|
+
return vec4(result, 1.0);
|
|
57
|
+
}
|
|
58
|
+
`,
|
|
59
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cover slide: the "to" image slides in and covers the stationary "from".
|
|
5
|
+
* Distinct from `push` (which scrolls both images together as a unit).
|
|
6
|
+
*/
|
|
7
|
+
export const slide = defineTransition({
|
|
8
|
+
name: "slide",
|
|
9
|
+
defaults: {
|
|
10
|
+
direction: [-1, 0],
|
|
11
|
+
feather: 0.015,
|
|
12
|
+
blur: 0,
|
|
13
|
+
},
|
|
14
|
+
glsl: `
|
|
15
|
+
uniform vec2 uDirection;
|
|
16
|
+
uniform float uFeather;
|
|
17
|
+
uniform float uBlur;
|
|
18
|
+
|
|
19
|
+
vec4 sampleToBlurred(vec2 uv, vec2 motion, float amount) {
|
|
20
|
+
if (amount < 0.001) return getToColor(clamp(uv, 0.0, 1.0));
|
|
21
|
+
// 8 Gaussian-weighted samples along the motion axis. Center samples
|
|
22
|
+
// dominate; trailing ones fade out so the blur reads as continuous, not
|
|
23
|
+
// as discrete ghost copies. Effective spread is capped at the call site
|
|
24
|
+
// — past ~0.05 UV the eye sees stripes regardless of sample count.
|
|
25
|
+
const int N = 8;
|
|
26
|
+
const float sigma = 0.25;
|
|
27
|
+
vec4 sum = vec4(0.0);
|
|
28
|
+
float wSum = 0.0;
|
|
29
|
+
for (int i = 0; i < N; i++) {
|
|
30
|
+
float t = float(i) / float(N - 1) - 0.5;
|
|
31
|
+
float w = exp(-(t * t) / (2.0 * sigma * sigma));
|
|
32
|
+
sum += getToColor(clamp(uv + motion * amount * t, 0.0, 1.0)) * w;
|
|
33
|
+
wSum += w;
|
|
34
|
+
}
|
|
35
|
+
return sum / wSum;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Snap to nearest axis-aligned unit. Slide's seam math is built around
|
|
39
|
+
// axis-aligned motion; diagonals leave triangular gaps at the corners.
|
|
40
|
+
// Enforced in-shader so the UI's axis-only picker matches.
|
|
41
|
+
vec2 snapAxis(vec2 v) {
|
|
42
|
+
vec2 d = normalize(v);
|
|
43
|
+
return abs(d.x) > abs(d.y) ? vec2(sign(d.x), 0.0) : vec2(0.0, sign(d.y));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
vec4 transition(vec2 uv) {
|
|
47
|
+
vec2 d = snapAxis(uDirection);
|
|
48
|
+
|
|
49
|
+
// "to" is translated from off-screen (behind the trailing edge) into place.
|
|
50
|
+
// At progress=0, to is offset by +d (fully off-screen). At progress=1, to is at origin.
|
|
51
|
+
vec2 toUv = uv + d * (1.0 - uProgress);
|
|
52
|
+
|
|
53
|
+
// Feathered seam between from (stationary) and to (moving into frame).
|
|
54
|
+
// The projected coordinate's range is ±maxProj where maxProj = (|dx|+|dy|)/2,
|
|
55
|
+
// so we scale by it to keep the feather zone off-screen at the endpoints
|
|
56
|
+
// for any direction (axis-aligned OR diagonal).
|
|
57
|
+
float maxProj = max((abs(d.x) + abs(d.y)) * 0.5, 0.0001);
|
|
58
|
+
float boundary = (maxProj + uFeather) * (1.0 - 2.0 * uProgress);
|
|
59
|
+
float projected = dot(uv - 0.5, -d);
|
|
60
|
+
float w = smoothstep(boundary - uFeather, boundary + uFeather, projected);
|
|
61
|
+
|
|
62
|
+
// From is stationary → sample cleanly, no blur.
|
|
63
|
+
vec4 fromColor = getFromColor(uv);
|
|
64
|
+
|
|
65
|
+
// To is the moving layer → velocity-scaled motion blur along motion axis.
|
|
66
|
+
// uBlur is the peak spread radius in UV units, capped at 0.1: past that
|
|
67
|
+
// the discrete sample structure shows as visible stripes regardless of
|
|
68
|
+
// sample count. Hard-clamp here so the transition is reliable for any
|
|
69
|
+
// caller input.
|
|
70
|
+
float motion = 4.0 * uProgress * (1.0 - uProgress) * min(uBlur, 0.1);
|
|
71
|
+
vec4 toColor = sampleToBlurred(toUv, -d, motion);
|
|
72
|
+
|
|
73
|
+
return mix(fromColor, toColor, w);
|
|
74
|
+
}
|
|
75
|
+
`,
|
|
76
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Linear burn with a smoldering trail: heavy low-frequency noise produces
|
|
5
|
+
* finger-like tendrils of fire reaching ahead of the main front, while
|
|
6
|
+
* an amber trail behind the front decays over `trailLength`. Evokes
|
|
7
|
+
* paper burning or a slow wildfire advancing, vs. directional-burn's
|
|
8
|
+
* sharper fuse-line aesthetic.
|
|
9
|
+
*/
|
|
10
|
+
export const smolderingEdge = defineTransition({
|
|
11
|
+
name: "smoldering-edge",
|
|
12
|
+
defaults: {
|
|
13
|
+
direction: [1, 1],
|
|
14
|
+
scale: 3,
|
|
15
|
+
edgeWidth: 0.04,
|
|
16
|
+
trailLength: 0.18,
|
|
17
|
+
emberColor: [1.4, 0.5, 0.1],
|
|
18
|
+
},
|
|
19
|
+
glsl: `
|
|
20
|
+
uniform vec2 uDirection;
|
|
21
|
+
uniform float uScale;
|
|
22
|
+
uniform float uEdgeWidth;
|
|
23
|
+
uniform float uTrailLength;
|
|
24
|
+
uniform vec3 uEmberColor;
|
|
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 d = normalize(uDirection);
|
|
43
|
+
float projected = dot(uv - 0.5, -d);
|
|
44
|
+
float maxProj = 0.5 * (abs(d.x) + abs(d.y));
|
|
45
|
+
|
|
46
|
+
// Heavy low-frequency noise for tendril-like edge deformation.
|
|
47
|
+
float noiseStrength = 0.25;
|
|
48
|
+
float n = valueNoise(uv * uScale);
|
|
49
|
+
float perturbed = projected - (n - 0.5) * noiseStrength;
|
|
50
|
+
|
|
51
|
+
float totalEdge = uEdgeWidth + noiseStrength * 0.5;
|
|
52
|
+
float boundary = (maxProj + totalEdge) * (1.0 - 2.0 * uProgress);
|
|
53
|
+
float signedDist = perturbed - boundary;
|
|
54
|
+
|
|
55
|
+
float w = smoothstep(-uEdgeWidth, uEdgeWidth, signedDist);
|
|
56
|
+
vec4 base = mix(getFromColor(uv), getToColor(uv), w);
|
|
57
|
+
|
|
58
|
+
// Front band: tight Gaussian on the advancing line.
|
|
59
|
+
float bandX = signedDist / max(uEdgeWidth * 1.5, 0.0001);
|
|
60
|
+
float frontBand = exp(-bandX * bandX * 3.0);
|
|
61
|
+
// Trail: only behind the front (signedDist > 0 = already burned side),
|
|
62
|
+
// exponential decay with distance from the front.
|
|
63
|
+
float trail = max(signedDist, 0.0);
|
|
64
|
+
float trailGlow = exp(-trail / max(uTrailLength, 0.0001));
|
|
65
|
+
float trailMask = step(0.0, signedDist);
|
|
66
|
+
|
|
67
|
+
float glow = max(frontBand, trailGlow * trailMask * 0.55);
|
|
68
|
+
float env = 4.0 * uProgress * (1.0 - uProgress);
|
|
69
|
+
vec3 ember = uEmberColor * glow * env;
|
|
70
|
+
|
|
71
|
+
return vec4(base.rgb + ember, base.a);
|
|
72
|
+
}
|
|
73
|
+
`,
|
|
74
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Unified split transition: open (doors part) or close (doors meet) along
|
|
5
|
+
* either axis. Replaces four gl-transitions (HorizontalOpen, HorizontalClose,
|
|
6
|
+
* VerticalOpen, VerticalClose) with one parametric transition.
|
|
7
|
+
*
|
|
8
|
+
* axis: 0 = horizontal split (parts along Y), 1 = vertical split (parts along X)
|
|
9
|
+
* mode: 0 = open (from parts, revealing to), 1 = close (to meets over from)
|
|
10
|
+
*/
|
|
11
|
+
export const split = defineTransition({
|
|
12
|
+
name: "split",
|
|
13
|
+
defaults: {
|
|
14
|
+
axis: 0,
|
|
15
|
+
mode: 0,
|
|
16
|
+
softness: 0.01,
|
|
17
|
+
},
|
|
18
|
+
glsl: `
|
|
19
|
+
uniform float uAxis;
|
|
20
|
+
uniform float uMode;
|
|
21
|
+
uniform float uSoftness;
|
|
22
|
+
|
|
23
|
+
vec4 transition(vec2 uv) {
|
|
24
|
+
// Distance from the split axis (perpendicular to the doors' motion).
|
|
25
|
+
float splitCoord = mix(uv.x, uv.y, uAxis);
|
|
26
|
+
float absDist = abs(splitCoord - 0.5);
|
|
27
|
+
|
|
28
|
+
// Boundary is "how far from the split center the doors extend right now".
|
|
29
|
+
// OPEN: grows from -softness to 0.5+softness (from doors retreat outward).
|
|
30
|
+
// CLOSE: shrinks from 0.5+softness to -softness (to doors close inward).
|
|
31
|
+
// Both inner and outer sample at uv directly. Each door is a position-based
|
|
32
|
+
// reveal, not a texture that slides with the door — so the softness band
|
|
33
|
+
// blends two views of the same scene location instead of two different
|
|
34
|
+
// places of from/to (which produced the "wrong content at the seam"
|
|
35
|
+
// artifact in the previous slide-with-content implementation).
|
|
36
|
+
float boundary;
|
|
37
|
+
vec4 innerColor;
|
|
38
|
+
vec4 outerColor;
|
|
39
|
+
if (uMode < 0.5) {
|
|
40
|
+
boundary = -uSoftness + uProgress * (0.5 + 2.0 * uSoftness);
|
|
41
|
+
innerColor = getToColor(uv);
|
|
42
|
+
outerColor = getFromColor(uv);
|
|
43
|
+
} else {
|
|
44
|
+
boundary = (0.5 + uSoftness) - uProgress * (0.5 + 2.0 * uSoftness);
|
|
45
|
+
innerColor = getFromColor(uv);
|
|
46
|
+
outerColor = getToColor(uv);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
float w = smoothstep(boundary - uSoftness, boundary + uSoftness, absDist);
|
|
50
|
+
return mix(innerColor, outerColor, w);
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Ported from gl-transitions' Swirl (by Sergey Kosarevsky). Both images are
|
|
5
|
+
* sampled at the same swirled UV — so the symmetric swirl envelope does NOT
|
|
6
|
+
* cause a visual freeze, because the linear crossfade keeps opacity changing
|
|
7
|
+
* throughout. Rotation uses a quadratic falloff from center: strongest at
|
|
8
|
+
* the center, zero at the edge of the active radius.
|
|
9
|
+
*/
|
|
10
|
+
export const swirl = defineTransition({
|
|
11
|
+
name: "swirl",
|
|
12
|
+
defaults: {
|
|
13
|
+
radius: 1.0,
|
|
14
|
+
strength: 25.13,
|
|
15
|
+
},
|
|
16
|
+
glsl: `
|
|
17
|
+
uniform float uRadius;
|
|
18
|
+
uniform float uStrength;
|
|
19
|
+
|
|
20
|
+
vec4 transition(vec2 uv) {
|
|
21
|
+
vec2 centered = uv - 0.5;
|
|
22
|
+
float dist = length(centered);
|
|
23
|
+
|
|
24
|
+
if (dist < uRadius) {
|
|
25
|
+
float pct = (uRadius - dist) / uRadius;
|
|
26
|
+
// Symmetric ramp: 0 → 1 → 0 as progress goes 0 → 0.5 → 1.
|
|
27
|
+
float a = uProgress <= 0.5
|
|
28
|
+
? uProgress / 0.5
|
|
29
|
+
: 1.0 - (uProgress - 0.5) / 0.5;
|
|
30
|
+
float theta = pct * pct * a * uStrength;
|
|
31
|
+
float s = sin(theta);
|
|
32
|
+
float c = cos(theta);
|
|
33
|
+
centered = vec2(dot(centered, vec2(c, -s)), dot(centered, vec2(s, c)));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
vec2 swirledUv = clamp(centered + 0.5, 0.0, 1.0);
|
|
37
|
+
vec4 c0 = getFromColor(swirledUv);
|
|
38
|
+
vec4 c1 = getToColor(swirledUv);
|
|
39
|
+
return mix(c0, c1, uProgress);
|
|
40
|
+
}
|
|
41
|
+
`,
|
|
42
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Directional motion blur concentrated on the wipe front. As the wipe
|
|
5
|
+
* sweeps across the frame, pixels near the boundary get heavy along-axis
|
|
6
|
+
* blur, simulating a camera pan through the cut. Away from the boundary,
|
|
7
|
+
* pixels stay crisp — distinct from linear-blur which blurs everything
|
|
8
|
+
* uniformly at midpoint.
|
|
9
|
+
*/
|
|
10
|
+
export const tangentMotionBlur = defineTransition({
|
|
11
|
+
name: "tangent-motion-blur",
|
|
12
|
+
defaults: {
|
|
13
|
+
direction: [1, 0],
|
|
14
|
+
intensity: 0.08,
|
|
15
|
+
softness: 0.2,
|
|
16
|
+
},
|
|
17
|
+
glsl: `
|
|
18
|
+
uniform vec2 uDirection;
|
|
19
|
+
uniform float uIntensity;
|
|
20
|
+
uniform float uSoftness;
|
|
21
|
+
|
|
22
|
+
const int SAMPLES = 24;
|
|
23
|
+
|
|
24
|
+
vec4 transition(vec2 uv) {
|
|
25
|
+
vec2 d = normalize(uDirection);
|
|
26
|
+
// Scale by maxProj so diagonal directions clear corners at endpoints
|
|
27
|
+
// (see paint-bleed.ts).
|
|
28
|
+
float maxProj = max((abs(d.x) + abs(d.y)) * 0.5, 0.0001);
|
|
29
|
+
float projected = dot(uv - 0.5, -d);
|
|
30
|
+
// Boundary sweeps from +(maxProj+softness) to -(maxProj+softness) so the
|
|
31
|
+
// softness band is off-screen at both endpoints, for any direction.
|
|
32
|
+
float boundary = (maxProj + uSoftness) * (1.0 - 2.0 * uProgress);
|
|
33
|
+
float signedDist = projected - boundary;
|
|
34
|
+
|
|
35
|
+
float wipeMask = smoothstep(-uSoftness, uSoftness, signedDist);
|
|
36
|
+
|
|
37
|
+
// Blur amount peaks on the wipe front; envelope-gated so it zeros at
|
|
38
|
+
// both endpoints regardless of the Gaussian falloff shape.
|
|
39
|
+
float env = 4.0 * uProgress * (1.0 - uProgress);
|
|
40
|
+
float falloffX = signedDist / max(uSoftness, 0.0001);
|
|
41
|
+
float falloff = exp(-falloffX * falloffX * 2.0);
|
|
42
|
+
float blur = uIntensity * env * falloff;
|
|
43
|
+
|
|
44
|
+
vec4 cFrom = vec4(0.0);
|
|
45
|
+
vec4 cTo = vec4(0.0);
|
|
46
|
+
for (int i = 0; i < SAMPLES; i++) {
|
|
47
|
+
float t = (float(i) - float(SAMPLES - 1) * 0.5) / float(SAMPLES - 1);
|
|
48
|
+
vec2 sampleUv = clamp(uv + d * blur * t, 0.0, 1.0);
|
|
49
|
+
cFrom += getFromColor(sampleUv);
|
|
50
|
+
cTo += getToColor(sampleUv);
|
|
51
|
+
}
|
|
52
|
+
cFrom /= float(SAMPLES);
|
|
53
|
+
cTo /= float(SAMPLES);
|
|
54
|
+
|
|
55
|
+
return mix(cFrom, cTo, wipeMask);
|
|
56
|
+
}
|
|
57
|
+
`,
|
|
58
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The plane is subdivided into tiles; each tile flies off into 3D
|
|
5
|
+
* space (outward xy drift from the source point, push back in z, and
|
|
6
|
+
* a random-axis rotation around its own centroid), staggered by per-
|
|
7
|
+
* tile offset. A fake-perspective divide lets z-motion visibly shrink
|
|
8
|
+
* the tile on screen so the fly-back feels spatial rather than flat.
|
|
9
|
+
*
|
|
10
|
+
* Tiles fade out over the last 30% of their flight. Behind them, a
|
|
11
|
+
* back plane at z=0.99 shows `to`. At progress=0 every tile is at
|
|
12
|
+
* rest covering the plane (pure from); at progress=1 every tile has
|
|
13
|
+
* completed its flight with alpha=0 and the back plane is unobscured
|
|
14
|
+
* (pure to).
|
|
15
|
+
*
|
|
16
|
+
* This proves per-primitive 3D motion — the three.js flying-tiles
|
|
17
|
+
* reference the user pointed at. Per-quad attributes (aCentroid,
|
|
18
|
+
* aOffset, aRandom shared across a tile's 6 verts) let each tile
|
|
19
|
+
* translate and rotate coherently.
|
|
20
|
+
*/
|
|
21
|
+
export const tileScatter = defineTransition({
|
|
22
|
+
name: "tile-scatter",
|
|
23
|
+
mesh: { subdivisions: [20, 12], instances: 2 },
|
|
24
|
+
defaults: {
|
|
25
|
+
scatter: 1.0,
|
|
26
|
+
},
|
|
27
|
+
vertex: `
|
|
28
|
+
uniform float uScatter;
|
|
29
|
+
|
|
30
|
+
out float vAlpha;
|
|
31
|
+
flat out int vInstance;
|
|
32
|
+
|
|
33
|
+
#define PI 3.14159265359
|
|
34
|
+
#define WINDOW 0.35
|
|
35
|
+
|
|
36
|
+
float hash(float n) {
|
|
37
|
+
return fract(sin(n * 12.9898 + 4.1371) * 43758.5453);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
mat3 rotationMatrix(vec3 axis, float angle) {
|
|
41
|
+
float c = cos(angle);
|
|
42
|
+
float s = sin(angle);
|
|
43
|
+
float t = 1.0 - c;
|
|
44
|
+
vec3 a = axis;
|
|
45
|
+
return mat3(
|
|
46
|
+
c + a.x * a.x * t, a.y * a.x * t + a.z * s, a.z * a.x * t - a.y * s,
|
|
47
|
+
a.x * a.y * t - a.z * s, c + a.y * a.y * t, a.z * a.y * t + a.x * s,
|
|
48
|
+
a.x * a.z * t + a.y * s, a.y * a.z * t - a.x * s, c + a.z * a.z * t
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
void main() {
|
|
53
|
+
vUv = aUv;
|
|
54
|
+
vInstance = gl_InstanceID;
|
|
55
|
+
|
|
56
|
+
if (gl_InstanceID == 0) {
|
|
57
|
+
// Back plane: destination, far z.
|
|
58
|
+
gl_Position = vec4(aPosition, 0.99, 1.0);
|
|
59
|
+
vAlpha = 1.0;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
float start = aOffset * (1.0 - WINDOW);
|
|
64
|
+
float localT = smoothstep(start, start + WINDOW, uProgress);
|
|
65
|
+
|
|
66
|
+
// Random rotation: axis per tile, angle rate per tile.
|
|
67
|
+
vec3 axis = normalize(vec3(
|
|
68
|
+
hash(aRandom) * 2.0 - 1.0,
|
|
69
|
+
hash(aRandom + 0.13) * 2.0 - 1.0,
|
|
70
|
+
hash(aRandom + 0.27) * 2.0 - 1.0
|
|
71
|
+
));
|
|
72
|
+
float angle = localT * PI * 1.6 * (0.6 + hash(aRandom + 0.41) * 0.8);
|
|
73
|
+
mat3 rot = rotationMatrix(axis, angle);
|
|
74
|
+
|
|
75
|
+
// Rotate the vertex around the tile centroid.
|
|
76
|
+
vec3 local = vec3(aPosition - aCentroid, 0.0);
|
|
77
|
+
vec3 rotated = rot * local;
|
|
78
|
+
|
|
79
|
+
// Translation: outward from canvas center + push back in z. Source is
|
|
80
|
+
// hardcoded to (0.5, 0.5) → in clip space that's (0, 0), so awayDir is
|
|
81
|
+
// simply the centroid's direction from origin.
|
|
82
|
+
vec2 awayDir = length(aCentroid) > 1e-5 ? normalize(aCentroid) : vec2(0.0);
|
|
83
|
+
|
|
84
|
+
vec3 translation = vec3(
|
|
85
|
+
awayDir * uScatter * 0.75 * localT,
|
|
86
|
+
uScatter * 2.4 * localT
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
// Per-tile jitter so tiles don't all move in perfect radial symmetry.
|
|
90
|
+
vec3 jitter = vec3(
|
|
91
|
+
hash(aRandom + 0.55) * 2.0 - 1.0,
|
|
92
|
+
hash(aRandom + 0.71) * 2.0 - 1.0,
|
|
93
|
+
hash(aRandom + 0.89)
|
|
94
|
+
) * uScatter * 0.35 * localT;
|
|
95
|
+
|
|
96
|
+
vec3 worldPos = vec3(aCentroid, 0.0) + rotated + translation + jitter;
|
|
97
|
+
|
|
98
|
+
// Fake perspective: z-motion visibly shrinks tiles on screen.
|
|
99
|
+
float persp = max(1.0 + worldPos.z * 0.45, 0.1);
|
|
100
|
+
vec2 screenXY = worldPos.xy / persp;
|
|
101
|
+
float clipZ = clamp(worldPos.z * 0.15, -0.9, 0.95);
|
|
102
|
+
|
|
103
|
+
gl_Position = vec4(screenXY, clipZ, 1.0);
|
|
104
|
+
|
|
105
|
+
// Alpha fade over last third of flight.
|
|
106
|
+
vAlpha = 1.0 - smoothstep(0.7, 1.0, localT);
|
|
107
|
+
}
|
|
108
|
+
`,
|
|
109
|
+
glsl: `
|
|
110
|
+
in float vAlpha;
|
|
111
|
+
flat in int vInstance;
|
|
112
|
+
|
|
113
|
+
vec4 transition(vec2 uv) {
|
|
114
|
+
if (vInstance == 0) {
|
|
115
|
+
return getToColor(uv);
|
|
116
|
+
}
|
|
117
|
+
if (vAlpha < 0.01) discard;
|
|
118
|
+
vec4 col = getFromColor(uv);
|
|
119
|
+
return vec4(col.rgb, col.a * vAlpha);
|
|
120
|
+
}
|
|
121
|
+
`,
|
|
122
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
export const warpZoom = defineTransition({
|
|
4
|
+
name: "warp-zoom",
|
|
5
|
+
defaults: {
|
|
6
|
+
center: [0.5, 0.5],
|
|
7
|
+
strength: 1.0,
|
|
8
|
+
rotation: 1.0,
|
|
9
|
+
blur: 0.02,
|
|
10
|
+
},
|
|
11
|
+
glsl: `
|
|
12
|
+
uniform vec2 uCenter;
|
|
13
|
+
uniform float uStrength;
|
|
14
|
+
uniform float uRotation;
|
|
15
|
+
uniform float uBlur;
|
|
16
|
+
|
|
17
|
+
vec2 warpAround(vec2 uv, vec2 center, float angle, float scale) {
|
|
18
|
+
vec2 d = uv - center;
|
|
19
|
+
float c = cos(angle);
|
|
20
|
+
float s = sin(angle);
|
|
21
|
+
mat2 rot = mat2(c, -s, s, c);
|
|
22
|
+
return rot * d / scale + center;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
vec4 sampleFromBlurred(vec2 uv, float amount) {
|
|
26
|
+
if (amount < 0.001) return getFromColor(clamp(uv, 0.0, 1.0));
|
|
27
|
+
const int N = 5;
|
|
28
|
+
vec4 sum = vec4(0.0);
|
|
29
|
+
for (int i = 0; i < N; i++) {
|
|
30
|
+
float t = (float(i) - 2.0) / 4.0;
|
|
31
|
+
vec2 offset = (uv - 0.5) * amount * t;
|
|
32
|
+
sum += getFromColor(clamp(uv + offset, 0.0, 1.0));
|
|
33
|
+
}
|
|
34
|
+
return sum / float(N);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
vec4 sampleToBlurred(vec2 uv, float amount) {
|
|
38
|
+
if (amount < 0.001) return getToColor(clamp(uv, 0.0, 1.0));
|
|
39
|
+
const int N = 5;
|
|
40
|
+
vec4 sum = vec4(0.0);
|
|
41
|
+
for (int i = 0; i < N; i++) {
|
|
42
|
+
float t = (float(i) - 2.0) / 4.0;
|
|
43
|
+
vec2 offset = (uv - 0.5) * amount * t;
|
|
44
|
+
sum += getToColor(clamp(uv + offset, 0.0, 1.0));
|
|
45
|
+
}
|
|
46
|
+
return sum / float(N);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
vec4 transition(vec2 uv) {
|
|
50
|
+
// From: rotates clockwise + zooms outward (gets bigger, we see less of it)
|
|
51
|
+
float fromAngle = uProgress * uRotation;
|
|
52
|
+
float fromScale = 1.0 + uProgress * uStrength;
|
|
53
|
+
|
|
54
|
+
// To: rotates counter-clockwise + zooms in (starts big, settles to native)
|
|
55
|
+
float toAngle = -(1.0 - uProgress) * uRotation;
|
|
56
|
+
float toScale = 1.0 + (1.0 - uProgress) * uStrength;
|
|
57
|
+
|
|
58
|
+
vec2 fromUv = warpAround(uv, uCenter, fromAngle, fromScale);
|
|
59
|
+
vec2 toUv = warpAround(uv, uCenter, toAngle, toScale);
|
|
60
|
+
|
|
61
|
+
// Velocity-scaled radial blur
|
|
62
|
+
float motion = 4.0 * uProgress * (1.0 - uProgress) * uBlur;
|
|
63
|
+
vec4 fromColor = sampleFromBlurred(fromUv, motion);
|
|
64
|
+
vec4 toColor = sampleToBlurred(toUv, motion);
|
|
65
|
+
|
|
66
|
+
float mixW = smoothstep(0.3, 0.7, uProgress);
|
|
67
|
+
return mix(fromColor, toColor, mixW);
|
|
68
|
+
}
|
|
69
|
+
`,
|
|
70
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineTransition } from "./define.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Inspired by chungeric's codepen MWQoLqV. The reveal pattern is a
|
|
5
|
+
* `mod()` modulation of an oblique sine field — which creates curved
|
|
6
|
+
* stripes following the iso-contours of `cos(x) + 0.8*sin(y)`. A moving
|
|
7
|
+
* threshold biased along `direction` flips stripes from from→to one by
|
|
8
|
+
* one. The original used a hard `step()`; we soften with smoothstep to
|
|
9
|
+
* honor the no-hard-cuts rule while keeping the curved-stripe character.
|
|
10
|
+
*
|
|
11
|
+
* `scale` and `softness` are baked-in — they don't expose meaningful
|
|
12
|
+
* tuning at this scale (single sine field, single stripe period). Only
|
|
13
|
+
* `direction` is user-tunable.
|
|
14
|
+
*/
|
|
15
|
+
export const waveStripes = defineTransition({
|
|
16
|
+
name: "wave-stripes",
|
|
17
|
+
defaults: {
|
|
18
|
+
direction: [1, 0],
|
|
19
|
+
},
|
|
20
|
+
glsl: `
|
|
21
|
+
uniform vec2 uDirection;
|
|
22
|
+
|
|
23
|
+
// Snap to nearest axis-aligned unit. The sweep math projects uv onto -d
|
|
24
|
+
// for the threshold bias; diagonals give an out-of-range projection that
|
|
25
|
+
// breaks endpoint correctness. Enforced in-shader so the UI's axis-only
|
|
26
|
+
// picker matches.
|
|
27
|
+
vec2 snapAxis(vec2 v) {
|
|
28
|
+
vec2 dn = normalize(v);
|
|
29
|
+
return abs(dn.x) > abs(dn.y) ? vec2(sign(dn.x), 0.0) : vec2(0.0, sign(dn.y));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
vec4 transition(vec2 uv) {
|
|
33
|
+
const float SCALE = 1.0;
|
|
34
|
+
const float SOFTNESS = 0.003;
|
|
35
|
+
|
|
36
|
+
vec2 d = snapAxis(uDirection);
|
|
37
|
+
|
|
38
|
+
// Oblique sine field; mod creates stripes following its iso-contours.
|
|
39
|
+
float field = cos(uv.x * SCALE) + sin(uv.y * SCALE) * 0.8;
|
|
40
|
+
float stripe = mod(field, 0.05);
|
|
41
|
+
|
|
42
|
+
// Threshold sweeps from above-max-stripe to below-zero. Pixels flip
|
|
43
|
+
// earliest where threshold-bias is lowest, so the reveal travels in
|
|
44
|
+
// the direction +d. d=[1,0] (default) → bias = uv.x*0.05 → reveal
|
|
45
|
+
// moves left-to-right, matching the original hardcoded behavior.
|
|
46
|
+
float proj = dot(uv - vec2(0.5), d) + 0.5;
|
|
47
|
+
float bias = proj * 0.05;
|
|
48
|
+
float threshold = (0.05 + 2.0 * SOFTNESS + bias) * (1.0 - uProgress) - SOFTNESS;
|
|
49
|
+
|
|
50
|
+
float dMix = smoothstep(threshold - SOFTNESS, threshold + SOFTNESS, stripe);
|
|
51
|
+
|
|
52
|
+
return mix(getFromColor(uv), getToColor(uv), dMix);
|
|
53
|
+
}
|
|
54
|
+
`,
|
|
55
|
+
});
|