gl-transitions 2.5.0 → 3.0.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 +33 -0
- package/README.md +16 -1
- package/compatibility.json +56 -170
- package/gl-transitions.js +1 -1
- package/gl-transitions.json +1 -1
- package/glsl3/BandWipe.glsl +67 -0
- package/glsl3/BowTie.glsl +1 -1
- package/glsl3/DirectionalWipe.glsl +1 -1
- package/glsl3/GlintDissolve.glsl +125 -0
- package/glsl3/InsetWipe.glsl +58 -0
- package/glsl3/LightningFlash.glsl +200 -0
- package/glsl3/WarpSpeed.glsl +120 -0
- package/index.js +1 -1
- package/layouts.json +191 -198
- package/llms-full.txt +452 -515
- package/llms.txt +197 -204
- package/msl/BandWipe.metal +353 -0
- package/msl/BowTie.metal +1 -1
- package/msl/DirectionalWipe.metal +1 -1
- package/msl/GlintDissolve.metal +558 -0
- package/msl/InsetWipe.metal +232 -0
- package/msl/LightningFlash.metal +1038 -0
- package/msl/WarpSpeed.metal +549 -0
- package/package.json +1 -1
- package/skills/gl-transitions/references/catalog.md +36 -37
- package/sksl/BandWipe.sksl +77 -0
- package/sksl/BowTie.sksl +1 -1
- package/sksl/DirectionalWipe.sksl +1 -1
- package/sksl/GlintDissolve.sksl +136 -0
- package/sksl/InsetWipe.sksl +70 -0
- package/sksl/LightningFlash.sksl +202 -0
- package/sksl/WarpSpeed.sksl +131 -0
- package/sksl/index.js +1 -1
- package/transitions/BandWipe.glsl +66 -0
- package/transitions/BowTie.glsl +1 -1
- package/transitions/DirectionalWipe.glsl +1 -1
- package/transitions/GlintDissolve.glsl +124 -0
- package/transitions/InsetWipe.glsl +57 -0
- package/transitions/LightningFlash.glsl +199 -0
- package/transitions/WarpSpeed.glsl +119 -0
- package/wgsl/BandWipe.wgsl +319 -0
- package/wgsl/BowTie.wgsl +1 -1
- package/wgsl/DirectionalWipe.wgsl +1 -1
- package/wgsl/GlintDissolve.wgsl +519 -0
- package/wgsl/InsetWipe.wgsl +200 -0
- package/wgsl/LightningFlash.wgsl +964 -0
- package/wgsl/WarpSpeed.wgsl +497 -0
- package/glsl3/BlockDissolve.glsl +0 -16
- package/glsl3/BowTieVertical.glsl +0 -117
- package/glsl3/Box.glsl +0 -33
- package/glsl3/LinearBlur.glsl +0 -30
- package/glsl3/MosaicBlend.glsl +0 -21
- package/glsl3/MosaicFade.glsl +0 -20
- package/glsl3/RotateFade.glsl +0 -22
- package/glsl3/ScaleIn.glsl +0 -18
- package/glsl3/WipeDown.glsl +0 -12
- package/glsl3/WipeLeft.glsl +0 -12
- package/glsl3/WipeRight.glsl +0 -12
- package/glsl3/WipeUp.glsl +0 -12
- package/msl/BlockDissolve.metal +0 -108
- package/msl/BowTieVertical.metal +0 -375
- package/msl/Box.metal +0 -204
- package/msl/LinearBlur.metal +0 -169
- package/msl/MosaicBlend.metal +0 -136
- package/msl/MosaicFade.metal +0 -137
- package/msl/RotateFade.metal +0 -116
- package/msl/ScaleIn.metal +0 -111
- package/msl/WipeDown.metal +0 -105
- package/msl/WipeLeft.metal +0 -105
- package/msl/WipeRight.metal +0 -105
- package/msl/WipeUp.metal +0 -105
- package/sksl/BlockDissolve.sksl +0 -29
- package/sksl/BowTieVertical.sksl +0 -130
- package/sksl/Box.sksl +0 -47
- package/sksl/LinearBlur.sksl +0 -44
- package/sksl/MosaicBlend.sksl +0 -34
- package/sksl/MosaicFade.sksl +0 -33
- package/sksl/RotateFade.sksl +0 -34
- package/sksl/ScaleIn.sksl +0 -32
- package/sksl/WipeDown.sksl +0 -26
- package/sksl/WipeLeft.sksl +0 -26
- package/sksl/WipeRight.sksl +0 -26
- package/sksl/WipeUp.sksl +0 -26
- package/transitions/BlockDissolve.glsl +0 -15
- package/transitions/BowTieVertical.glsl +0 -116
- package/transitions/Box.glsl +0 -32
- package/transitions/LinearBlur.glsl +0 -29
- package/transitions/MosaicBlend.glsl +0 -20
- package/transitions/MosaicFade.glsl +0 -19
- package/transitions/RotateFade.glsl +0 -21
- package/transitions/ScaleIn.glsl +0 -17
- package/transitions/WipeDown.glsl +0 -11
- package/transitions/WipeLeft.glsl +0 -11
- package/transitions/WipeRight.glsl +0 -11
- package/transitions/WipeUp.glsl +0 -11
- package/wgsl/BlockDissolve.wgsl +0 -78
- package/wgsl/BowTieVertical.wgsl +0 -331
- package/wgsl/Box.wgsl +0 -176
- package/wgsl/LinearBlur.wgsl +0 -131
- package/wgsl/MosaicBlend.wgsl +0 -108
- package/wgsl/MosaicFade.wgsl +0 -107
- package/wgsl/RotateFade.wgsl +0 -85
- package/wgsl/ScaleIn.wgsl +0 -79
- package/wgsl/WipeDown.wgsl +0 -77
- package/wgsl/WipeLeft.wgsl +0 -77
- package/wgsl/WipeRight.wgsl +0 -77
- package/wgsl/WipeUp.wgsl +0 -77
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// LightningFlash — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/LightningFlash.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: Forked lightning bolts crack down from the top of the frame, the screen flashes white in a few stuttering strobes, and the incoming image appears lit by the last flickers as they fade out
|
|
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 bolts;
|
|
16
|
+
|
|
17
|
+
uniform float strike;
|
|
18
|
+
|
|
19
|
+
uniform float seed;
|
|
20
|
+
|
|
21
|
+
uniform vec3 color;
|
|
22
|
+
|
|
23
|
+
uniform float glow;
|
|
24
|
+
|
|
25
|
+
uniform int flashes;
|
|
26
|
+
|
|
27
|
+
const float LEADER = 0.3;
|
|
28
|
+
|
|
29
|
+
float hash(vec2 p) {
|
|
30
|
+
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
|
|
31
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
32
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
float jag(float s, float k) {
|
|
36
|
+
float i = floor(s);
|
|
37
|
+
return mix(hash(vec2(i, k)), hash(vec2(i + 1.0, k)), fract(s)) - 0.5;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
float zigzag(float y, float k) {
|
|
41
|
+
return min(ratio, 1.0) * (0.15 * jag(y * 5.0, k) + 0.06 * jag(y * 13.0, k + 1.0) + 0.03 * jag(y * 31.0, k + 2.0) + 0.012 * jag(y * 67.0, k + 3.0));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
float boltX(float y, float x0, float x1, float y1, float z0, float z1, float k) {
|
|
45
|
+
float t = (1.0 - y) / (1.0 - y1);
|
|
46
|
+
return mix(x0 - z0, x1 - z1, t) + zigzag(y, k);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
float branchX(float y, float xb, float yb, float zb, float dir, float k) {
|
|
50
|
+
return xb + dir * (yb - y) + 0.6 * (zigzag(y, k) - zb);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
float curveDist(vec2 q, float x, float slope, float outside) {
|
|
54
|
+
float dx = abs(q.x - x);
|
|
55
|
+
float d = dx * mix(inversesqrt(1.0 + slope * slope), 1.0, smoothstep(0.0, 0.08, dx));
|
|
56
|
+
return length(vec2(d, max(outside, 0.0)));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
float pulse(float p, float t0, float hold, float decay) {
|
|
60
|
+
float x = p - t0;
|
|
61
|
+
if (x < 0.0) return smoothstep(-0.012, 0.0, x);
|
|
62
|
+
return exp(-max(x - hold, 0.0) / decay);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
vec4 transition(vec2 uv) {
|
|
66
|
+
float p = progress;
|
|
67
|
+
vec2 q = vec2(uv.x * ratio, uv.y);
|
|
68
|
+
|
|
69
|
+
float k0 = floor(seed) * 61.0;
|
|
70
|
+
int nb = bolts < 1 ? 1 : (bolts > 3 ? 3 : bolts);
|
|
71
|
+
int nf = flashes < 1 ? 1 : (flashes > 4 ? 4 : flashes);
|
|
72
|
+
|
|
73
|
+
int cut = nf > 1 ? 1 : 0;
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
float flash = 0.0;
|
|
77
|
+
float lit = 0.0;
|
|
78
|
+
float tCut = LEADER;
|
|
79
|
+
float tLast = LEADER;
|
|
80
|
+
float t = LEADER;
|
|
81
|
+
for (int i = 0; i < 4; i++) {
|
|
82
|
+
if (i < nf) {
|
|
83
|
+
bool isCut = i == cut;
|
|
84
|
+
float amp = isCut ? 1.0 : (i < cut ? 0.55 : 0.7 * pow(0.75, float(i - cut - 1)));
|
|
85
|
+
float s = amp * pulse(p, t, isCut ? 0.025 : 0.004, isCut ? 0.03 : 0.022);
|
|
86
|
+
flash = max(flash, s);
|
|
87
|
+
lit = max(lit, pulse(p, t, 0.01, 0.045));
|
|
88
|
+
if (isCut) tCut = t;
|
|
89
|
+
tLast = t;
|
|
90
|
+
t += (isCut ? 0.12 : 0.08) + 0.04 * hash(vec2(float(i), k0 + 5.0));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
float stutter = mix(0.7, 1.0, hash(vec2(floor(p * 70.0), k0 + 9.0)));
|
|
95
|
+
flash *= stutter;
|
|
96
|
+
|
|
97
|
+
float whiteout = pulse(p, tCut, 0.025, 0.02);
|
|
98
|
+
|
|
99
|
+
float tail = p > tLast ? exp(-(p - tLast) / 0.1) * smoothstep(0.03, 0.06, p - tLast) : 0.0;
|
|
100
|
+
flash = max(flash, 0.35 * tail * step(0.45, hash(vec2(floor(p * 40.0), k0 + 13.0))));
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
float grow = clamp(p / LEADER, 0.0, 1.0);
|
|
104
|
+
grow = (floor(grow * 7.0) + smoothstep(0.0, 1.0, fract(grow * 7.0))) / 7.0;
|
|
105
|
+
float faint = 0.5 * mix(0.6, 1.0, hash(vec2(floor(p * 50.0), k0 + 11.0)));
|
|
106
|
+
float boltLight = p < LEADER ? faint * smoothstep(0.0, 0.06, p) : max(lit * stutter, faint * exp(-(p - LEADER) / 0.12));
|
|
107
|
+
boltLight = max(boltLight, 0.6 * flash * tail);
|
|
108
|
+
boltLight *= 1.0 - smoothstep(tLast + 0.1, tLast + 0.3, p);
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
float core = 0.0;
|
|
112
|
+
float halo = 0.0;
|
|
113
|
+
float near = 10.0;
|
|
114
|
+
bool lightsOn = boltLight > 0.0 || flash > 0.0;
|
|
115
|
+
for (int b = 0; b < 3; b++) {
|
|
116
|
+
if (b < nb && lightsOn) {
|
|
117
|
+
float fb = float(b);
|
|
118
|
+
float kb = k0 + fb * 17.0;
|
|
119
|
+
float x1 = strike * ratio;
|
|
120
|
+
float y1 = -0.05;
|
|
121
|
+
float bright = 1.0;
|
|
122
|
+
if (b > 0) {
|
|
123
|
+
|
|
124
|
+
float roomy = strike < 0.5 ? 1.0 : -1.0;
|
|
125
|
+
bool cramped = min(strike, 1.0 - strike) < 0.25;
|
|
126
|
+
float side = b == 1 || cramped ? roomy : -roomy;
|
|
127
|
+
float dist = b == 2 && cramped ? 0.5 : 0.22;
|
|
128
|
+
x1 = clamp(x1 + side * ratio * (dist + 0.12 * hash(vec2(fb, kb))), 0.08 * ratio, 0.92 * ratio);
|
|
129
|
+
y1 = 0.25 + 0.25 * hash(vec2(fb, kb + 1.0));
|
|
130
|
+
bright = 0.7;
|
|
131
|
+
}
|
|
132
|
+
float x0 = clamp(x1 + (hash(vec2(fb, kb + 2.0)) - 0.5) * 0.5 * min(ratio, 1.0), 0.1 * ratio, 0.9 * ratio);
|
|
133
|
+
|
|
134
|
+
float tip = mix(1.02, y1, grow);
|
|
135
|
+
|
|
136
|
+
float e = 0.01;
|
|
137
|
+
float z0 = zigzag(1.0, kb);
|
|
138
|
+
float z1 = zigzag(y1, kb);
|
|
139
|
+
float x = boltX(q.y, x0, x1, y1, z0, z1, kb);
|
|
140
|
+
float slope = (boltX(q.y + e, x0, x1, y1, z0, z1, kb) - boltX(q.y - e, x0, x1, y1, z0, z1, kb)) / (2.0 * e);
|
|
141
|
+
float d = curveDist(q, x, slope, max(max(y1, tip) - q.y, q.y - 1.05));
|
|
142
|
+
near = min(near, d);
|
|
143
|
+
float w = 0.003 * mix(1.0, 0.7, fb / 2.0);
|
|
144
|
+
core += bright * exp(-d * d / (w * w));
|
|
145
|
+
halo += bright * (0.7 * exp(-d * 24.0) + 0.25 * exp(-d * 6.0));
|
|
146
|
+
|
|
147
|
+
for (int j = 0; j < 3; j++) {
|
|
148
|
+
float fj = float(j);
|
|
149
|
+
float kj = kb + 3.0 + fj * 5.0;
|
|
150
|
+
float tb = 0.12 + 0.2 * fj + 0.15 * hash(vec2(fj, kj));
|
|
151
|
+
float yb = mix(1.0, y1, tb);
|
|
152
|
+
float len = (0.3 + 0.25 * hash(vec2(fj, kj + 1.0))) * (1.0 - tb) * (1.0 - y1);
|
|
153
|
+
float dir = (j == 1 ? -1.0 : 1.0) * (0.2 + 0.45 * hash(vec2(fj, kj + 2.0))) * min(ratio, 1.0);
|
|
154
|
+
float xb = boltX(yb, x0, x1, y1, z0, z1, kb);
|
|
155
|
+
float zb = zigzag(yb, kj);
|
|
156
|
+
float bx = branchX(q.y, xb, yb, zb, dir, kj);
|
|
157
|
+
float bs = (branchX(q.y + e, xb, yb, zb, dir, kj) - branchX(q.y - e, xb, yb, zb, dir, kj)) / (2.0 * e);
|
|
158
|
+
float bd = curveDist(q, bx, bs, max(max(yb - len, tip) - q.y, q.y - yb));
|
|
159
|
+
near = min(near, bd);
|
|
160
|
+
float along = clamp((yb - q.y) / len, 0.0, 1.0);
|
|
161
|
+
float fade = bright * (1.0 - 0.8 * along);
|
|
162
|
+
float bw = w * mix(0.8, 0.4, along);
|
|
163
|
+
core += fade * exp(-bd * bd / (bw * bw));
|
|
164
|
+
halo += fade * 0.6 * (0.7 * exp(-bd * 24.0) + 0.25 * exp(-bd * 6.0));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
float m = smoothstep(tCut, tCut + 0.025, p);
|
|
171
|
+
vec4 c = vec4(0.0);
|
|
172
|
+
if (m < 1.0) {
|
|
173
|
+
vec4 a = getFromColor(uv);
|
|
174
|
+
c += (1.0 - m) * vec4(a.rgb * a.a, a.a);
|
|
175
|
+
}
|
|
176
|
+
if (m > 0.0) {
|
|
177
|
+
vec4 a = getToColor(uv);
|
|
178
|
+
c += m * vec4(a.rgb * a.a, a.a);
|
|
179
|
+
}
|
|
180
|
+
if (c.a <= 0.0) return vec4(0.0);
|
|
181
|
+
vec3 col = c.rgb / c.a;
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
float live = smoothstep(0.0, 0.03, p) * (1.0 - smoothstep(0.85, 1.0, p));
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
float dim = 0.4 * smoothstep(0.0, LEADER, p) * (1.0 - smoothstep(tCut, tLast + 0.15, p));
|
|
188
|
+
float f = flash * mix(0.6 + 0.4 * exp(-near * 4.0), 1.0, smoothstep(0.6, 1.0, flash));
|
|
189
|
+
col *= 1.0 - dim * live;
|
|
190
|
+
col = col * (1.0 + 2.5 * f * live) + color * (1.1 * f * live);
|
|
191
|
+
float g = 0.4 + 1.2 * glow;
|
|
192
|
+
vec3 light = mix(color, vec3(1.0), 0.75) * min(core, 1.5) * 1.6 + color * g * halo;
|
|
193
|
+
col += light * boltLight * live;
|
|
194
|
+
col = mix(col, vec3(1.0), 0.92 * whiteout * live);
|
|
195
|
+
return vec4(clamp(col, 0.0, 1.0), c.a);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
half4 main(float2 _coord) {
|
|
199
|
+
vec2 _uv = _coord / _resolution;
|
|
200
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
201
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
202
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// WarpSpeed — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/WarpSpeed.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The camera jumps to light speed: star streaks shoot out from the center and stretch longer and longer while the outgoing image is pulled into a radial smear, then after a flash the incoming image emerges from the center as the streaks shrink back
|
|
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 streaks;
|
|
18
|
+
|
|
19
|
+
uniform vec4 streakColor;
|
|
20
|
+
|
|
21
|
+
uniform float strength;
|
|
22
|
+
|
|
23
|
+
uniform float flash;
|
|
24
|
+
|
|
25
|
+
const float PI = 3.141592653589793;
|
|
26
|
+
const int TAPS = 12;
|
|
27
|
+
|
|
28
|
+
float hash(vec2 p) {
|
|
29
|
+
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
|
|
30
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
31
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
float stars(float a, float r, float n, float layer, float travel, float speed, float reach) {
|
|
35
|
+
float cell = floor(a * n);
|
|
36
|
+
float h1 = hash(vec2(cell, layer));
|
|
37
|
+
float h2 = hash(vec2(cell, layer + 17.0));
|
|
38
|
+
float h3 = hash(vec2(cell, layer + 31.0));
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
float life = fract(h1 + travel * (0.6 + 0.8 * h2));
|
|
42
|
+
float head = reach * (0.05 + 1.05 * pow(life, 1.4));
|
|
43
|
+
|
|
44
|
+
float tail = head * (1.0 - min(0.9, speed * (0.15 + 0.5 * h3)));
|
|
45
|
+
float along = clamp((r - tail) / max(head - tail, 1e-4), 0.0, 1.0);
|
|
46
|
+
float inside = step(tail, r) * (1.0 - smoothstep(head - 0.006, head, r));
|
|
47
|
+
|
|
48
|
+
float profile = inside * along * along;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
float f = fract(a * n);
|
|
52
|
+
float cellWidth = 2.0 * PI * r / n;
|
|
53
|
+
float offset = 0.3 + 0.4 * h3;
|
|
54
|
+
float across = (f - offset) * cellWidth;
|
|
55
|
+
float width = min(0.0014 + 0.002 * r / reach, 0.15 * cellWidth);
|
|
56
|
+
float x = across * across / (width * width);
|
|
57
|
+
float line = (exp(-x) + 0.25 * exp(-x / 9.0)) * smoothstep(0.0, 0.2, min(f, 1.0 - f));
|
|
58
|
+
|
|
59
|
+
float fade = smoothstep(0.0, 0.2, life) * (1.0 - smoothstep(0.9, 1.0, life));
|
|
60
|
+
return profile * line * fade * (0.4 + 0.6 * h2) * step(0.25, hash(vec2(cell, layer + 43.0)));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
vec4 smear(vec2 uv, float k, float b, float jitter, bool incoming) {
|
|
64
|
+
if (b <= 0.0 && k >= 1.0) {
|
|
65
|
+
vec4 c = incoming ? getToColor(uv) : getFromColor(uv);
|
|
66
|
+
return vec4(c.rgb * c.a, c.a);
|
|
67
|
+
}
|
|
68
|
+
vec4 sum = vec4(0.0);
|
|
69
|
+
for (int i = 0; i < TAPS; i++) {
|
|
70
|
+
float s = k * (1.0 - b * (float(i) + jitter) / float(TAPS));
|
|
71
|
+
vec2 q = center + (uv - center) * s;
|
|
72
|
+
vec4 c = incoming ? getToColor(q) : getFromColor(q);
|
|
73
|
+
sum += vec4(c.rgb * c.a, c.a);
|
|
74
|
+
}
|
|
75
|
+
return sum / float(TAPS);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
vec4 transition(vec2 uv) {
|
|
79
|
+
float p = progress;
|
|
80
|
+
vec2 aspect = vec2(ratio, 1.0);
|
|
81
|
+
vec2 d = (uv - center) * aspect;
|
|
82
|
+
float r = length(d);
|
|
83
|
+
|
|
84
|
+
float a = atan(d.y, d.x + 1e-6) / (2.0 * PI) + 0.5;
|
|
85
|
+
|
|
86
|
+
vec2 far = max(center, 1.0 - center) * aspect;
|
|
87
|
+
float reach = length(far);
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
float speed = sin(PI * p);
|
|
91
|
+
speed *= speed;
|
|
92
|
+
float travel = 3.0 * (p - sin(2.0 * PI * p) / (2.0 * PI));
|
|
93
|
+
float jitter = hash(floor(uv * aspect * 997.0));
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
float goOut = smoothstep(0.0, 0.55, p);
|
|
98
|
+
float goIn = 1.0 - smoothstep(0.45, 1.0, p);
|
|
99
|
+
|
|
100
|
+
float soft = 0.35 * reach;
|
|
101
|
+
float edge = mix(-soft, reach + soft, smoothstep(0.42, 0.78, p));
|
|
102
|
+
float m = 1.0 - smoothstep(edge - soft, edge, r);
|
|
103
|
+
vec4 before = vec4(0.0);
|
|
104
|
+
vec4 after = vec4(0.0);
|
|
105
|
+
if (m < 1.0) before = smear(uv, 1.0 - 0.3 * strength * goOut * goOut, 0.6 * strength * goOut, jitter, false);
|
|
106
|
+
if (m > 0.0) after = smear(uv, 1.0 - 0.3 * strength * goIn * goIn, 0.6 * strength * goIn, jitter, true);
|
|
107
|
+
vec4 c = mix(before, after, m);
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
float dark = p < 0.5 ? speed : speed * speed * speed;
|
|
111
|
+
c.rgb *= 1.0 - 0.65 * (0.5 + 0.5 * strength) * dark;
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
float n = max(floor(streaks), 1.0);
|
|
115
|
+
float len = speed * (0.5 + 1.5 * strength);
|
|
116
|
+
float s = stars(a, r, n, 1.0, travel, len, reach);
|
|
117
|
+
s += stars(fract(a + 0.37), r, max(floor(n * 0.71), 1.0), 2.0, travel * 1.3, len, reach);
|
|
118
|
+
|
|
119
|
+
float core = r / (0.35 * reach);
|
|
120
|
+
float peak = (p - 0.5) * 9.0;
|
|
121
|
+
float glow = flash * exp(-peak * peak) * speed * (0.35 + 0.9 * exp(-core * core));
|
|
122
|
+
vec3 light = streakColor.rgb * streakColor.a * (2.2 * s * speed + glow);
|
|
123
|
+
|
|
124
|
+
return c.a > 0.0 ? vec4(clamp(c.rgb / c.a + light, 0.0, 1.0), c.a) : vec4(0.0);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
half4 main(float2 _coord) {
|
|
128
|
+
vec2 _uv = _coord / _resolution;
|
|
129
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
130
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
131
|
+
}
|