gl-transitions 2.2.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 +52 -0
- package/compatibility.json +400 -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/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/LightWipe.glsl +89 -0
- package/glsl3/PhotoDevelop.glsl +59 -0
- package/glsl3/PlusWipe.glsl +38 -0
- package/glsl3/PopIn.glsl +57 -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/index.js +1 -1
- package/layouts.json +945 -40
- package/llms-full.txt +705 -304
- package/llms.txt +185 -160
- 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/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/LightWipe.metal +321 -0
- package/msl/PhotoDevelop.metal +245 -0
- package/msl/PlusWipe.metal +199 -0
- package/msl/PopIn.metal +245 -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/package.json +1 -1
- package/skills/gl-transitions/references/catalog.md +100 -36
- 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/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/LightWipe.sksl +97 -0
- package/sksl/PhotoDevelop.sksl +72 -0
- package/sksl/PlusWipe.sksl +50 -0
- package/sksl/PopIn.sksl +69 -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/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/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/LightWipe.glsl +88 -0
- package/transitions/PhotoDevelop.glsl +58 -0
- package/transitions/PlusWipe.glsl +37 -0
- package/transitions/PopIn.glsl +56 -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/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/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/LightWipe.wgsl +277 -0
- package/wgsl/PhotoDevelop.wgsl +213 -0
- package/wgsl/PlusWipe.wgsl +165 -0
- package/wgsl/PopIn.wgsl +213 -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
|
@@ -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
|
+
}
|