gl-transitions 2.1.0 → 2.3.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/CHANGELOG.md +68 -0
- package/compatibility.json +496 -0
- package/gl-transitions.js +1 -1
- package/gl-transitions.json +1 -1
- package/glsl3/Accordion.glsl +85 -0
- package/glsl3/Ascii.glsl +124 -0
- package/glsl3/BlockCover.glsl +87 -0
- package/glsl3/BloomDissolve.glsl +110 -0
- package/glsl3/BokehDissolve.glsl +123 -0
- package/glsl3/BrushWipe.glsl +100 -0
- package/glsl3/CameraShake.glsl +98 -0
- package/glsl3/CardSwipe.glsl +81 -0
- package/glsl3/CurvedWipe.glsl +52 -0
- package/glsl3/CylinderRoll.glsl +102 -0
- package/glsl3/Disintegrate.glsl +112 -0
- package/glsl3/FilmDissolve.glsl +49 -0
- package/glsl3/FilmStrip.glsl +105 -0
- package/glsl3/FlameWipe.glsl +154 -0
- package/glsl3/GooeyWipe.glsl +97 -0
- package/glsl3/InkBleed.glsl +96 -0
- package/glsl3/LensFlare.glsl +125 -0
- package/glsl3/LightRays.glsl +106 -0
- package/glsl3/LightStreaks.glsl +117 -0
- package/glsl3/LightWipe.glsl +89 -0
- package/glsl3/PhotoDevelop.glsl +59 -0
- package/glsl3/PixelStretch.glsl +73 -0
- package/glsl3/PlusWipe.glsl +38 -0
- package/glsl3/PopIn.glsl +57 -0
- package/glsl3/Refraction.glsl +95 -0
- package/glsl3/SmokeDissolve.glsl +102 -0
- package/glsl3/SplatterWipe.glsl +154 -0
- package/glsl3/StretchSlide.glsl +62 -0
- package/glsl3/WedgeWipe.glsl +35 -0
- package/glsl3/WhipSpin.glsl +69 -0
- package/glsl3/WhipTilt.glsl +79 -0
- package/index.js +1 -1
- package/layouts.json +1512 -371
- package/llms-full.txt +793 -292
- package/llms.txt +185 -154
- package/msl/Accordion.metal +421 -0
- package/msl/Ascii.metal +567 -0
- package/msl/BlockCover.metal +403 -0
- package/msl/BloomDissolve.metal +416 -0
- package/msl/BokehDissolve.metal +447 -0
- package/msl/BrushWipe.metal +488 -0
- package/msl/CameraShake.metal +393 -0
- package/msl/CardSwipe.metal +342 -0
- package/msl/CurvedWipe.metal +229 -0
- package/msl/CylinderRoll.metal +374 -0
- package/msl/Disintegrate.metal +468 -0
- package/msl/FilmDissolve.metal +199 -0
- package/msl/FilmStrip.metal +429 -0
- package/msl/FlameWipe.metal +575 -0
- package/msl/GooeyWipe.metal +398 -0
- package/msl/InkBleed.metal +409 -0
- package/msl/LensFlare.metal +455 -0
- package/msl/LightRays.metal +427 -0
- package/msl/LightStreaks.metal +518 -0
- package/msl/LightWipe.metal +321 -0
- package/msl/PhotoDevelop.metal +245 -0
- package/msl/PixelStretch.metal +337 -0
- package/msl/PlusWipe.metal +199 -0
- package/msl/PopIn.metal +245 -0
- package/msl/Refraction.metal +333 -0
- package/msl/SmokeDissolve.metal +400 -0
- package/msl/SplatterWipe.metal +677 -0
- package/msl/StretchSlide.metal +243 -0
- package/msl/WedgeWipe.metal +154 -0
- package/msl/WhipSpin.metal +278 -0
- package/msl/WhipTilt.metal +327 -0
- package/package.json +1 -1
- package/skills/gl-transitions/references/catalog.md +113 -37
- package/sksl/Accordion.sksl +94 -0
- package/sksl/Ascii.sksl +131 -0
- package/sksl/BlockCover.sksl +96 -0
- package/sksl/BloomDissolve.sksl +119 -0
- package/sksl/BokehDissolve.sksl +132 -0
- package/sksl/BrushWipe.sksl +109 -0
- package/sksl/CameraShake.sksl +108 -0
- package/sksl/CardSwipe.sksl +93 -0
- package/sksl/CurvedWipe.sksl +64 -0
- package/sksl/CylinderRoll.sksl +112 -0
- package/sksl/Disintegrate.sksl +117 -0
- package/sksl/FilmDissolve.sksl +60 -0
- package/sksl/FilmStrip.sksl +114 -0
- package/sksl/FlameWipe.sksl +162 -0
- package/sksl/GooeyWipe.sksl +109 -0
- package/sksl/InkBleed.sksl +109 -0
- package/sksl/LensFlare.sksl +135 -0
- package/sksl/LightRays.sksl +115 -0
- package/sksl/LightStreaks.sksl +126 -0
- package/sksl/LightWipe.sksl +97 -0
- package/sksl/PhotoDevelop.sksl +72 -0
- package/sksl/PixelStretch.sksl +84 -0
- package/sksl/PlusWipe.sksl +50 -0
- package/sksl/PopIn.sksl +69 -0
- package/sksl/Refraction.sksl +103 -0
- package/sksl/SmokeDissolve.sksl +115 -0
- package/sksl/SplatterWipe.sksl +161 -0
- package/sksl/StretchSlide.sksl +74 -0
- package/sksl/WedgeWipe.sksl +46 -0
- package/sksl/WhipSpin.sksl +79 -0
- package/sksl/WhipTilt.sksl +90 -0
- package/sksl/index.js +1 -1
- package/transitions/Accordion.glsl +84 -0
- package/transitions/Ascii.glsl +123 -0
- package/transitions/BlockCover.glsl +86 -0
- package/transitions/BloomDissolve.glsl +109 -0
- package/transitions/BokehDissolve.glsl +122 -0
- package/transitions/BrushWipe.glsl +99 -0
- package/transitions/CameraShake.glsl +97 -0
- package/transitions/CardSwipe.glsl +80 -0
- package/transitions/CurvedWipe.glsl +51 -0
- package/transitions/CylinderRoll.glsl +101 -0
- package/transitions/Disintegrate.glsl +111 -0
- package/transitions/FilmDissolve.glsl +48 -0
- package/transitions/FilmStrip.glsl +104 -0
- package/transitions/FlameWipe.glsl +153 -0
- package/transitions/GooeyWipe.glsl +96 -0
- package/transitions/InkBleed.glsl +95 -0
- package/transitions/LensFlare.glsl +124 -0
- package/transitions/LightRays.glsl +105 -0
- package/transitions/LightStreaks.glsl +116 -0
- package/transitions/LightWipe.glsl +88 -0
- package/transitions/PhotoDevelop.glsl +58 -0
- package/transitions/PixelStretch.glsl +72 -0
- package/transitions/PlusWipe.glsl +37 -0
- package/transitions/PopIn.glsl +56 -0
- package/transitions/Refraction.glsl +94 -0
- package/transitions/SmokeDissolve.glsl +101 -0
- package/transitions/SplatterWipe.glsl +153 -0
- package/transitions/StretchSlide.glsl +61 -0
- package/transitions/WedgeWipe.glsl +34 -0
- package/transitions/WhipSpin.glsl +68 -0
- package/transitions/WhipTilt.glsl +78 -0
- package/wgsl/Accordion.wgsl +376 -0
- package/wgsl/Ascii.wgsl +519 -0
- package/wgsl/BlockCover.wgsl +352 -0
- package/wgsl/BloomDissolve.wgsl +372 -0
- package/wgsl/BokehDissolve.wgsl +409 -0
- package/wgsl/BrushWipe.wgsl +443 -0
- package/wgsl/CameraShake.wgsl +348 -0
- package/wgsl/CardSwipe.wgsl +308 -0
- package/wgsl/CurvedWipe.wgsl +198 -0
- package/wgsl/CylinderRoll.wgsl +330 -0
- package/wgsl/Disintegrate.wgsl +426 -0
- package/wgsl/FilmDissolve.wgsl +169 -0
- package/wgsl/FilmStrip.wgsl +381 -0
- package/wgsl/FlameWipe.wgsl +531 -0
- package/wgsl/GooeyWipe.wgsl +353 -0
- package/wgsl/InkBleed.wgsl +366 -0
- package/wgsl/LensFlare.wgsl +406 -0
- package/wgsl/LightRays.wgsl +380 -0
- package/wgsl/LightStreaks.wgsl +460 -0
- package/wgsl/LightWipe.wgsl +277 -0
- package/wgsl/PhotoDevelop.wgsl +213 -0
- package/wgsl/PixelStretch.wgsl +298 -0
- package/wgsl/PlusWipe.wgsl +165 -0
- package/wgsl/PopIn.wgsl +213 -0
- package/wgsl/Refraction.wgsl +294 -0
- package/wgsl/SmokeDissolve.wgsl +363 -0
- package/wgsl/SplatterWipe.wgsl +613 -0
- package/wgsl/StretchSlide.wgsl +213 -0
- package/wgsl/WedgeWipe.wgsl +126 -0
- package/wgsl/WhipSpin.wgsl +241 -0
- package/wgsl/WhipTilt.wgsl +291 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// PixelStretch — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/PixelStretch.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: A line sweeps across the frame and drags the outgoing image's pixels behind it as long streaks, which shorten as it goes and reveal the incoming image
|
|
5
|
+
|
|
6
|
+
uniform shader _from;
|
|
7
|
+
uniform shader _to;
|
|
8
|
+
uniform float2 _resolution;
|
|
9
|
+
uniform float progress;
|
|
10
|
+
uniform float ratio;
|
|
11
|
+
|
|
12
|
+
vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
13
|
+
vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
14
|
+
|
|
15
|
+
uniform vec2 direction;
|
|
16
|
+
|
|
17
|
+
uniform float stretch;
|
|
18
|
+
|
|
19
|
+
uniform float chroma;
|
|
20
|
+
|
|
21
|
+
uniform float softness;
|
|
22
|
+
|
|
23
|
+
uniform float jitter;
|
|
24
|
+
|
|
25
|
+
float hash(float n) {
|
|
26
|
+
n = fract(n * 0.1031);
|
|
27
|
+
n *= n + 33.33;
|
|
28
|
+
n *= n + n;
|
|
29
|
+
return fract(n);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
float smax(float x, float y, float k) {
|
|
33
|
+
float h = max(k - abs(x - y), 0.0) / k;
|
|
34
|
+
return max(x, y) + h * h * k * 0.25;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
vec2 at(vec2 uv, float s0, float s, vec2 d, float ext) {
|
|
38
|
+
return clamp(uv + d * (s - s0) * ext, 0.0, 1.0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
vec4 transition(vec2 uv) {
|
|
42
|
+
vec2 d = normalize(direction + vec2(1e-6, 0.0));
|
|
43
|
+
|
|
44
|
+
float ext = abs(d.x) + abs(d.y);
|
|
45
|
+
float s = 0.5 + dot(uv - 0.5, d) / ext;
|
|
46
|
+
|
|
47
|
+
vec2 n = vec2(-d.y, d.x);
|
|
48
|
+
float t = dot((uv - 0.5) * vec2(ratio, 1.0), n);
|
|
49
|
+
float row = floor(t * 540.0);
|
|
50
|
+
float clump = floor(t * 60.0);
|
|
51
|
+
float rnd = 0.6 * hash(row + 17.0) + 0.4 * hash(clump + 311.0);
|
|
52
|
+
|
|
53
|
+
float p = progress;
|
|
54
|
+
float k = softness + 1e-4;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
float margin = k + 0.002;
|
|
58
|
+
float a = mix(-margin, 1.0 + margin, mix(p, p * p * (3.0 - 2.0 * p), 0.5));
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
float h = clamp(4.0 * a * (1.0 - a), 0.0, 1.0);
|
|
63
|
+
float len = stretch * h * (1.0 - 0.6 * jitter * rnd);
|
|
64
|
+
float split = 0.02 * chroma * h;
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
vec4 fr = getFromColor(at(uv, s, smax(s, a + split, k), d, ext));
|
|
68
|
+
vec4 fg = getFromColor(at(uv, s, smax(s, a, k), d, ext));
|
|
69
|
+
vec4 fb = getFromColor(at(uv, s, smax(s, a - split, k), d, ext));
|
|
70
|
+
vec4 streak = vec4(fr.r, fg.g, fb.b, fg.a);
|
|
71
|
+
|
|
72
|
+
float behind = step(s, a);
|
|
73
|
+
streak.rgb *= 1.0 + 0.06 * jitter * h * (hash(row * 3.0 + 5.0) - 0.5) * behind;
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
float w = smoothstep(len - k, len + k, a - s);
|
|
77
|
+
return mix(streak, getToColor(uv), w);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
half4 main(float2 _coord) {
|
|
81
|
+
vec2 _uv = _coord / _resolution;
|
|
82
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
83
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
84
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// PlusWipe — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/PlusWipe.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: A plus-shaped cross grows from the center and widens its arms until the incoming image fills the frame
|
|
5
|
+
|
|
6
|
+
uniform shader _from;
|
|
7
|
+
uniform shader _to;
|
|
8
|
+
uniform float2 _resolution;
|
|
9
|
+
uniform float progress;
|
|
10
|
+
uniform float ratio;
|
|
11
|
+
|
|
12
|
+
vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
13
|
+
vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
14
|
+
|
|
15
|
+
uniform float smoothness;
|
|
16
|
+
|
|
17
|
+
uniform int reverse;
|
|
18
|
+
|
|
19
|
+
float boxDist (vec2 p, vec2 halfSize) {
|
|
20
|
+
vec2 d = abs(p) - halfSize;
|
|
21
|
+
return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
float plus (vec2 q, float t, float s) {
|
|
25
|
+
vec2 frame = vec2(0.5 * ratio, 0.5);
|
|
26
|
+
float k = min(frame.x, frame.y);
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
vec2 halfWidth = k * t + (frame - k) * t * t;
|
|
30
|
+
|
|
31
|
+
float halfLength = 3.0 * max(frame.x, frame.y) * t;
|
|
32
|
+
float d = min(boxDist(q, vec2(halfLength, halfWidth.y)), boxDist(q, vec2(halfWidth.x, halfLength)));
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
return 1.0 - smoothstep(0.0, s, d + s * (1.0 - t));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
vec4 transition (vec2 uv) {
|
|
39
|
+
|
|
40
|
+
vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
|
|
41
|
+
float s = max(smoothness, 0.001);
|
|
42
|
+
float m = (reverse != 0) ? 1.0 - plus(q, 1.0 - progress, s) : plus(q, progress, s);
|
|
43
|
+
return mix(getFromColor(uv), getToColor(uv), m);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
half4 main(float2 _coord) {
|
|
47
|
+
vec2 _uv = _coord / _resolution;
|
|
48
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
49
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
50
|
+
}
|
package/sksl/PopIn.sksl
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// PopIn — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/PopIn.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The incoming image pops in as a rounded card over the outgoing one, with an elastic overshoot: too big, a bit small, then it settles into the full frame as its corners square off
|
|
5
|
+
|
|
6
|
+
uniform shader _from;
|
|
7
|
+
uniform shader _to;
|
|
8
|
+
uniform float2 _resolution;
|
|
9
|
+
uniform float progress;
|
|
10
|
+
uniform float ratio;
|
|
11
|
+
|
|
12
|
+
vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
13
|
+
vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
14
|
+
|
|
15
|
+
uniform vec2 center;
|
|
16
|
+
|
|
17
|
+
uniform float bounce;
|
|
18
|
+
|
|
19
|
+
uniform float corner;
|
|
20
|
+
|
|
21
|
+
uniform float shadow;
|
|
22
|
+
|
|
23
|
+
const float PI = 3.141592653589793;
|
|
24
|
+
|
|
25
|
+
float roundedBox(vec2 p, vec2 b, float r) {
|
|
26
|
+
vec2 q = abs(p) - b + r;
|
|
27
|
+
return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
vec4 transition(vec2 uv) {
|
|
31
|
+
float t = progress;
|
|
32
|
+
|
|
33
|
+
float easeOut = 1.0 - (1.0 - t) * (1.0 - t) * (1.0 - t);
|
|
34
|
+
float spring = 1.0 - exp(-1.5 * t) * cos(2.5 * PI * t) * (1.0 - t);
|
|
35
|
+
float s = mix(easeOut, spring, bounce);
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
vec2 asp = vec2(ratio, 1.0);
|
|
39
|
+
float side = min(ratio, 1.0);
|
|
40
|
+
vec2 cardCenter = center + (0.5 - center) * s;
|
|
41
|
+
vec2 halfSize = 0.5 * s * asp;
|
|
42
|
+
float r = corner * s * side * (1.0 - t);
|
|
43
|
+
float aa = 0.002;
|
|
44
|
+
|
|
45
|
+
float d = roundedBox((uv - cardCenter) * asp, halfSize, r) - aa;
|
|
46
|
+
float cover = clamp(0.5 - d / aa, 0.0, 1.0) * smoothstep(0.0, 0.08, t);
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
float k = min(s, 1.0) * side;
|
|
50
|
+
float blur = 0.05 * k + 1e-4;
|
|
51
|
+
vec2 offset = vec2(0.0, -0.03 * k);
|
|
52
|
+
float ds = roundedBox((uv - cardCenter - offset) * asp, halfSize, r);
|
|
53
|
+
float shade = shadow * (1.0 - smoothstep(-blur, blur, ds)) * smoothstep(0.0, 0.15, t);
|
|
54
|
+
|
|
55
|
+
vec4 a = getFromColor(uv);
|
|
56
|
+
|
|
57
|
+
a.rgb *= 1.0 - shade;
|
|
58
|
+
|
|
59
|
+
vec4 b = getToColor(clamp((uv - center) / max(s, 1e-4) + center, 0.0, 1.0));
|
|
60
|
+
|
|
61
|
+
vec4 c = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), cover);
|
|
62
|
+
return c.a > 0.0 ? vec4(c.rgb / c.a, c.a) : vec4(0.0);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
half4 main(float2 _coord) {
|
|
66
|
+
vec2 _uv = _coord / _resolution;
|
|
67
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
68
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
69
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Refraction — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/Refraction.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The frame is seen through flowing liquid glass that bends the outgoing image more and more, with rainbow fringes, flares up as the incoming image takes over, then calms down and clears
|
|
5
|
+
|
|
6
|
+
uniform shader _from;
|
|
7
|
+
uniform shader _to;
|
|
8
|
+
uniform float2 _resolution;
|
|
9
|
+
uniform float progress;
|
|
10
|
+
uniform float ratio;
|
|
11
|
+
|
|
12
|
+
vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
13
|
+
vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
14
|
+
|
|
15
|
+
uniform float strength;
|
|
16
|
+
|
|
17
|
+
uniform float scale;
|
|
18
|
+
|
|
19
|
+
uniform float dispersion;
|
|
20
|
+
|
|
21
|
+
uniform float brightness;
|
|
22
|
+
|
|
23
|
+
const int TAPS = 7;
|
|
24
|
+
|
|
25
|
+
float surface(vec2 q, float t) {
|
|
26
|
+
q += 0.45 * vec2(sin(1.3 * q.y + 0.9 * t), sin(1.1 * q.x - 1.2 * t));
|
|
27
|
+
float h = sin(q.x + 0.6 * t) * sin(1.2 * q.y - 0.8 * t);
|
|
28
|
+
h += 0.5 * sin(dot(q, vec2(1.6, -1.2)) + 1.4 * t);
|
|
29
|
+
h += 0.3 * sin(dot(q, vec2(-1.1, 2.9)) - 1.9 * t + 1.7 * sin(0.9 * q.x));
|
|
30
|
+
h += 0.15 * sin(dot(q, vec2(4.3, 3.1)) + 2.6 * t);
|
|
31
|
+
return h;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
float hash12(vec2 v) {
|
|
35
|
+
vec3 v3 = fract(vec3(v.xyx) * 0.1031);
|
|
36
|
+
v3 += dot(v3, v3.yzx + 33.33);
|
|
37
|
+
return fract((v3.x + v3.y) * v3.z);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
vec2 mirror(vec2 v) {
|
|
41
|
+
return 1.0 - abs(1.0 - mod(v, 2.0));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
vec3 spectrum(float w) {
|
|
45
|
+
vec3 c = vec3(
|
|
46
|
+
1.0 - smoothstep(0.0, 0.55, w) + 0.35 * smoothstep(0.75, 1.0, w),
|
|
47
|
+
1.0 - abs(2.0 * w - 1.0) * 1.2,
|
|
48
|
+
smoothstep(0.45, 1.0, w)
|
|
49
|
+
);
|
|
50
|
+
return clamp(c, 0.0, 1.0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
vec4 transition(vec2 uv) {
|
|
54
|
+
float p = progress;
|
|
55
|
+
|
|
56
|
+
float h = 1.0 - abs(2.0 * p - 1.0);
|
|
57
|
+
float amount = h * h * (2.0 - h);
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
vec2 q = (uv - 0.5) * vec2(ratio, 1.0) * scale;
|
|
61
|
+
float t = 3.0 * p;
|
|
62
|
+
float e = 0.01;
|
|
63
|
+
vec2 slope = vec2(
|
|
64
|
+
surface(q + vec2(e, 0.0), t) - surface(q - vec2(e, 0.0), t),
|
|
65
|
+
surface(q + vec2(0.0, e), t) - surface(q - vec2(0.0, e), t)
|
|
66
|
+
) / (2.0 * e);
|
|
67
|
+
vec2 offset = slope * strength * amount / scale;
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
float wave = clamp(0.5 * surface(q, t), -1.0, 1.0);
|
|
71
|
+
float m = smoothstep(-0.015, 0.015, p - 0.5 + 0.1 * wave);
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
vec3 color = vec3(0.0);
|
|
75
|
+
vec3 weights = vec3(0.0);
|
|
76
|
+
float alpha = 0.0;
|
|
77
|
+
|
|
78
|
+
float jitter = hash12(uv * vec2(ratio, 1.0) * 1000.0) - 0.5;
|
|
79
|
+
for (int i = 0; i < TAPS; i++) {
|
|
80
|
+
float w = float(i) / float(TAPS - 1);
|
|
81
|
+
float wj = (float(i) + jitter) / float(TAPS - 1);
|
|
82
|
+
vec2 st = mirror(uv + offset * (1.0 + dispersion * (wj - 0.5) * 1.6));
|
|
83
|
+
vec4 c = mix(getFromColor(st), getToColor(st), m);
|
|
84
|
+
vec3 s = spectrum(w);
|
|
85
|
+
color += s * c.rgb * c.a;
|
|
86
|
+
weights += s;
|
|
87
|
+
alpha += c.a;
|
|
88
|
+
}
|
|
89
|
+
alpha /= float(TAPS);
|
|
90
|
+
color = color / weights / max(alpha, 1e-5);
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
float flare = 2.0 * brightness * pow(h, 8.0);
|
|
94
|
+
color = color * (1.0 + flare) / (1.0 + flare * color);
|
|
95
|
+
color += 0.1 * flare * dot(color, vec3(0.3333));
|
|
96
|
+
return vec4(clamp(color, 0.0, 1.0), alpha);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
half4 main(float2 _coord) {
|
|
100
|
+
vec2 _uv = _coord / _resolution;
|
|
101
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
102
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
103
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// SmokeDissolve — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/SmokeDissolve.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: Billowing smoke drifts in across the outgoing image, with lit tops, darker folds and wispy edges, and thickens until it covers the frame; as it thins out and drifts away, the incoming image shows through
|
|
5
|
+
|
|
6
|
+
uniform shader _from;
|
|
7
|
+
uniform shader _to;
|
|
8
|
+
uniform float2 _resolution;
|
|
9
|
+
uniform float progress;
|
|
10
|
+
uniform float ratio;
|
|
11
|
+
|
|
12
|
+
vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
13
|
+
vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
14
|
+
|
|
15
|
+
uniform vec2 direction;
|
|
16
|
+
|
|
17
|
+
uniform float scale;
|
|
18
|
+
|
|
19
|
+
uniform float spread;
|
|
20
|
+
|
|
21
|
+
uniform float softness;
|
|
22
|
+
|
|
23
|
+
uniform vec4 color;
|
|
24
|
+
|
|
25
|
+
float hash12(vec2 v) {
|
|
26
|
+
vec3 v3 = fract(vec3(v.xyx) * 0.1031);
|
|
27
|
+
v3 += dot(v3, v3.yzx + 33.33);
|
|
28
|
+
return fract((v3.x + v3.y) * v3.z);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
float vnoise(vec2 v) {
|
|
32
|
+
vec2 i = floor(v);
|
|
33
|
+
vec2 f = fract(v);
|
|
34
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
35
|
+
return mix(
|
|
36
|
+
mix(hash12(i), hash12(i + vec2(1.0, 0.0)), f.x),
|
|
37
|
+
mix(hash12(i + vec2(0.0, 1.0)), hash12(i + vec2(1.0, 1.0)), f.x),
|
|
38
|
+
f.y
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
float fbm(vec2 v) {
|
|
43
|
+
float sum = 0.0;
|
|
44
|
+
float amp = 0.5;
|
|
45
|
+
for (int i = 0; i < 4; i++) {
|
|
46
|
+
sum += amp * vnoise(v);
|
|
47
|
+
v = mat2(1.6, 1.2, -1.2, 1.6) * v + 5.3;
|
|
48
|
+
amp *= 0.5;
|
|
49
|
+
}
|
|
50
|
+
return sum / 0.9375;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
vec4 transition(vec2 uv) {
|
|
54
|
+
float p = progress;
|
|
55
|
+
vec2 pos = (uv - 0.5) * vec2(ratio, 1.0);
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
float len = length(direction);
|
|
59
|
+
vec2 dir = len > 1e-4 ? direction / len : vec2(0.0);
|
|
60
|
+
float ext = 0.5 * (abs(dir.x) * ratio + abs(dir.y)) + 1e-4;
|
|
61
|
+
float along = len > 1e-4 ? 0.5 + 0.5 * dot(pos, dir) / ext : 0.5;
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
float arrive = (p / 0.45) * (1.0 + spread) - spread * along;
|
|
66
|
+
float leave = ((p - 0.55) / 0.45) * (1.0 + spread) - spread * along;
|
|
67
|
+
float body = smoothstep(0.0, 1.0, arrive) * (1.0 - smoothstep(0.0, 1.0, leave));
|
|
68
|
+
|
|
69
|
+
float m = smoothstep(0.48, 0.52, p);
|
|
70
|
+
|
|
71
|
+
if (body <= 0.0) return m < 0.5 ? getFromColor(uv) : getToColor(uv);
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
vec2 q = (pos - direction * (p - 0.5)) * scale;
|
|
75
|
+
vec2 churn = vec2(0.5 * p, -0.35 * p);
|
|
76
|
+
vec2 warp = vec2(fbm(q + vec2(3.1, 1.7) + churn), fbm(q + vec2(8.3, 2.8) - churn));
|
|
77
|
+
vec2 w = q + 1.1 * (warp - 0.5);
|
|
78
|
+
float n = fbm(w);
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
float lit = 0.53 * (vnoise(w) - vnoise(w + vec2(0.0, 0.2)));
|
|
82
|
+
|
|
83
|
+
float wisp = vnoise(w * 3.3 - 2.0 * churn) - 0.5;
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
float edge = 2.0 * body - (1.0 - smoothstep(0.1, 0.6, n)) + 1.6 * body * (1.0 - body) * wisp;
|
|
87
|
+
float d = smoothstep(0.0, softness, edge) * mix(0.5, 1.0, smoothstep(0.2, 0.9, body));
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
vec4 base;
|
|
91
|
+
if (m <= 0.0) base = getFromColor(uv);
|
|
92
|
+
else if (m >= 1.0) base = getToColor(uv);
|
|
93
|
+
else {
|
|
94
|
+
vec4 a = getFromColor(uv);
|
|
95
|
+
vec4 b = getToColor(uv);
|
|
96
|
+
base = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), m);
|
|
97
|
+
base = base.a > 0.0 ? vec4(base.rgb / base.a, base.a) : vec4(0.0);
|
|
98
|
+
}
|
|
99
|
+
if (d <= 0.0) return base;
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
float shade = 0.92 + 1.3 * lit;
|
|
103
|
+
shade *= mix(0.76, 1.04, smoothstep(0.25, 0.75, n));
|
|
104
|
+
shade = mix(1.0, shade, 0.3 + 0.7 * d);
|
|
105
|
+
vec3 smoke = clamp(color.rgb * shade, 0.0, 1.0);
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
return mix(base, vec4(smoke, color.a), d);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
half4 main(float2 _coord) {
|
|
112
|
+
vec2 _uv = _coord / _resolution;
|
|
113
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
114
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
115
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// SplatterWipe — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/SplatterWipe.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: Splats of paint land one after another, each popping in with a spiky outline, flung droplets and a few drips running down, revealing the incoming image until they cover the frame
|
|
5
|
+
|
|
6
|
+
uniform shader _from;
|
|
7
|
+
uniform shader _to;
|
|
8
|
+
uniform float2 _resolution;
|
|
9
|
+
uniform float progress;
|
|
10
|
+
uniform float ratio;
|
|
11
|
+
|
|
12
|
+
vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
13
|
+
vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
14
|
+
|
|
15
|
+
uniform float splats;
|
|
16
|
+
|
|
17
|
+
uniform float spikiness;
|
|
18
|
+
|
|
19
|
+
uniform float droplets;
|
|
20
|
+
|
|
21
|
+
uniform float drips;
|
|
22
|
+
|
|
23
|
+
uniform float rim;
|
|
24
|
+
|
|
25
|
+
uniform float seed;
|
|
26
|
+
|
|
27
|
+
const float PI = 3.141592653589793;
|
|
28
|
+
|
|
29
|
+
const float SPIKES = 14.0;
|
|
30
|
+
|
|
31
|
+
const float REACH = 1.25;
|
|
32
|
+
|
|
33
|
+
float hash12(vec2 v) {
|
|
34
|
+
vec3 v3 = fract(vec3(v.xyx) * 0.1031);
|
|
35
|
+
v3 += dot(v3, v3.yzx + 33.33);
|
|
36
|
+
return fract((v3.x + v3.y) * v3.z);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
float turnNoise(float t, float n, vec2 key) {
|
|
40
|
+
float x = t * n;
|
|
41
|
+
float i = floor(x);
|
|
42
|
+
float f = x - i;
|
|
43
|
+
float a = hash12(key + vec2(mod(i, n), 61.0));
|
|
44
|
+
float b = hash12(key + vec2(mod(i + 1.0, n), 61.0));
|
|
45
|
+
return mix(a, b, f * f * (3.0 - 2.0 * f));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
float smax(float a, float b, float k) {
|
|
49
|
+
float h = max(k - abs(a - b), 0.0) / k;
|
|
50
|
+
return max(a, b) + h * h * k * 0.25;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
float splat(vec2 q, vec2 cell, vec2 key) {
|
|
54
|
+
float t0 = 0.01 + 0.6 * hash12(key + vec2(3.0, 0.0));
|
|
55
|
+
if (progress <= t0) return -1.0;
|
|
56
|
+
vec2 c = cell + 0.5 + 0.3 * (vec2(hash12(key + vec2(5.0, 1.0)), hash12(key + vec2(9.0, 2.0))) - 0.5);
|
|
57
|
+
vec2 d = q - c;
|
|
58
|
+
float l = length(d);
|
|
59
|
+
|
|
60
|
+
if (l > REACH + 0.1) return -1.0;
|
|
61
|
+
|
|
62
|
+
float pop = clamp((progress - t0) / 0.08, 0.0, 1.0);
|
|
63
|
+
pop = 1.0 - (1.0 - pop) * (1.0 - pop) * (1.0 - pop);
|
|
64
|
+
float x = clamp((progress - t0) / (0.96 - t0), 0.0, 1.0);
|
|
65
|
+
float grow = x * x * x;
|
|
66
|
+
float r0 = 0.42 + 0.2 * hash12(key + vec2(11.0, 3.0));
|
|
67
|
+
|
|
68
|
+
float rc = mix(r0 * pop, 1.03, grow);
|
|
69
|
+
|
|
70
|
+
float a = l > 1e-5 ? atan(d.y, d.x) / (2.0 * PI) + 0.5 : 0.0;
|
|
71
|
+
|
|
72
|
+
float lumps = mix(0.3, 0.06, grow) * (turnNoise(a, 5.0, key) - 0.5) + mix(0.18, 0.06, grow) * (turnNoise(a, 19.0, key + 3.0) - 0.5);
|
|
73
|
+
float f = rc * (1.0 + lumps) - l;
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
float s = floor(a * SPIKES);
|
|
78
|
+
float spike = -1.0;
|
|
79
|
+
for (int k = -1; k <= 1; k++) {
|
|
80
|
+
float sl = s + float(k);
|
|
81
|
+
vec2 sk = key + vec2(mod(sl, SPIKES), 17.0);
|
|
82
|
+
float h = hash12(sk);
|
|
83
|
+
float w0 = (0.022 + 0.03 * hash12(sk + 1.5)) * pop;
|
|
84
|
+
float len = max(min(spikiness * (0.06 + 0.6 * h * h) * pop, REACH - 1.2 * w0 - rc), 0.0);
|
|
85
|
+
if (len > 0.0) {
|
|
86
|
+
|
|
87
|
+
float w = w0 * min(len / 0.06, 1.0);
|
|
88
|
+
float ang = (sl + 0.5 + 0.4 * (hash12(sk + 0.5) - 0.5)) / SPIKES * 2.0 * PI - PI;
|
|
89
|
+
vec2 dir = vec2(cos(ang), sin(ang));
|
|
90
|
+
float along = dot(d, dir);
|
|
91
|
+
float across = abs(d.x * dir.y - d.y * dir.x);
|
|
92
|
+
float u = clamp((along - rc) / len, 0.0, 1.0);
|
|
93
|
+
float ray = min(w * (1.0 - 0.7 * u) - across, rc + len - along);
|
|
94
|
+
if (h > 0.5) ray = max(ray, w * 1.2 - length(d - dir * (rc + len)));
|
|
95
|
+
spike = max(spike, ray);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
f = smax(f, spike, 0.08);
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
for (int j = 0; j < 5; j++) {
|
|
102
|
+
vec2 dk = key + vec2(float(j), 29.0);
|
|
103
|
+
float hr = hash12(dk + 0.5);
|
|
104
|
+
float rad = (0.015 + 0.05 * hr * hr) * clamp(droplets * 5.0 - float(j), 0.0, 1.0) * pop;
|
|
105
|
+
if (rad > 0.0) {
|
|
106
|
+
float da = 2.0 * PI * hash12(dk);
|
|
107
|
+
float dist = min(r0 + 0.08 + 0.5 * hash12(dk + 1.5), REACH - rad) * mix(0.5, 1.0, pop);
|
|
108
|
+
f = max(f, rad - length(d - dist * vec2(cos(da), sin(da))));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
if (drips > 0.0) {
|
|
114
|
+
float run = clamp((progress - t0 - 0.03) / 0.45, 0.0, 1.0);
|
|
115
|
+
run = run * (2.0 - run);
|
|
116
|
+
for (int j = 0; j < 2; j++) {
|
|
117
|
+
vec2 dk = key + vec2(float(j), 43.0);
|
|
118
|
+
float xo = (hash12(dk) - 0.5) * r0;
|
|
119
|
+
float dw = (0.03 + 0.02 * hash12(dk + 0.5)) * pop;
|
|
120
|
+
float top = sqrt(r0 * r0 - xo * xo) * pop;
|
|
121
|
+
float bottom = min(top + drips * (0.25 + 0.75 * hash12(dk + 1.5)) * run, sqrt(REACH * REACH - xo * xo) - 1.6 * dw);
|
|
122
|
+
float dx = abs(d.x - xo);
|
|
123
|
+
float drip = min(dw - dx, min(d.y + bottom, -d.y));
|
|
124
|
+
float tip = dw * 1.4 - length(vec2(dx, d.y + bottom + 0.2 * dw));
|
|
125
|
+
f = smax(f, max(drip, tip), 0.05);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return f;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
vec4 transition(vec2 uv) {
|
|
132
|
+
float n = max(1.0, floor(splats + 0.5));
|
|
133
|
+
float cellSize = max(ratio, 1.0) / n;
|
|
134
|
+
vec2 q = vec2(uv.x * ratio, uv.y) / cellSize;
|
|
135
|
+
vec2 base = floor(q);
|
|
136
|
+
vec2 sd = seed * vec2(7.0, 13.0);
|
|
137
|
+
float f = -1.0;
|
|
138
|
+
for (int j = -1; j <= 1; j++) {
|
|
139
|
+
for (int i = -1; i <= 1; i++) {
|
|
140
|
+
vec2 cell = base + vec2(float(i), float(j));
|
|
141
|
+
f = max(f, splat(q, cell, cell + sd));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
float aa = 0.0025 / cellSize;
|
|
145
|
+
float inside = smoothstep(-aa, aa, f);
|
|
146
|
+
vec4 from = getFromColor(uv);
|
|
147
|
+
vec4 to = getToColor(uv);
|
|
148
|
+
|
|
149
|
+
float e = clamp(f / 0.045, 0.0, 1.0);
|
|
150
|
+
float amount = rim * (1.0 - smoothstep(0.75, 1.0, progress));
|
|
151
|
+
float dark = (1.0 - e) * (1.0 - e) * 0.6;
|
|
152
|
+
float gloss = smoothstep(0.2, 0.4, e) * (1.0 - smoothstep(0.4, 0.7, e)) * 0.3;
|
|
153
|
+
to.rgb = mix(to.rgb * (1.0 - dark * amount), vec3(1.0), gloss * amount * to.a);
|
|
154
|
+
return mix(from, to, inside);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
half4 main(float2 _coord) {
|
|
158
|
+
vec2 _uv = _coord / _resolution;
|
|
159
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
160
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
161
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// StretchSlide — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/StretchSlide.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image stretches out long as it shoots away to one side, pulling in the incoming one squashed behind it, which overshoots and springs back to its shape
|
|
5
|
+
|
|
6
|
+
uniform shader _from;
|
|
7
|
+
uniform shader _to;
|
|
8
|
+
uniform float2 _resolution;
|
|
9
|
+
uniform float progress;
|
|
10
|
+
uniform float ratio;
|
|
11
|
+
|
|
12
|
+
vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
13
|
+
vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
14
|
+
|
|
15
|
+
uniform vec2 direction;
|
|
16
|
+
|
|
17
|
+
uniform float stretch;
|
|
18
|
+
|
|
19
|
+
uniform float bounce;
|
|
20
|
+
|
|
21
|
+
const float PI = 3.14159265;
|
|
22
|
+
|
|
23
|
+
vec2 mirror(vec2 v) {
|
|
24
|
+
return 1.0 - abs(1.0 - mod(v, 2.0));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
vec4 transition(vec2 uv) {
|
|
28
|
+
float dl = length(direction);
|
|
29
|
+
vec2 d = dl > 1e-6 ? direction / dl : vec2(-1.0, 0.0);
|
|
30
|
+
vec2 n = vec2(-d.y, d.x);
|
|
31
|
+
|
|
32
|
+
float ext = abs(d.x) + abs(d.y);
|
|
33
|
+
vec2 q = uv - 0.5;
|
|
34
|
+
float s = 0.5 + dot(q, d) / ext;
|
|
35
|
+
float t = progress;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
float land = mix(1.0, 0.5, bounce);
|
|
39
|
+
float m = 3.0 * bounce;
|
|
40
|
+
float x = clamp(t / land, 0.0, 1.0);
|
|
41
|
+
float e = x * x * (3.0 - 2.0 * x) + m * x * x * (x - 1.0);
|
|
42
|
+
|
|
43
|
+
float w = 2.5 * PI;
|
|
44
|
+
float u = clamp((t - land) / max(1.0 - land, 1e-4), 0.0, 1.0);
|
|
45
|
+
float osc = m * (1.0 - land) / (land * w) * exp(-u) * sin(w * u) * (1.0 - u) * (1.0 - u);
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
float len = e + max(osc, 0.0);
|
|
49
|
+
float bulge = 1.0 - e + 3.0 * max(-osc, 0.0);
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
float g = 1.0 + 0.6 * stretch * bulge;
|
|
53
|
+
vec2 pt = q + d * (s / max(len, 1e-4) - s) * ext;
|
|
54
|
+
pt -= n * dot(pt, n) * (1.0 - 1.0 / g);
|
|
55
|
+
vec4 b = getToColor(mirror(pt + 0.5));
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
float l = 1.0 + 4.0 * stretch * e;
|
|
60
|
+
float k = clamp(1.6 * stretch * e, 0.0, 0.8);
|
|
61
|
+
float y = max(s - e, 0.0) / l;
|
|
62
|
+
|
|
63
|
+
float v = 2.0 * y / ((1.0 + k) + sqrt((1.0 + k) * (1.0 + k) - 4.0 * k * y));
|
|
64
|
+
vec4 a = getFromColor(mirror(q + d * (v - s) * ext + 0.5));
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
return (s < len || t >= land) ? b : a;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
half4 main(float2 _coord) {
|
|
71
|
+
vec2 _uv = _coord / _resolution;
|
|
72
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
73
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
74
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// WedgeWipe — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/WedgeWipe.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: Two hands sweep away from each other around the center, opening a widening wedge that reveals the incoming image
|
|
5
|
+
|
|
6
|
+
uniform shader _from;
|
|
7
|
+
uniform shader _to;
|
|
8
|
+
uniform float2 _resolution;
|
|
9
|
+
uniform float progress;
|
|
10
|
+
uniform float ratio;
|
|
11
|
+
|
|
12
|
+
vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
13
|
+
vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
|
|
14
|
+
|
|
15
|
+
uniform float angle;
|
|
16
|
+
|
|
17
|
+
uniform float smoothness;
|
|
18
|
+
|
|
19
|
+
uniform vec2 center;
|
|
20
|
+
|
|
21
|
+
vec4 transition (vec2 uv) {
|
|
22
|
+
|
|
23
|
+
if (progress >= 1.0) return getToColor(uv);
|
|
24
|
+
|
|
25
|
+
vec2 q = (uv - center) * vec2(ratio, 1.0);
|
|
26
|
+
float a = radians(angle);
|
|
27
|
+
|
|
28
|
+
vec2 p = vec2(abs(q.x * cos(a) - q.y * sin(a)), q.x * sin(a) + q.y * cos(a));
|
|
29
|
+
|
|
30
|
+
float spread = 3.141592653589793 * progress;
|
|
31
|
+
vec2 hand = vec2(sin(spread), cos(spread));
|
|
32
|
+
|
|
33
|
+
float l = length(p);
|
|
34
|
+
float d = length(p - hand * clamp(dot(p, hand), 0.0, l)) * sign(hand.y * p.x - hand.x * p.y);
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
float s = max(smoothness, 0.001);
|
|
38
|
+
float m = 1.0 - smoothstep(0.0, s, d + s * (1.0 - progress));
|
|
39
|
+
return mix(getFromColor(uv), getToColor(uv), m);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
half4 main(float2 _coord) {
|
|
43
|
+
vec2 _uv = _coord / _resolution;
|
|
44
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
45
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
46
|
+
}
|