gl-transitions 3.1.0 → 3.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 +46 -0
- package/compatibility.json +306 -0
- package/gl-transitions.js +1 -1
- package/gl-transitions.json +1 -1
- package/glsl3/CardDeal.glsl +146 -0
- package/glsl3/CircleBurst.glsl +77 -0
- package/glsl3/CodeRain.glsl +114 -0
- package/glsl3/CurtainRise.glsl +71 -0
- package/glsl3/EchoSlide.glsl +93 -0
- package/glsl3/GeometricCollage.glsl +241 -0
- package/glsl3/GravityLens.glsl +66 -0
- package/glsl3/HingedSquares.glsl +121 -0
- package/glsl3/HorizontalHold.glsl +62 -0
- package/glsl3/LayoutGrid.glsl +147 -0
- package/glsl3/ProjectorThrow.glsl +75 -0
- package/glsl3/Reassemble.glsl +156 -0
- package/glsl3/RingSpin.glsl +112 -0
- package/glsl3/Shockwave.glsl +103 -0
- package/glsl3/ShoreWash.glsl +150 -0
- package/glsl3/ShutterWipe.glsl +68 -0
- package/glsl3/SpotlightWipe.glsl +63 -0
- package/glsl3/StopMotion.glsl +118 -0
- package/glsl3/Vaporize.glsl +125 -0
- package/index.js +1 -1
- package/layouts.json +725 -1
- package/llms-full.txt +734 -422
- package/llms.txt +238 -219
- package/msl/CardDeal.metal +539 -0
- package/msl/CircleBurst.metal +351 -0
- package/msl/CodeRain.metal +451 -0
- package/msl/CurtainRise.metal +263 -0
- package/msl/EchoSlide.metal +438 -0
- package/msl/GeometricCollage.metal +1188 -0
- package/msl/GravityLens.metal +236 -0
- package/msl/HingedSquares.metal +564 -0
- package/msl/HorizontalHold.metal +286 -0
- package/msl/LayoutGrid.metal +544 -0
- package/msl/ProjectorThrow.metal +313 -0
- package/msl/Reassemble.metal +667 -0
- package/msl/RingSpin.metal +474 -0
- package/msl/Shockwave.metal +256 -0
- package/msl/ShoreWash.metal +538 -0
- package/msl/ShutterWipe.metal +286 -0
- package/msl/SpotlightWipe.metal +217 -0
- package/msl/StopMotion.metal +551 -0
- package/msl/Vaporize.metal +462 -0
- package/package.json +1 -1
- package/skills/gl-transitions/references/catalog.md +94 -44
- package/sksl/CardDeal.sksl +156 -0
- package/sksl/CircleBurst.sksl +84 -0
- package/sksl/CodeRain.sksl +124 -0
- package/sksl/CurtainRise.sksl +84 -0
- package/sksl/EchoSlide.sksl +99 -0
- package/sksl/GeometricCollage.sksl +242 -0
- package/sksl/GravityLens.sksl +77 -0
- package/sksl/HingedSquares.sksl +124 -0
- package/sksl/HorizontalHold.sksl +74 -0
- package/sksl/LayoutGrid.sksl +156 -0
- package/sksl/ProjectorThrow.sksl +85 -0
- package/sksl/Reassemble.sksl +166 -0
- package/sksl/RingSpin.sksl +121 -0
- package/sksl/Shockwave.sksl +116 -0
- package/sksl/ShoreWash.sksl +159 -0
- package/sksl/ShutterWipe.sksl +80 -0
- package/sksl/SpotlightWipe.sksl +74 -0
- package/sksl/StopMotion.sksl +126 -0
- package/sksl/Vaporize.sksl +134 -0
- package/sksl/index.js +1 -1
- package/transitions/CardDeal.glsl +145 -0
- package/transitions/CircleBurst.glsl +76 -0
- package/transitions/CodeRain.glsl +113 -0
- package/transitions/CurtainRise.glsl +70 -0
- package/transitions/EchoSlide.glsl +92 -0
- package/transitions/GeometricCollage.glsl +240 -0
- package/transitions/GravityLens.glsl +65 -0
- package/transitions/HingedSquares.glsl +120 -0
- package/transitions/HorizontalHold.glsl +61 -0
- package/transitions/LayoutGrid.glsl +146 -0
- package/transitions/ProjectorThrow.glsl +74 -0
- package/transitions/Reassemble.glsl +155 -0
- package/transitions/RingSpin.glsl +111 -0
- package/transitions/Shockwave.glsl +102 -0
- package/transitions/ShoreWash.glsl +149 -0
- package/transitions/ShutterWipe.glsl +67 -0
- package/transitions/SpotlightWipe.glsl +62 -0
- package/transitions/StopMotion.glsl +117 -0
- package/transitions/Vaporize.glsl +124 -0
- package/wgsl/CardDeal.wgsl +496 -0
- package/wgsl/CircleBurst.wgsl +310 -0
- package/wgsl/CodeRain.wgsl +415 -0
- package/wgsl/CurtainRise.wgsl +235 -0
- package/wgsl/EchoSlide.wgsl +386 -0
- package/wgsl/GeometricCollage.wgsl +1075 -0
- package/wgsl/GravityLens.wgsl +206 -0
- package/wgsl/HingedSquares.wgsl +506 -0
- package/wgsl/HorizontalHold.wgsl +243 -0
- package/wgsl/LayoutGrid.wgsl +495 -0
- package/wgsl/ProjectorThrow.wgsl +274 -0
- package/wgsl/Reassemble.wgsl +609 -0
- package/wgsl/RingSpin.wgsl +426 -0
- package/wgsl/Shockwave.wgsl +226 -0
- package/wgsl/ShoreWash.wgsl +492 -0
- package/wgsl/ShutterWipe.wgsl +252 -0
- package/wgsl/SpotlightWipe.wgsl +186 -0
- package/wgsl/StopMotion.wgsl +496 -0
- package/wgsl/Vaporize.wgsl +420 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// CircleBurst — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/CircleBurst.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: Discs of three solid colors burst out of a point one after another, each covering the last, then a hole bursts open from the same point in the last one to 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 center;
|
|
16
|
+
|
|
17
|
+
uniform vec4 color1;
|
|
18
|
+
|
|
19
|
+
uniform vec4 color2;
|
|
20
|
+
|
|
21
|
+
uniform vec4 color3;
|
|
22
|
+
|
|
23
|
+
uniform float stagger;
|
|
24
|
+
|
|
25
|
+
const float AA = 0.0015;
|
|
26
|
+
|
|
27
|
+
const float SW = 0.03;
|
|
28
|
+
const float SO = 0.32;
|
|
29
|
+
|
|
30
|
+
float phase(float s, float d) {
|
|
31
|
+
return clamp((progress - s) / d, 0.0, 1.0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
float radius(float t, float R) {
|
|
35
|
+
float u = 1.0 - t;
|
|
36
|
+
return mix(-SW - AA, R, mix(t, 1.0 - u * u * u, 0.8));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
vec2 mirror(vec2 v) {
|
|
40
|
+
return 1.0 - abs(1.0 - mod(abs(v), 2.0));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
vec4 layer(vec4 p, vec4 c, float r, float x) {
|
|
44
|
+
float k = smoothstep(r - AA, r + AA, x);
|
|
45
|
+
float s = SO * c.a * k * (1.0 - smoothstep(0.0, SW, x - r));
|
|
46
|
+
p = p * (1.0 - s) + vec4(0.0, 0.0, 0.0, s);
|
|
47
|
+
k = c.a * (1.0 - k);
|
|
48
|
+
return p * (1.0 - k) + vec4(c.rgb, 1.0) * k;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
vec4 transition(vec2 uv) {
|
|
52
|
+
vec2 asp = vec2(ratio, 1.0);
|
|
53
|
+
float x = length((uv - center) * asp);
|
|
54
|
+
|
|
55
|
+
float R = length(max(center, 1.0 - center) * asp) + SW + AA;
|
|
56
|
+
float k = clamp(stagger, 0.0, 1.0);
|
|
57
|
+
float d = 1.0 / (1.0 + 3.0 * k);
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
float t = phase(0.0, d);
|
|
61
|
+
vec4 a = getFromColor(mirror(center + (uv - center) / (1.0 + 0.06 * t * (2.0 - t))));
|
|
62
|
+
vec4 p = vec4(a.rgb * a.a, a.a);
|
|
63
|
+
p = layer(p, color1, radius(t, R), x);
|
|
64
|
+
p = layer(p, color2, radius(phase(k * d, d), R), x);
|
|
65
|
+
float r = radius(phase(2.0 * k * d, d), R);
|
|
66
|
+
p = layer(p, color3, r, x);
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
t = phase(3.0 * k * d, d);
|
|
71
|
+
float h = radius(t, R);
|
|
72
|
+
float u = 1.0 - t;
|
|
73
|
+
vec4 b = getToColor(mirror(center + (uv - center) / (1.0 + 0.14 * u * u * (1.0 - 2.4 * t))));
|
|
74
|
+
float s = SO * color3.a * clamp((r - h) / SW, 0.0, 1.0) * (1.0 - smoothstep(0.0, SW, h - x));
|
|
75
|
+
vec4 q = vec4(b.rgb * b.a * (1.0 - s), b.a * (1.0 - s) + s);
|
|
76
|
+
p = mix(p, q, 1.0 - smoothstep(h - AA, h + AA, x));
|
|
77
|
+
return p.a > 0.0 ? vec4(p.rgb / p.a, p.a) : vec4(0.0);
|
|
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,124 @@
|
|
|
1
|
+
// CodeRain — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/CodeRain.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image darkens into a grid of flickering code characters tinted by its colors, then glowing streams of characters fall down the columns at their own speeds, each with a bright head and a fading tail, leaving the incoming image behind
|
|
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 cellSize;
|
|
16
|
+
|
|
17
|
+
uniform float trail;
|
|
18
|
+
|
|
19
|
+
uniform float tint;
|
|
20
|
+
|
|
21
|
+
uniform vec4 glow;
|
|
22
|
+
|
|
23
|
+
float hash12(vec2 p) {
|
|
24
|
+
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
|
|
25
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
26
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
vec4 hash42(vec2 p) {
|
|
30
|
+
vec4 p4 = fract(vec4(p.xyxy) * vec4(0.1031, 0.1030, 0.0973, 0.1099));
|
|
31
|
+
p4 += dot(p4, p4.wzxy + 33.33);
|
|
32
|
+
return fract((p4.xxyz + p4.yzzw) * p4.zywx);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
vec4 band(vec4 d) {
|
|
36
|
+
return 1.0 - smoothstep(0.3, 0.6, d);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
float glyph(vec2 cell, float t, vec2 local) {
|
|
40
|
+
vec2 b = local * vec2(6.0, 8.0) - 0.5;
|
|
41
|
+
float x = b.x;
|
|
42
|
+
float y = b.y;
|
|
43
|
+
float d = 0.667 * y;
|
|
44
|
+
|
|
45
|
+
float x04 = abs(x - 2.0) - 2.0;
|
|
46
|
+
float y06 = abs(y - 3.0) - 3.0;
|
|
47
|
+
float y03 = abs(y - 1.5) - 1.5;
|
|
48
|
+
float y36 = abs(y - 4.5) - 1.5;
|
|
49
|
+
vec2 seed = cell + t * vec2(37.0, 61.0);
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
vec4 sa = band(abs(vec4(y, y - 3.0, y - 6.0, x - d))) * band(vec4(x04, x04, x04, y06));
|
|
53
|
+
vec4 sb = band(abs(vec4(x, x, x - 4.0, x - 4.0))) * band(vec4(y03, y36, y03, y36));
|
|
54
|
+
vec4 sc = band(abs(vec4(x - 2.0, x - 2.0, x + d - 4.0, y - 1.0))) * band(vec4(y03, y36, y06, abs(x - 2.0) - 1.0));
|
|
55
|
+
float on = dot(step(0.68, hash42(seed)), sa);
|
|
56
|
+
on += dot(step(0.68, hash42(seed + 41.0)), sb);
|
|
57
|
+
on += dot(step(0.68, hash42(seed + 83.0)), sc);
|
|
58
|
+
return min(on, 1.0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
vec4 transition(vec2 uv) {
|
|
62
|
+
float h = max(cellSize, 0.005);
|
|
63
|
+
vec2 dims = vec2(0.75 * h, h);
|
|
64
|
+
|
|
65
|
+
vec2 fp = vec2(uv.x * ratio, 1.0 - uv.y);
|
|
66
|
+
|
|
67
|
+
vec2 grid = fp / dims + vec2(0.389, 0.278);
|
|
68
|
+
vec2 cell = floor(grid);
|
|
69
|
+
vec2 local = grid - cell;
|
|
70
|
+
float rc = hash12(cell + vec2(97.0, 131.0));
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
float r1 = hash12(vec2(cell.x, 11.0));
|
|
74
|
+
float r2 = hash12(vec2(cell.x, 23.0));
|
|
75
|
+
float r3 = hash12(vec2(cell.x, 37.0));
|
|
76
|
+
float T = mix(progress, progress * progress * (3.0 - 2.0 * progress), 0.5);
|
|
77
|
+
float len = max(trail, 0.01) * (0.5 + r3);
|
|
78
|
+
float u = clamp((T - 0.03 - 0.5 * r1) / (0.3 + 0.12 * r2), 0.0, 1.0);
|
|
79
|
+
|
|
80
|
+
float head = mix(-0.2, 1.0 + h + len, u * (0.7 + 0.3 * u));
|
|
81
|
+
|
|
82
|
+
float dy = head - (cell.y - 0.278) * h;
|
|
83
|
+
|
|
84
|
+
vec4 a = getFromColor(uv);
|
|
85
|
+
vec4 b = getToColor(uv);
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
vec2 cuv = clamp(vec2((cell.x + 0.111) * dims.x / ratio, 1.0 - (cell.y + 0.222) * h), 0.0, 1.0);
|
|
90
|
+
vec4 ca = getFromColor(cuv);
|
|
91
|
+
float lum = dot(ca.rgb, vec3(0.299, 0.587, 0.114));
|
|
92
|
+
vec3 hue = ca.rgb / max(max(ca.r, max(ca.g, ca.b)), 0.05);
|
|
93
|
+
vec3 ink = mix(glow.rgb * glow.a, hue, tint) * (0.1 + 0.6 * lum);
|
|
94
|
+
float near = smoothstep(-0.15, 0.0, dy);
|
|
95
|
+
float dim = max(smoothstep(0.0, 0.3, T), near);
|
|
96
|
+
float g = max(smoothstep(0.0, 0.2, T - 0.12 * rc), near);
|
|
97
|
+
float passed = step(0.0, dy);
|
|
98
|
+
|
|
99
|
+
float slow = mod(floor(T * 12.0 + rc * 7.0), 32.0);
|
|
100
|
+
float fast = 32.0 + mod(floor(T * 40.0 + rc * 13.0), 32.0);
|
|
101
|
+
float chr = glyph(cell, mix(slow, fast, passed), local);
|
|
102
|
+
vec3 code = a.rgb * (1.0 - 0.8 * dim) + ink * chr * g;
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
float fade = clamp(1.0 - dy / len, 0.0, 1.0);
|
|
107
|
+
float shade = 1.0 - smoothstep(0.3 * len, len, dy);
|
|
108
|
+
float hot = 1.0 - smoothstep(h, 3.0 * h, dy);
|
|
109
|
+
vec3 col = mix(glow.rgb * 1.2, vec3(1.0), 0.8 * hot) * glow.a;
|
|
110
|
+
vec3 stream = b.rgb * (1.0 - 0.8 * shade) + col * chr * (fade * (2.0 - fade) + hot * fade);
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
float yy = (head - fp.y) / (1.5 * h);
|
|
114
|
+
float halo = 1.6 * u * (1.0 - u) * exp(-yy * yy) * (1.0 - smoothstep(0.25, 0.5, abs(local.x - 0.5)));
|
|
115
|
+
vec3 rgb = mix(code, stream, passed) + glow.rgb * glow.a * halo;
|
|
116
|
+
|
|
117
|
+
return vec4(clamp(rgb, 0.0, 1.0), mix(a.a, mix(b.a, a.a, shade), passed));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
half4 main(float2 _coord) {
|
|
121
|
+
vec2 _uv = _coord / _resolution;
|
|
122
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
123
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
124
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// CurtainRise — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/CurtainRise.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image rises like a theater festoon curtain: cords lift its hem into scalloped swags while the fabric gathers into shaded ruffles, and it is drawn up out of the frame over 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 swags;
|
|
16
|
+
|
|
17
|
+
uniform float sag;
|
|
18
|
+
|
|
19
|
+
uniform float ruffles;
|
|
20
|
+
|
|
21
|
+
uniform float shading;
|
|
22
|
+
|
|
23
|
+
const float PI = 3.141592653589793;
|
|
24
|
+
|
|
25
|
+
vec4 transition (vec2 uv) {
|
|
26
|
+
float p = progress;
|
|
27
|
+
|
|
28
|
+
float f = 1.0 - (1.0 - p) * (1.0 - p) * (1.0 - p);
|
|
29
|
+
|
|
30
|
+
float e = mix(p, p * p * (3.0 - 2.0 * p), 0.4);
|
|
31
|
+
float s = sag * f;
|
|
32
|
+
float lift = mix(-0.01, 1.0 + sag + 0.08, e);
|
|
33
|
+
|
|
34
|
+
float n = max(1.0, floor(swags * sqrt(ratio / 1.78) + 0.5));
|
|
35
|
+
float u = fract(uv.x * n) * 2.0 - 1.0;
|
|
36
|
+
float bump = 1.0 - u * u;
|
|
37
|
+
float hem = lift - s * bump;
|
|
38
|
+
float aa = 0.002 + 0.004 * f;
|
|
39
|
+
float inside = smoothstep(hem - aa, hem + aa, uv.y);
|
|
40
|
+
|
|
41
|
+
vec4 c = vec4(0.0);
|
|
42
|
+
if (inside > 0.0) {
|
|
43
|
+
|
|
44
|
+
float h = max(1.0 - max(hem, 0.0), 1e-4);
|
|
45
|
+
float q = clamp((1.0 - uv.y) / h, 0.0, 1.0);
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
float m = min(max(1.0, floor(ruffles + 0.5)), h / 0.02);
|
|
49
|
+
float a = 2.0 * PI * m * q;
|
|
50
|
+
|
|
51
|
+
float g = 0.85 * f * min(1.0, 0.3 + 5.0 * (1.0 - h)) * (0.6 + 0.4 * bump);
|
|
52
|
+
float v = clamp(q + g * sin(a) / (2.0 * PI * m), 0.0, 1.0);
|
|
53
|
+
|
|
54
|
+
float pull = 0.25 * f * q * q * sin(PI * u) / (PI * n);
|
|
55
|
+
c = getFromColor(vec2(uv.x - pull, 1.0 - v));
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
float slope = 2.5 * g * cos(a);
|
|
59
|
+
float diffuse = (1.0 - 0.35 * slope) / sqrt(1.0 + slope * slope);
|
|
60
|
+
float crease = 0.5 + 0.5 * sin(a);
|
|
61
|
+
float light = mix(1.0, diffuse * (1.0 - 0.45 * crease * crease), shading * g);
|
|
62
|
+
|
|
63
|
+
light += 0.18 * shading * g * smoothstep(0.4, 1.0, -cos(a));
|
|
64
|
+
|
|
65
|
+
float depth = f * q * (0.3 + 0.7 * q);
|
|
66
|
+
light *= 1.0 - shading * depth * (0.35 * u * u + 0.5 * exp(-(1.0 - abs(u)) * 14.0));
|
|
67
|
+
|
|
68
|
+
light *= 1.0 - 0.35 * shading * f * exp(-(uv.y - hem) * 120.0);
|
|
69
|
+
c.rgb *= light;
|
|
70
|
+
if (inside >= 1.0) return c;
|
|
71
|
+
}
|
|
72
|
+
vec4 to = getToColor(uv);
|
|
73
|
+
|
|
74
|
+
float below = max(hem - uv.y, 0.0);
|
|
75
|
+
float shadow = 0.6 * shading * exp(-below * 22.0) * smoothstep(0.0, 0.05, lift) * (1.0 - smoothstep(1.0, 1.06, lift - s));
|
|
76
|
+
to.rgb *= 1.0 - shadow;
|
|
77
|
+
return mix(to, c, inside);
|
|
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,99 @@
|
|
|
1
|
+
// EchoSlide — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/EchoSlide.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image slides away leaving a trail of discrete fading copies of itself, a stroboscopic echo, and the incoming image's echoes converge into place
|
|
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 int echoes;
|
|
18
|
+
|
|
19
|
+
uniform float trail;
|
|
20
|
+
|
|
21
|
+
uniform float decay;
|
|
22
|
+
|
|
23
|
+
const float EDGE = 0.002;
|
|
24
|
+
|
|
25
|
+
const int MAX_ECHOES = 7;
|
|
26
|
+
|
|
27
|
+
float easeInOut(float t) {
|
|
28
|
+
return t * t * (3.0 - 2.0 * t);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
vec2 mirror(vec2 v) {
|
|
32
|
+
return 1.0 - abs(1.0 - mod(v, 2.0));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
float past(float s, float x) {
|
|
36
|
+
return x <= 0.0 ? 1.0 : x >= 1.0 ? 0.0 : clamp((s - x) / EDGE + 0.5, 0.0, 1.0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
float edgeAt(float t) {
|
|
40
|
+
return easeInOut(clamp(t, 0.0, 1.0));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
vec4 echoStep(vec2 uv, float s, vec2 shift, float j, float t0, float lag, float n) {
|
|
44
|
+
float e0 = edgeAt(t0 + j * lag);
|
|
45
|
+
float e1 = edgeAt(t0 + (j + 1.0) * lag);
|
|
46
|
+
vec4 a = getFromColor(mirror(uv - shift * e0));
|
|
47
|
+
vec4 b = getToColor(mirror(uv - shift * (e1 - 1.0)));
|
|
48
|
+
vec4 c = mix(b, a, pow((j + 0.5) / n, 0.5 + 2.0 * clamp(decay, 0.0, 1.0)));
|
|
49
|
+
|
|
50
|
+
c.rgb *= 1.0 - 0.25 * exp(-max(e1 - s, 0.0) / 0.02) * min((e1 - e0) / 0.02, 1.0);
|
|
51
|
+
return c;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
vec4 transition(vec2 uv) {
|
|
55
|
+
float dl = length(direction);
|
|
56
|
+
vec2 d = dl > 1e-6 ? direction / dl : vec2(1.0, 0.0);
|
|
57
|
+
|
|
58
|
+
float ext = abs(d.x) + abs(d.y);
|
|
59
|
+
vec2 shift = d * ext;
|
|
60
|
+
float s = 0.5 + dot(uv - 0.5, d) / ext;
|
|
61
|
+
|
|
62
|
+
float n = clamp(float(echoes), 1.0, float(MAX_ECHOES));
|
|
63
|
+
float tr = clamp(trail, 0.05, 0.6);
|
|
64
|
+
float lag = tr / n;
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
float t0 = progress >= 1.0 ? 1.0 : progress * (1.0 + tr) - tr;
|
|
69
|
+
float eIn = edgeAt(t0);
|
|
70
|
+
float eOut = edgeAt(t0 + tr);
|
|
71
|
+
|
|
72
|
+
float wIn = 1.0 - past(s, eIn);
|
|
73
|
+
float wOut = past(s, eOut);
|
|
74
|
+
float wGap = max(1.0 - wIn - wOut, 0.0);
|
|
75
|
+
vec4 c = vec4(0.0);
|
|
76
|
+
if (wGap > 0.0) {
|
|
77
|
+
|
|
78
|
+
float jf = 0.0;
|
|
79
|
+
for (int k = 1; k < MAX_ECHOES; k++) {
|
|
80
|
+
float m = float(k);
|
|
81
|
+
if (m >= n) break;
|
|
82
|
+
jf += past(s, edgeAt(t0 + m * lag));
|
|
83
|
+
}
|
|
84
|
+
float j = floor(jf);
|
|
85
|
+
c = echoStep(uv, s, shift, j, t0, lag, n);
|
|
86
|
+
if (jf > j) c = mix(c, echoStep(uv, s, shift, j + 1.0, t0, lag, n), jf - j);
|
|
87
|
+
c *= wGap;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (wIn > 0.0) c += wIn * getToColor(mirror(uv - shift * (eIn - 1.0)));
|
|
91
|
+
if (wOut > 0.0) c += wOut * getFromColor(mirror(uv - shift * eOut));
|
|
92
|
+
return c;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
half4 main(float2 _coord) {
|
|
96
|
+
vec2 _uv = _coord / _resolution;
|
|
97
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
98
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
99
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
// GeometricCollage — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/GeometricCollage.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The incoming image arrives cut into a geometric poster of quarter discs, half discs, triangles and their complements: piece after piece swings in around a corner of its cell, a flat plate of color just ahead of it, and lands flat with a soft paper shadow
|
|
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 int cells;
|
|
16
|
+
|
|
17
|
+
uniform float stagger;
|
|
18
|
+
|
|
19
|
+
uniform int plates;
|
|
20
|
+
|
|
21
|
+
uniform vec4 color1;
|
|
22
|
+
|
|
23
|
+
uniform vec4 color2;
|
|
24
|
+
|
|
25
|
+
uniform vec4 color3;
|
|
26
|
+
|
|
27
|
+
uniform float shadow;
|
|
28
|
+
|
|
29
|
+
const float PI = 3.141592653589793;
|
|
30
|
+
|
|
31
|
+
const float DUR = 0.24;
|
|
32
|
+
const float GAP = 0.07;
|
|
33
|
+
const float LEAD = 0.06;
|
|
34
|
+
|
|
35
|
+
const float SETTLE = 0.8;
|
|
36
|
+
|
|
37
|
+
const float EDGE = 0.002;
|
|
38
|
+
|
|
39
|
+
float hash12(vec2 v) {
|
|
40
|
+
vec3 v3 = fract(vec3(v.xyx) * 0.1031);
|
|
41
|
+
v3 += dot(v3, v3.yzx + 33.33);
|
|
42
|
+
return fract((v3.x + v3.y) * v3.z);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
vec2 orient(vec2 l, float k) {
|
|
46
|
+
vec2 c = l - 0.5;
|
|
47
|
+
if (k < 0.5) return l;
|
|
48
|
+
if (k < 1.5) return vec2(-c.y, c.x) + 0.5;
|
|
49
|
+
if (k < 2.5) return 0.5 - c;
|
|
50
|
+
return vec2(c.y, -c.x) + 0.5;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
vec2 pivotCorner(float k) {
|
|
54
|
+
if (k < 0.5) return vec2(0.0, 0.0);
|
|
55
|
+
if (k < 1.5) return vec2(0.0, 1.0);
|
|
56
|
+
if (k < 2.5) return vec2(1.0, 1.0);
|
|
57
|
+
return vec2(1.0, 0.0);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
float shapeDist(vec2 o, float type) {
|
|
61
|
+
if (type < 0.5) return length(o) - 1.0;
|
|
62
|
+
if (type < 1.5) return length(o - vec2(0.5, 0.0)) - 0.5;
|
|
63
|
+
return (o.x + o.y - 1.0) * 0.70710678;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
float pieceDist(vec2 l, vec2 cell, float piece) {
|
|
67
|
+
float k = floor(hash12(cell + 1.7) * 4.0);
|
|
68
|
+
|
|
69
|
+
float sd = shapeDist(orient(l, k), mod(cell.x + 2.0 * cell.y + 1.0, 3.0));
|
|
70
|
+
return piece > 0.5 ? -sd : sd;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
float boxDist(vec2 l) {
|
|
74
|
+
return min(min(l.x, l.y), min(1.0 - l.x, 1.0 - l.y));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
float easeOutCubic(float t) {
|
|
78
|
+
float u = 1.0 - clamp(t, 0.0, 1.0);
|
|
79
|
+
return 1.0 - u * u * u;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
float lift(float t) {
|
|
83
|
+
return 1.0 - smoothstep(0.3, 1.0, t);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
float spread() {
|
|
87
|
+
return (1.0 - DUR - GAP - LEAD - 0.02) * clamp(stagger, 0.0, 1.0);
|
|
88
|
+
}
|
|
89
|
+
float swing() {
|
|
90
|
+
return 1.0 - GAP - LEAD - 0.02 - spread();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
float startTime(vec2 cell, vec2 n) {
|
|
94
|
+
float order = (cell.x + (n.y - 1.0 - cell.y)) / max(n.x + n.y - 2.0, 1.0);
|
|
95
|
+
order = clamp(order * 0.75 + 0.25 * hash12(cell + 4.4), 0.0, 1.0);
|
|
96
|
+
return LEAD + spread() * order;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
vec3 swingPoint(vec2 p, vec2 cell, vec2 cs, float piece, float t) {
|
|
100
|
+
vec2 pc = pivotCorner(floor(hash12(cell + 1.7) * 4.0));
|
|
101
|
+
|
|
102
|
+
vec2 piv = (cell + (piece < 0.5 ? pc : 1.0 - pc)) * cs;
|
|
103
|
+
float sgn = hash12(cell + vec2(piece * 3.3, 5.2)) < 0.5 ? -1.0 : 1.0;
|
|
104
|
+
|
|
105
|
+
float s = smoothstep(0.0, 0.45, t) * (1.0 + 0.1 * lift(t));
|
|
106
|
+
|
|
107
|
+
float a = sgn * 0.5 * PI * (1.0 - easeOutCubic(t / SETTLE));
|
|
108
|
+
float ca = cos(a), sa = sin(a);
|
|
109
|
+
vec2 d = p - piv;
|
|
110
|
+
d = vec2(ca * d.x + sa * d.y, -sa * d.x + ca * d.y) / max(s, 0.001);
|
|
111
|
+
return vec3((piv + d) / cs - cell, s);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
vec3 layerCover(vec2 p, vec2 cell, vec2 cs, float piece, float t) {
|
|
115
|
+
vec3 q = swingPoint(p, cell, cs, piece, t);
|
|
116
|
+
if (q.z < 0.01) return vec3(0.0);
|
|
117
|
+
float e = EDGE / (min(cs.x, cs.y) * q.z);
|
|
118
|
+
float m = clamp(boxDist(q.xy) / e + 0.5, 0.0, 1.0) * clamp(-pieceDist(q.xy, cell, piece) / e + 0.5, 0.0, 1.0);
|
|
119
|
+
return vec3(m, clamp(q.xy, 0.0, 1.0));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
float layerShadow(vec2 p, vec2 cell, vec2 cs, float piece, float t) {
|
|
123
|
+
float h = lift(t);
|
|
124
|
+
vec3 q = swingPoint(p - vec2(0.07, -0.1) * h * cs.y, cell, cs, piece, t);
|
|
125
|
+
if (q.z < 0.01) return 0.0;
|
|
126
|
+
float soft = 0.02 + 0.05 * h;
|
|
127
|
+
return h * (1.0 - smoothstep(-soft, soft, pieceDist(q.xy, cell, piece))) * smoothstep(-soft, soft, boxDist(q.xy));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
vec4 plateColor(vec2 cell, float piece) {
|
|
131
|
+
float c = mod(floor(hash12(cell * 1.3 + 0.7) * 3.0) + piece, 3.0);
|
|
132
|
+
return c < 0.5 ? color1 : c < 1.5 ? color2 : color3;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
vec4 premultiplied(vec4 c) {
|
|
136
|
+
return vec4(c.rgb * c.a, c.a);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
vec4 transition(vec2 uv) {
|
|
140
|
+
float kc = float(cells < 1 ? 1 : cells);
|
|
141
|
+
vec2 n = ratio >= 1.0 ? vec2(max(1.0, floor(ratio * kc + 0.5)), kc) : vec2(kc, max(1.0, floor(kc / ratio + 0.5)));
|
|
142
|
+
vec2 cs = vec2(ratio, 1.0) / n;
|
|
143
|
+
vec2 p = uv * vec2(ratio, 1.0);
|
|
144
|
+
vec2 cell0 = floor(p / cs);
|
|
145
|
+
float sw = swing();
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
vec2 l0 = p / cs - cell0;
|
|
150
|
+
float t00 = startTime(cell0, n);
|
|
151
|
+
float sd0 = pieceDist(l0, cell0, 0.0);
|
|
152
|
+
float e0 = EDGE / min(cs.x, cs.y);
|
|
153
|
+
float landed = (progress >= t00 + sw ? clamp(-sd0 / e0 + 0.5, 0.0, 1.0) : 0.0)
|
|
154
|
+
+ (progress >= t00 + GAP + sw ? clamp(sd0 / e0 + 0.5, 0.0, 1.0) : 0.0);
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
vec4 top = vec4(-1.0, 0.0, 0.0, 0.0);
|
|
158
|
+
vec4 topPos = vec4(0.0);
|
|
159
|
+
vec4 und = vec4(-1.0, 0.0, 0.0, 0.0);
|
|
160
|
+
vec4 undPos = vec4(0.0);
|
|
161
|
+
for (int dy = -1; dy <= 1; dy++) {
|
|
162
|
+
for (int dx = -1; dx <= 1; dx++) {
|
|
163
|
+
vec2 cell = cell0 + vec2(float(dx), float(dy));
|
|
164
|
+
if (cell.x < 0.0 || cell.y < 0.0 || cell.x >= n.x || cell.y >= n.y) continue;
|
|
165
|
+
float tc = startTime(cell, n);
|
|
166
|
+
for (int pc = 0; pc < 2; pc++) {
|
|
167
|
+
float piece = float(pc);
|
|
168
|
+
float t0 = tc + GAP * piece;
|
|
169
|
+
|
|
170
|
+
float tp = (progress - t0) / sw;
|
|
171
|
+
for (int ly = 0; ly < 2; ly++) {
|
|
172
|
+
float isPlate = ly == 0 ? 1.0 : 0.0;
|
|
173
|
+
if (isPlate > 0.5 && !(plates != 0)) continue;
|
|
174
|
+
float ts = t0 - LEAD * isPlate;
|
|
175
|
+
float t = (progress - ts) / sw;
|
|
176
|
+
|
|
177
|
+
if (t <= 0.0 || tp >= 1.0 || (isPlate > 0.5 && tp >= SETTLE)) continue;
|
|
178
|
+
vec3 L = layerCover(p, cell, cs, piece, min(t, 1.0));
|
|
179
|
+
if (isPlate > 0.5) L.x *= 1.0 - smoothstep(SETTLE - 0.1, SETTLE, tp);
|
|
180
|
+
if (L.x <= 0.0) continue;
|
|
181
|
+
vec4 cur = vec4(ts, L.x, isPlate, piece);
|
|
182
|
+
vec4 curPos = vec4(cell, L.yz);
|
|
183
|
+
if (ts > top.x) {
|
|
184
|
+
und = top;
|
|
185
|
+
undPos = topPos;
|
|
186
|
+
top = cur;
|
|
187
|
+
topPos = curPos;
|
|
188
|
+
} else if (ts > und.x) {
|
|
189
|
+
und = cur;
|
|
190
|
+
undPos = curPos;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (top.z < 0.5 && und.x < 0.0 && topPos.x == cell0.x && topPos.y == cell0.y) {
|
|
198
|
+
landed = top.y < 1.0 ? landed / (1.0 - top.y) : 1.0;
|
|
199
|
+
}
|
|
200
|
+
vec4 c = mix(premultiplied(getFromColor(uv)), premultiplied(getToColor(uv)), clamp(landed, 0.0, 1.0));
|
|
201
|
+
if (und.x >= 0.0) {
|
|
202
|
+
vec4 uc = und.z > 0.5 ? plateColor(undPos.xy, und.w) : getToColor((undPos.xy + undPos.zw) * cs / vec2(ratio, 1.0));
|
|
203
|
+
c = mix(c, premultiplied(uc), und.y);
|
|
204
|
+
}
|
|
205
|
+
if (top.x >= 0.0) {
|
|
206
|
+
vec4 tc = top.z > 0.5 ? plateColor(topPos.xy, top.w) : getToColor((topPos.xy + topPos.zw) * cs / vec2(ratio, 1.0));
|
|
207
|
+
c = mix(c, premultiplied(tc), top.y);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
float sh = 0.0;
|
|
212
|
+
if (shadow > 0.0) {
|
|
213
|
+
for (int dy = -1; dy <= 1; dy++) {
|
|
214
|
+
for (int dx = -1; dx <= 1; dx++) {
|
|
215
|
+
vec2 cell = cell0 + vec2(float(dx), float(dy));
|
|
216
|
+
if (cell.x < 0.0 || cell.y < 0.0 || cell.x >= n.x || cell.y >= n.y) continue;
|
|
217
|
+
float tc = startTime(cell, n);
|
|
218
|
+
for (int pc = 0; pc < 2; pc++) {
|
|
219
|
+
float piece = float(pc);
|
|
220
|
+
float t0 = tc + GAP * piece;
|
|
221
|
+
float tp = (progress - t0) / sw;
|
|
222
|
+
for (int ly = 0; ly < 2; ly++) {
|
|
223
|
+
float isPlate = ly == 0 ? 1.0 : 0.0;
|
|
224
|
+
if (isPlate > 0.5 && (!(plates != 0) || tp >= SETTLE)) continue;
|
|
225
|
+
float ts = t0 - LEAD * isPlate;
|
|
226
|
+
float t = (progress - ts) / sw;
|
|
227
|
+
if (ts <= top.x || t <= 0.0 || t >= 1.0) continue;
|
|
228
|
+
sh = max(sh, layerShadow(p, cell, cs, piece, t));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
c.rgb *= 1.0 - 0.7 * clamp(shadow, 0.0, 1.0) * sh;
|
|
235
|
+
return c.a > 0.0 ? vec4(c.rgb / c.a, c.a) : vec4(0.0);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
half4 main(float2 _coord) {
|
|
239
|
+
vec2 _uv = _coord / _resolution;
|
|
240
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
241
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
242
|
+
}
|