gl-transitions 2.4.0 → 2.5.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 +34 -0
- package/compatibility.json +244 -0
- package/gl-transitions.js +1 -1
- package/gl-transitions.json +1 -1
- package/glsl3/ArrowWipe.glsl +100 -0
- package/glsl3/BlockSlide.glsl +87 -0
- package/glsl3/CellDissolve.glsl +91 -0
- package/glsl3/Crumple.glsl +173 -0
- package/glsl3/HeatHaze.glsl +79 -0
- package/glsl3/Hologram.glsl +97 -0
- package/glsl3/LiquidFill.glsl +102 -0
- package/glsl3/PlasmaDissolve.glsl +51 -0
- package/glsl3/RingsWipe.glsl +106 -0
- package/glsl3/SawtoothWipe.glsl +73 -0
- package/glsl3/SnakeBlockWipe.glsl +40 -0
- package/glsl3/Snapshot.glsl +86 -0
- package/glsl3/Sphere.glsl +95 -0
- package/glsl3/SpiralBlockWipe.glsl +65 -0
- package/glsl3/Vortex.glsl +106 -0
- package/index.js +1 -1
- package/layouts.json +618 -18
- package/llms-full.txt +614 -362
- package/llms.txt +204 -189
- package/msl/ArrowWipe.metal +391 -0
- package/msl/BlockSlide.metal +418 -0
- package/msl/CellDissolve.metal +374 -0
- package/msl/Crumple.metal +766 -0
- package/msl/HeatHaze.metal +320 -0
- package/msl/Hologram.metal +380 -0
- package/msl/LiquidFill.metal +373 -0
- package/msl/PlasmaDissolve.metal +178 -0
- package/msl/RingsWipe.metal +437 -0
- package/msl/SawtoothWipe.metal +310 -0
- package/msl/SnakeBlockWipe.metal +216 -0
- package/msl/Snapshot.metal +321 -0
- package/msl/Sphere.metal +345 -0
- package/msl/SpiralBlockWipe.metal +281 -0
- package/msl/Vortex.metal +522 -0
- package/package.json +1 -1
- package/skills/gl-transitions/references/catalog.md +68 -34
- package/sksl/ArrowWipe.sksl +111 -0
- package/sksl/BlockSlide.sksl +99 -0
- package/sksl/CellDissolve.sksl +103 -0
- package/sksl/Crumple.sksl +179 -0
- package/sksl/HeatHaze.sksl +90 -0
- package/sksl/Hologram.sksl +108 -0
- package/sksl/LiquidFill.sksl +113 -0
- package/sksl/PlasmaDissolve.sksl +64 -0
- package/sksl/RingsWipe.sksl +115 -0
- package/sksl/SawtoothWipe.sksl +83 -0
- package/sksl/SnakeBlockWipe.sksl +53 -0
- package/sksl/Snapshot.sksl +98 -0
- package/sksl/Sphere.sksl +108 -0
- package/sksl/SpiralBlockWipe.sksl +76 -0
- package/sksl/Vortex.sksl +116 -0
- package/sksl/index.js +1 -1
- package/transitions/ArrowWipe.glsl +99 -0
- package/transitions/BlockSlide.glsl +86 -0
- package/transitions/CellDissolve.glsl +90 -0
- package/transitions/Crumple.glsl +172 -0
- package/transitions/HeatHaze.glsl +78 -0
- package/transitions/Hologram.glsl +96 -0
- package/transitions/LiquidFill.glsl +101 -0
- package/transitions/PlasmaDissolve.glsl +50 -0
- package/transitions/RingsWipe.glsl +105 -0
- package/transitions/SawtoothWipe.glsl +72 -0
- package/transitions/SnakeBlockWipe.glsl +39 -0
- package/transitions/Snapshot.glsl +85 -0
- package/transitions/Sphere.glsl +94 -0
- package/transitions/SpiralBlockWipe.glsl +64 -0
- package/transitions/Vortex.glsl +105 -0
- package/wgsl/ArrowWipe.wgsl +352 -0
- package/wgsl/BlockSlide.wgsl +384 -0
- package/wgsl/CellDissolve.wgsl +323 -0
- package/wgsl/Crumple.wgsl +709 -0
- package/wgsl/HeatHaze.wgsl +282 -0
- package/wgsl/Hologram.wgsl +339 -0
- package/wgsl/LiquidFill.wgsl +339 -0
- package/wgsl/PlasmaDissolve.wgsl +149 -0
- package/wgsl/RingsWipe.wgsl +394 -0
- package/wgsl/SawtoothWipe.wgsl +279 -0
- package/wgsl/SnakeBlockWipe.wgsl +188 -0
- package/wgsl/Snapshot.wgsl +287 -0
- package/wgsl/Sphere.wgsl +316 -0
- package/wgsl/SpiralBlockWipe.wgsl +250 -0
- package/wgsl/Vortex.wgsl +463 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// Crumple — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/Crumple.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image crumples into a creased paper ball, shaded along its folds, which is then tossed away 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 int creases;
|
|
16
|
+
|
|
17
|
+
uniform float size;
|
|
18
|
+
|
|
19
|
+
uniform vec2 direction;
|
|
20
|
+
|
|
21
|
+
uniform vec4 paper;
|
|
22
|
+
|
|
23
|
+
uniform vec4 shadow;
|
|
24
|
+
|
|
25
|
+
const float PI = 3.14159265;
|
|
26
|
+
|
|
27
|
+
vec2 hash2(vec2 p) {
|
|
28
|
+
p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));
|
|
29
|
+
return fract(sin(p) * 43758.5453);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
mat2 rot(float a) {
|
|
33
|
+
float s = sin(a);
|
|
34
|
+
float c = cos(a);
|
|
35
|
+
return mat2(c, -s, s, c);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
float frame(vec2 a) {
|
|
39
|
+
return min(0.5 * ratio / max(abs(a.x), 1e-4), 0.5 / max(abs(a.y), 1e-4));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
float outline(vec2 a, float c, float k, float radius) {
|
|
43
|
+
float rect = frame(a);
|
|
44
|
+
float th = atan(a.y, a.x);
|
|
45
|
+
float buckle = 0.03 + 0.05 * abs(sin(4.0 * th + 0.7)) + 0.03 * abs(sin(9.0 * th + 2.0)) + 0.015 * abs(sin(23.0 * th + 1.3));
|
|
46
|
+
|
|
47
|
+
float i = floor((th / (2.0 * PI) + 0.5) * 9.0);
|
|
48
|
+
float a0 = i * 2.0 * PI / 9.0 - PI;
|
|
49
|
+
float a1 = a0 + 2.0 * PI / 9.0;
|
|
50
|
+
vec2 v0 = vec2(cos(a0), sin(a0)) * (0.78 + 0.27 * hash2(vec2(mod(i, 9.0), 3.0)).x);
|
|
51
|
+
vec2 v1 = vec2(cos(a1), sin(a1)) * (0.78 + 0.27 * hash2(vec2(mod(i + 1.0, 9.0), 3.0)).x);
|
|
52
|
+
vec2 e = v1 - v0;
|
|
53
|
+
float ball = radius * (v0.x * e.y - v0.y * e.x) / (a.x * e.y - a.y * e.x);
|
|
54
|
+
return mix(rect * mix(1.0, 0.75, c) * (1.0 - c * buckle), ball, k);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void fold(vec2 x, float seed, int n, vec2 span, float len, float c, float px, float weight,
|
|
58
|
+
inout vec2 grad, inout vec2 shift, inout float valley, inout float ridge) {
|
|
59
|
+
float tilt = 2.0 / sqrt(float(n));
|
|
60
|
+
for (int i = 0; i < 32; i++) {
|
|
61
|
+
if (i >= n) break;
|
|
62
|
+
float fi = float(i);
|
|
63
|
+
vec2 h = hash2(vec2(fi, seed));
|
|
64
|
+
vec2 g = hash2(vec2(fi, seed + 11.8));
|
|
65
|
+
vec2 o = (h - 0.5) * 2.0 * span;
|
|
66
|
+
vec2 nrm = vec2(cos(2.0 * PI * g.x), sin(2.0 * PI * g.x));
|
|
67
|
+
float d = dot(x - o, nrm);
|
|
68
|
+
float along = dot(x - o, vec2(-nrm.y, nrm.x));
|
|
69
|
+
float l = len * (0.5 + g.y);
|
|
70
|
+
float start = 0.4 * fi / float(n);
|
|
71
|
+
float act = weight * smoothstep(start, start + 0.3, c) * (1.0 - smoothstep(0.5 * l, l, abs(along)));
|
|
72
|
+
float amp = (h.x > 0.5 ? 1.0 : -1.0) * (0.5 + 0.5 * h.y);
|
|
73
|
+
float side = d / (abs(d) + px);
|
|
74
|
+
grad += act * amp * side * nrm * tilt;
|
|
75
|
+
shift += act * 0.03 * side * nrm;
|
|
76
|
+
float line = 1.0 - smoothstep(0.0, 2.0 * px, abs(d));
|
|
77
|
+
if (amp < 0.0) valley += act * line;
|
|
78
|
+
else ridge += act * line * amp;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
vec4 transition(vec2 uv) {
|
|
83
|
+
if (progress <= 0.0) return getFromColor(uv);
|
|
84
|
+
vec4 b = getToColor(uv);
|
|
85
|
+
if (progress >= 1.0) return b;
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
float c = smoothstep(0.0, 0.6, progress);
|
|
89
|
+
float k = smoothstep(0.1, 0.62, progress);
|
|
90
|
+
float t = smoothstep(0.58, 1.0, progress);
|
|
91
|
+
t *= t;
|
|
92
|
+
|
|
93
|
+
vec2 dir = length(direction) > 0.0 ? normalize(direction) : vec2(1.0, 0.0);
|
|
94
|
+
float radius = max(size, 0.01) * mix(1.0, 0.6, t);
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
float reach = 0.5 * (abs(dir.x) * ratio + abs(dir.y)) + 1.2 * radius + 0.3;
|
|
98
|
+
float bend = dir.x < 0.0 ? -1.0 : 1.0;
|
|
99
|
+
vec2 center = dir * reach * t + vec2(-dir.y, dir.x) * 0.15 * bend * sin(PI * t);
|
|
100
|
+
float angle = 0.6 * c - 5.0 * bend * t;
|
|
101
|
+
|
|
102
|
+
float lift = 0.012 * c + 0.06 * t;
|
|
103
|
+
|
|
104
|
+
vec2 p = (uv - 0.5) * vec2(ratio, 1.0);
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
vec2 sp = rot(angle) * (p - center - vec2(0.6, -1.0) * lift);
|
|
108
|
+
float sl = length(sp);
|
|
109
|
+
float sd = sl - outline(sl > 1e-5 ? sp / sl : vec2(1.0, 0.0), c, k, radius);
|
|
110
|
+
float blur = 0.005 + 1.2 * lift;
|
|
111
|
+
vec4 col = vec4(mix(b.rgb, shadow.rgb, shadow.a * c * (1.0 - smoothstep(-blur, blur, sd))), b.a);
|
|
112
|
+
|
|
113
|
+
vec2 q = rot(angle) * (p - center);
|
|
114
|
+
float l = length(q);
|
|
115
|
+
vec2 dq = l > 1e-5 ? q / l : vec2(1.0, 0.0);
|
|
116
|
+
float edge = outline(dq, c, k, radius);
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
float aa = 0.003 * smoothstep(0.0, 0.1, progress) + 1e-5;
|
|
120
|
+
float inside = 1.0 - smoothstep(-aa, aa, l - edge);
|
|
121
|
+
if (inside <= 0.0) return col;
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
float r = l / edge;
|
|
126
|
+
float rect = frame(dq);
|
|
127
|
+
vec2 s = dq * rect * mix(r, r * (0.6 + 0.4 * r), k);
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
int count = creases < 1 ? 1 : creases;
|
|
131
|
+
vec2 grad = vec2(0.0);
|
|
132
|
+
vec2 shift = vec2(0.0);
|
|
133
|
+
float valley = 0.0;
|
|
134
|
+
float ridge = 0.0;
|
|
135
|
+
fold(s, 7.3, count, 0.45 * vec2(ratio, 1.0), 0.6, c, 0.003 * rect / edge, 1.0 - 0.8 * k, grad, shift, valley, ridge);
|
|
136
|
+
vec2 g2 = vec2(0.0);
|
|
137
|
+
vec2 s2 = vec2(0.0);
|
|
138
|
+
float v2 = 0.0;
|
|
139
|
+
float r2 = 0.0;
|
|
140
|
+
fold(q / radius, 2.9, count, vec2(0.7), 8.0, k, 0.003 / radius, k, g2, s2, v2, r2);
|
|
141
|
+
grad += g2 * 0.8;
|
|
142
|
+
vec2 piece = s + shift + s2 * 3.0;
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
float rr = clamp(l / (radius * 1.1), 0.0, 1.0);
|
|
147
|
+
vec3 sphere = vec3(q / (radius * 1.1) * k * 0.8, sqrt(1.0 - 0.64 * rr * rr * k));
|
|
148
|
+
vec3 n = normalize(sphere + vec3(grad, 0.0));
|
|
149
|
+
n.xy = rot(-angle) * n.xy;
|
|
150
|
+
vec3 light = normalize(vec3(-0.5, 0.6, 0.8));
|
|
151
|
+
float diffuse = max(dot(n, light), 0.0);
|
|
152
|
+
vec3 hv = normalize(light + vec3(0.0, 0.0, 1.0));
|
|
153
|
+
|
|
154
|
+
float spec = max(pow(max(dot(n, hv), 0.0), 20.0) - pow(hv.z, 20.0), 0.0);
|
|
155
|
+
float level = light.z;
|
|
156
|
+
float relief = min(2.0 * c, 1.0);
|
|
157
|
+
float shade = 1.0 + relief * ((0.12 + diffuse) / (0.12 + level) - 1.0) + 0.7 * spec * relief;
|
|
158
|
+
shade -= 0.2 * relief * min(valley, 1.0);
|
|
159
|
+
|
|
160
|
+
shade *= 1.0 - 0.3 * k * smoothstep(0.6, 1.0, r);
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
vec2 f = piece / vec2(ratio, 1.0) + 0.5;
|
|
164
|
+
vec4 img = getFromColor(1.0 - abs(1.0 - mod(f, 2.0)));
|
|
165
|
+
|
|
166
|
+
img.rgb = mix(img.rgb, paper.rgb, 0.6 * min(ridge, 1.0) * paper.a * c);
|
|
167
|
+
vec4 ball = vec4(img.rgb * shade, img.a);
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
float m = inside * ball.a;
|
|
171
|
+
vec4 o = vec4(mix(col.rgb * col.a, ball.rgb, m), mix(col.a, 1.0, m));
|
|
172
|
+
return o.a > 0.0 ? vec4(o.rgb / o.a, o.a) : vec4(0.0);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
half4 main(float2 _coord) {
|
|
176
|
+
vec2 _uv = _coord / _resolution;
|
|
177
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
178
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
179
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// HeatHaze — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/HeatHaze.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: Shimmering heat waves rise through the frame, strongest at the bottom, making the outgoing image wobble like the air over hot asphalt; the incoming image shows through the haze and settles as it calms
|
|
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 speed;
|
|
20
|
+
|
|
21
|
+
vec2 mirror(vec2 v) {
|
|
22
|
+
return 1.0 - abs(1.0 - mod(v, 2.0));
|
|
23
|
+
}
|
|
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 - 0.5) * 3.0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
vec4 transition(vec2 uv) {
|
|
54
|
+
if (progress <= 0.0) return getFromColor(uv);
|
|
55
|
+
if (progress >= 1.0) return getToColor(uv);
|
|
56
|
+
|
|
57
|
+
const float PI = 3.141592653589793;
|
|
58
|
+
float p = progress;
|
|
59
|
+
|
|
60
|
+
float amount = sin(PI * p);
|
|
61
|
+
|
|
62
|
+
float t = p * speed;
|
|
63
|
+
|
|
64
|
+
vec2 q = vec2(uv.x * ratio, uv.y * 2.5) * scale;
|
|
65
|
+
q.y -= t * scale;
|
|
66
|
+
|
|
67
|
+
vec2 w = vec2(fbm(q * 0.35 + vec2(0.0, t)), fbm(q * 0.35 + vec2(7.1, -t)));
|
|
68
|
+
q += 1.5 * w;
|
|
69
|
+
vec2 offset = vec2(fbm(q), 0.5 * fbm(q + vec2(3.7, 1.9)));
|
|
70
|
+
|
|
71
|
+
float ground = mix(1.0, 0.3, uv.y);
|
|
72
|
+
offset *= strength * amount * ground * vec2(1.0 / ratio, 1.0);
|
|
73
|
+
|
|
74
|
+
vec2 d = mirror(uv + offset);
|
|
75
|
+
|
|
76
|
+
float m = smoothstep(0.3, 0.7, p);
|
|
77
|
+
if (m <= 0.0) return getFromColor(d);
|
|
78
|
+
if (m >= 1.0) return getToColor(d);
|
|
79
|
+
vec4 a = getFromColor(d);
|
|
80
|
+
vec4 b = getToColor(d);
|
|
81
|
+
|
|
82
|
+
vec4 c = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), m);
|
|
83
|
+
return c.a > 0.0 ? vec4(c.rgb / c.a, c.a) : vec4(0.0);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
half4 main(float2 _coord) {
|
|
87
|
+
vec2 _uv = _coord / _resolution;
|
|
88
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
89
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
90
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Hologram — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/Hologram.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image turns into a flickering hologram (blue by default) with scanlines and jittering rows, breaks up, and the hologram resolves into the incoming image in full color
|
|
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 vec3 tint;
|
|
16
|
+
|
|
17
|
+
uniform vec4 background;
|
|
18
|
+
|
|
19
|
+
uniform float scanlines;
|
|
20
|
+
|
|
21
|
+
uniform float jitter;
|
|
22
|
+
|
|
23
|
+
uniform float flicker;
|
|
24
|
+
|
|
25
|
+
const float PI = 3.14159265;
|
|
26
|
+
|
|
27
|
+
const float STEPS = 32.0;
|
|
28
|
+
|
|
29
|
+
float hash(vec2 p) {
|
|
30
|
+
p = fract(p * vec2(443.897, 441.423));
|
|
31
|
+
p += dot(p, p.yx + 19.19);
|
|
32
|
+
return fract((p.x + p.y) * p.x);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
float luma(vec3 c) {
|
|
36
|
+
return dot(c, vec3(0.299, 0.587, 0.114));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
vec4 premultiplied(vec4 c) {
|
|
40
|
+
return vec4(c.rgb * c.a, c.a);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
vec4 source(vec2 uv, float m) {
|
|
44
|
+
return m > 0.5 ? getToColor(uv) : getFromColor(uv);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
vec4 transition(vec2 uv) {
|
|
48
|
+
if (progress <= 0.0) return getFromColor(uv);
|
|
49
|
+
if (progress >= 1.0) return getToColor(uv);
|
|
50
|
+
|
|
51
|
+
float p = progress;
|
|
52
|
+
|
|
53
|
+
float h = smoothstep(0.0, 0.3, p) * (1.0 - smoothstep(0.7, 1.0, p));
|
|
54
|
+
float b = smoothstep(0.0, 1.0, 1.0 - abs(p - 0.5) / 0.22);
|
|
55
|
+
float f = floor(p * STEPS);
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
float band = floor(uv.y * 36.0);
|
|
59
|
+
float jump = step(1.0 - (0.2 + 0.6 * b) * h, hash(vec2(band, f)));
|
|
60
|
+
float offset = (hash(vec2(band, f + 0.37)) - 0.5) * 2.0 * jitter * jump * (0.3 + 0.7 * b);
|
|
61
|
+
offset += sin(uv.y * 23.0 + f * 1.7) * 0.0015 * h;
|
|
62
|
+
vec2 q = uv + vec2(offset, 0.0);
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
float m = step(hash(vec2(floor(uv.y * 24.0), 7.0)), (p - 0.35) / 0.3);
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
vec4 c = source(clamp(q, 0.0, 1.0), m);
|
|
70
|
+
vec2 dx = vec2(0.003 + 0.01 * b, 0.0);
|
|
71
|
+
float l = luma(c.rgb);
|
|
72
|
+
vec4 cr = source(clamp(q + dx, 0.0, 1.0), m);
|
|
73
|
+
vec4 cb = source(clamp(q - dx, 0.0, 1.0), m);
|
|
74
|
+
float lr = luma(cr.rgb) * cr.a;
|
|
75
|
+
float lb = luma(cb.rgb) * cb.a;
|
|
76
|
+
vec3 g = smoothstep(0.05, 0.9, vec3(lr, l, lb));
|
|
77
|
+
|
|
78
|
+
vec3 holo = tint * (0.06 + 1.25 * g) + 0.45 * g * g * g;
|
|
79
|
+
|
|
80
|
+
float roll = fract(uv.y + 2.0 * p);
|
|
81
|
+
holo += tint * 0.35 * smoothstep(0.85, 1.0, roll) * (1.0 - smoothstep(0.98, 1.0, roll));
|
|
82
|
+
holo = clamp(holo, 0.0, 1.0);
|
|
83
|
+
|
|
84
|
+
float inside = step(0.0, q.x) * step(q.x, 1.0);
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
float lines = 0.5 + 0.5 * sin((uv.y * scanlines - p * 6.0) * 2.0 * PI);
|
|
88
|
+
float vis = mix(1.0, 0.15 + 0.85 * lines, h);
|
|
89
|
+
vis *= 1.0 - flicker * (0.25 + 0.75 * b) * hash(vec2(f, 3.1)) * h;
|
|
90
|
+
float gap = step(hash(vec2(floor(uv.y * 90.0), f + 0.71)), flicker * 0.45 * b);
|
|
91
|
+
vis *= 1.0 - gap;
|
|
92
|
+
vec4 layer = vec4(holo, c.a * vis * inside);
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
vec4 plain = premultiplied(source(uv, m));
|
|
96
|
+
vec4 back = premultiplied(vec4(background.rgb, background.a * max(plain.a, layer.a)));
|
|
97
|
+
vec4 holoColor = premultiplied(layer) + back * (1.0 - layer.a);
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
vec4 o = mix(plain, holoColor, h);
|
|
101
|
+
return o.a > 0.0 ? vec4(o.rgb / o.a, o.a) : vec4(0.0);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
half4 main(float2 _coord) {
|
|
105
|
+
vec2 _uv = _coord / _resolution;
|
|
106
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
107
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
108
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// LiquidFill — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/LiquidFill.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The incoming image rises over the outgoing one like liquid filling a glass, its surface sloshing in waves, lit by a bright meniscus line, bending the image just below it, with a few bubbles rising through it
|
|
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 amplitude;
|
|
18
|
+
|
|
19
|
+
uniform float waves;
|
|
20
|
+
|
|
21
|
+
uniform vec4 highlight;
|
|
22
|
+
|
|
23
|
+
uniform float refraction;
|
|
24
|
+
|
|
25
|
+
uniform float bubbles;
|
|
26
|
+
|
|
27
|
+
const float PI = 3.141592653589793;
|
|
28
|
+
|
|
29
|
+
const float AA = 0.0015;
|
|
30
|
+
|
|
31
|
+
const float LINE = 0.006;
|
|
32
|
+
|
|
33
|
+
const float CELL = 0.08;
|
|
34
|
+
|
|
35
|
+
float hash (vec2 p) {
|
|
36
|
+
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
|
|
37
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
38
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
float surface (float x, float t) {
|
|
42
|
+
float k = PI * max(waves, 0.01);
|
|
43
|
+
return 0.6 * sin(k * x + 0.5 * PI) * cos(2.0 * PI * 1.3 * t)
|
|
44
|
+
+ 0.4 * sin(1.7 * k * x - 9.0 * t + 1.3);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
vec4 transition (vec2 uv) {
|
|
48
|
+
vec4 a = getFromColor(uv);
|
|
49
|
+
if (progress <= 0.0) return a;
|
|
50
|
+
if (progress >= 1.0) return getToColor(uv);
|
|
51
|
+
|
|
52
|
+
vec2 dir = length(direction) > 0.0 ? normalize(direction) : vec2(0.0, 1.0);
|
|
53
|
+
vec2 across = vec2(-dir.y, dir.x);
|
|
54
|
+
|
|
55
|
+
vec2 p = (uv - 0.5) * vec2(ratio, 1.0);
|
|
56
|
+
|
|
57
|
+
float e = 0.5 * (abs(dir.x) * ratio + abs(dir.y));
|
|
58
|
+
float w = 0.5 * (abs(dir.y) * ratio + abs(dir.x));
|
|
59
|
+
float d = dot(p, dir);
|
|
60
|
+
float x = dot(p, across);
|
|
61
|
+
float t = progress;
|
|
62
|
+
|
|
63
|
+
float stir = sin(PI * t);
|
|
64
|
+
float amp = max(amplitude, 0.0) * (0.35 + 0.65 * stir);
|
|
65
|
+
|
|
66
|
+
float margin = max(amplitude, 0.0) + 2.0 * LINE + AA;
|
|
67
|
+
float mean = mix(-e - margin, e + margin, mix(t, t * t * (3.0 - 2.0 * t), 0.5));
|
|
68
|
+
float level = mean + amp * surface(x / w, t);
|
|
69
|
+
|
|
70
|
+
float depth = level - d;
|
|
71
|
+
float m = smoothstep(-AA, AA, depth);
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
float bend = refraction * stir * exp(-max(depth, 0.0) / 0.06);
|
|
75
|
+
vec2 offset = bend * (dir * sin(18.0 * x - 7.0 * t) + across * cos(13.0 * x + 5.0 * t));
|
|
76
|
+
vec4 b = getToColor(clamp(uv + offset / vec2(ratio, 1.0), 0.0, 1.0));
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
float glow = 0.0;
|
|
80
|
+
float rise = mean + 0.5 * t;
|
|
81
|
+
vec2 bq = vec2(x, d - rise) / CELL;
|
|
82
|
+
vec2 cell = floor(bq);
|
|
83
|
+
float hs = hash(cell + 7.1);
|
|
84
|
+
float r = (0.12 + 0.18 * hash(cell + 3.7)) * stir;
|
|
85
|
+
float px = AA / CELL;
|
|
86
|
+
if (hs < bubbles * 0.6 && r > px) {
|
|
87
|
+
|
|
88
|
+
vec2 c = cell + 0.5 + (0.42 - r - px) * (vec2(hash(cell + 1.3), hash(cell + 9.4)) * 2.0 - 1.0);
|
|
89
|
+
|
|
90
|
+
c.x += 0.08 * sin(6.0 * t + 6.28 * hs);
|
|
91
|
+
float dist = length(bq - c);
|
|
92
|
+
|
|
93
|
+
float rim = smoothstep(0.7 * r - px, 0.7 * r + px, dist) * (1.0 - smoothstep(r - px, r + px, dist));
|
|
94
|
+
float glint = 1.0 - smoothstep(0.25 * r - px, 0.25 * r + px, length(bq - c - 0.45 * r * vec2(-0.7, 0.7)));
|
|
95
|
+
|
|
96
|
+
glow = max(rim * 0.6, glint) * smoothstep(0.0, 0.05, depth) * stir;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
float line = 1.0 - smoothstep(LINE - AA, LINE + AA, abs(depth - LINE));
|
|
100
|
+
line += 0.35 * stir * exp(-max(depth, 0.0) / 0.03) * m;
|
|
101
|
+
float light = highlight.a * clamp(max(line, glow), 0.0, 1.0) * (0.4 + 0.6 * stir);
|
|
102
|
+
b.rgb = mix(b.rgb, highlight.rgb, light);
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
vec4 c = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), m);
|
|
106
|
+
return c.a > 0.0 ? vec4(c.rgb / c.a, c.a) : vec4(0.0);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
half4 main(float2 _coord) {
|
|
110
|
+
vec2 _uv = _coord / _resolution;
|
|
111
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
112
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
113
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// PlasmaDissolve — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/PlasmaDissolve.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: A flowing plasma of sine waves, as in the old demos, draws moving bands through which the incoming image spreads like tendrils, with a glowing edge
|
|
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 scale;
|
|
16
|
+
|
|
17
|
+
uniform float smoothness;
|
|
18
|
+
|
|
19
|
+
uniform float flow;
|
|
20
|
+
|
|
21
|
+
uniform vec3 edgeColor;
|
|
22
|
+
|
|
23
|
+
uniform float edgeStrength;
|
|
24
|
+
|
|
25
|
+
const float PI = 3.14159265;
|
|
26
|
+
|
|
27
|
+
vec4 transition(vec2 uv) {
|
|
28
|
+
vec4 a = getFromColor(uv);
|
|
29
|
+
vec4 b = getToColor(uv);
|
|
30
|
+
if (progress <= 0.0) return a;
|
|
31
|
+
if (progress >= 1.0) return b;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
vec2 p = (uv - 0.5) * vec2(ratio, 1.0) * max(scale, 0.0) * 2.0 * PI;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
float t = clamp(flow, 0.0, 1.0) * progress * 0.5;
|
|
38
|
+
|
|
39
|
+
float v = sin(p.x * 0.6 + t)
|
|
40
|
+
+ sin(p.y * 0.8 - t * 0.8)
|
|
41
|
+
+ sin((p.x * 0.5 + p.y * 0.7) * 0.7 + t * 0.6)
|
|
42
|
+
+ sin(length(p - vec2(0.15, -0.1) * max(scale, 0.0) * 2.0 * PI) * 0.9 - t * 1.2);
|
|
43
|
+
|
|
44
|
+
v = abs(fract(v * 0.25 + 0.5) * 2.0 - 1.0);
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
float s = max(smoothness, 0.001);
|
|
48
|
+
float threshold = mix(-s, 1.0 + s, progress);
|
|
49
|
+
|
|
50
|
+
float m = 1.0 - smoothstep(threshold - s, threshold + s, v);
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
vec4 col = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), m);
|
|
54
|
+
if (col.a <= 0.0) return vec4(0.0);
|
|
55
|
+
|
|
56
|
+
float glow = 4.0 * m * (1.0 - m) * max(edgeStrength, 0.0);
|
|
57
|
+
return vec4(col.rgb / col.a + edgeColor * glow, col.a);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
half4 main(float2 _coord) {
|
|
61
|
+
vec2 _uv = _coord / _resolution;
|
|
62
|
+
vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
|
|
63
|
+
return half4(_c.rgb * _c.a, _c.a);
|
|
64
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// RingsWipe — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/RingsWipe.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: Concentric rings ripple out from the center and, one after another, each sweeps around like a clock hand in the opposite direction of its neighbors to reveal the incoming image, or fills across its width, with optional colored borders between the rings
|
|
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 count;
|
|
16
|
+
|
|
17
|
+
uniform vec2 center;
|
|
18
|
+
|
|
19
|
+
uniform float stagger;
|
|
20
|
+
|
|
21
|
+
uniform int radial;
|
|
22
|
+
|
|
23
|
+
uniform float borderWidth;
|
|
24
|
+
|
|
25
|
+
uniform vec4 borderColor;
|
|
26
|
+
|
|
27
|
+
uniform float smoothness;
|
|
28
|
+
|
|
29
|
+
const float PI = 3.141592653589793;
|
|
30
|
+
|
|
31
|
+
const float AA = 0.0015;
|
|
32
|
+
|
|
33
|
+
float ringProgress(float i, float k, float d, float t) {
|
|
34
|
+
return clamp((t - i * k * d) / d, 0.0, 1.0);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
float ringMask(float i, float lp, float w, float rad, float a, float s) {
|
|
38
|
+
bool odd = mod(i, 2.0) > 0.5;
|
|
39
|
+
if ((radial != 0)) {
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
float e = s / w;
|
|
44
|
+
float f = mix(-e, 1.0 + e, lp);
|
|
45
|
+
float x = clamp((rad - i * w) / w, 0.0, 1.0);
|
|
46
|
+
float dist = (odd ? f - (1.0 - x) : f - x) * w;
|
|
47
|
+
return smoothstep(-s, s, dist);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
float aa = odd ? 1.0 - a : a;
|
|
54
|
+
float arc = 2.0 * PI * max(rad, s);
|
|
55
|
+
float e = s / arc;
|
|
56
|
+
float lo = mix(e, -e, lp);
|
|
57
|
+
float hi = mix(-e, 1.0 + e, lp);
|
|
58
|
+
float dist = max(min(aa - lo, hi - aa), min(aa - 1.0 - lo, hi - aa + 1.0));
|
|
59
|
+
return smoothstep(-s, s, dist * arc);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
vec4 transition(vec2 uv) {
|
|
63
|
+
vec4 a = getFromColor(uv);
|
|
64
|
+
vec4 b = getToColor(uv);
|
|
65
|
+
if (progress <= 0.0) return a;
|
|
66
|
+
if (progress >= 1.0) return b;
|
|
67
|
+
|
|
68
|
+
float n = float(count < 1 ? 1 : count);
|
|
69
|
+
|
|
70
|
+
vec2 p = (uv - center) * vec2(ratio, 1.0);
|
|
71
|
+
|
|
72
|
+
vec2 far = max(center, 1.0 - center) * vec2(ratio, 1.0);
|
|
73
|
+
float R = length(far) + AA;
|
|
74
|
+
float w = R / n;
|
|
75
|
+
float rad = length(p);
|
|
76
|
+
float turn = rad > 0.0 ? fract(atan(p.x, p.y) / (2.0 * PI)) : 0.0;
|
|
77
|
+
float s = max(min(smoothness, 0.25 * w), AA);
|
|
78
|
+
float t = mix(progress, progress * progress * (3.0 - 2.0 * progress), 0.35);
|
|
79
|
+
float k = clamp(stagger, 0.0, 1.0);
|
|
80
|
+
float d = 1.0 / (1.0 + k * (n - 1.0));
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
float j = floor(rad / w + 0.5);
|
|
84
|
+
float inner = clamp(j - 1.0, 0.0, n - 1.0);
|
|
85
|
+
float outer = clamp(j, 0.0, n - 1.0);
|
|
86
|
+
float li = ringProgress(inner, k, d, t);
|
|
87
|
+
float lo = ringProgress(outer, k, d, t);
|
|
88
|
+
float m = mix(
|
|
89
|
+
ringMask(inner, li, w, rad, turn, s),
|
|
90
|
+
ringMask(outer, lo, w, rad, turn, s),
|
|
91
|
+
smoothstep(-AA, AA, rad - j * w)
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
vec4 c = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), m);
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
if (borderWidth > 0.0 && j >= 1.0 && j <= n - 1.0) {
|
|
100
|
+
float on = min(1.0, 4.0 * li * (1.0 - lo));
|
|
101
|
+
|
|
102
|
+
float hw = min(0.5 * borderWidth, 0.5 * w - AA);
|
|
103
|
+
float line = (1.0 - smoothstep(hw - AA, hw + AA, abs(rad - j * w)))
|
|
104
|
+
* min(1.0, borderWidth / (2.0 * AA));
|
|
105
|
+
float o = borderColor.a * line * on;
|
|
106
|
+
c = vec4(borderColor.rgb * o, o) + c * (1.0 - o);
|
|
107
|
+
}
|
|
108
|
+
return c.a > 0.0 ? vec4(c.rgb / c.a, c.a) : vec4(0.0);
|
|
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
|
+
}
|