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,63 @@
|
|
|
1
|
+
// SpotlightWipe — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/SpotlightWipe.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The stage lights go down on the outgoing image and a soft oval spotlight searches across it along a curved path, comes to rest and lights the incoming image inside it, then widens until the stage lights come back up on the incoming image
|
|
5
|
+
// Tags: light, spotlight, stage, iris, reveal
|
|
6
|
+
|
|
7
|
+
// @param Point where the spotlight comes to rest and opens from
|
|
8
|
+
uniform vec2 center; // = vec2(0.5, 0.5)
|
|
9
|
+
// @range(0.08, 0.45) Width of the spotlight while it searches, in frame heights
|
|
10
|
+
uniform float size; // = 0.3
|
|
11
|
+
// @range(0, 1) How dark the stage gets around the spotlight
|
|
12
|
+
uniform float darkness; // = 0.85
|
|
13
|
+
// @color Tint of the spotlight
|
|
14
|
+
uniform vec3 warmth; // = vec3(1.0, 0.93, 0.8)
|
|
15
|
+
|
|
16
|
+
// height of the oval over its width: a cone of light hitting a stage seen at an angle
|
|
17
|
+
const float FLAT = 0.72;
|
|
18
|
+
// distance to the spotlight's center, in oval radii, inside which the incoming image is fully lit
|
|
19
|
+
const float LIT = 0.74;
|
|
20
|
+
|
|
21
|
+
// a point of the curved path the spotlight searches along, from the lower left to its resting point
|
|
22
|
+
vec2 path(float t, vec2 c) {
|
|
23
|
+
vec2 a = vec2(0.08, 0.3);
|
|
24
|
+
vec2 b = vec2(0.35, 1.15);
|
|
25
|
+
vec2 d = vec2(1.05, 0.95);
|
|
26
|
+
float s = 1.0 - t;
|
|
27
|
+
return s * s * s * a + 3.0 * s * s * t * b + 3.0 * s * t * t * d + t * t * t * c;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
vec4 transition(vec2 uv) {
|
|
31
|
+
vec2 asp = vec2(ratio, 1.0);
|
|
32
|
+
float p = progress;
|
|
33
|
+
|
|
34
|
+
// the spotlight slides along its path and eases to rest, its last few steps overlapping the start
|
|
35
|
+
// of its widening so the motion never stops
|
|
36
|
+
float t = clamp(p / 0.5, 0.0, 1.0);
|
|
37
|
+
t = t * t * (3.0 - 2.0 * t);
|
|
38
|
+
vec2 c = path(t, center);
|
|
39
|
+
|
|
40
|
+
// it widens until its lit core covers the farthest corner of the frame
|
|
41
|
+
vec2 far = max(center, 1.0 - center) * asp;
|
|
42
|
+
float full = length(vec2(far.x, far.y / FLAT)) / LIT;
|
|
43
|
+
float g = smoothstep(0.44, 1.0, p);
|
|
44
|
+
float radius = mix(0.5 * size, full, g * (0.3 + 0.7 * g));
|
|
45
|
+
|
|
46
|
+
// distance to the spotlight's center, 1 on the oval's edge
|
|
47
|
+
vec2 q = (uv - c) * asp;
|
|
48
|
+
float r = length(vec2(q.x, q.y / FLAT)) / radius;
|
|
49
|
+
|
|
50
|
+
// light of the spotlight: a flat core, a soft penumbra, a slightly brighter rim and a faint spill
|
|
51
|
+
float core = 1.0 - smoothstep(0.72, 1.08, r);
|
|
52
|
+
float ring = (r - 0.9) / 0.09;
|
|
53
|
+
float spot = max(core * (1.0 - 0.1 * r * r), 0.12 * (1.0 - smoothstep(0.9, 2.4, r))) + 0.16 * exp(-ring * ring);
|
|
54
|
+
|
|
55
|
+
// the stage lights go down at the start and come back up at the end
|
|
56
|
+
float s = darkness * smoothstep(0.0, 0.18, p) * (1.0 - smoothstep(0.72, 1.0, p));
|
|
57
|
+
vec3 light = 1.0 - s + s * spot * warmth;
|
|
58
|
+
|
|
59
|
+
// as it comes to rest, the spotlight lights the incoming image inside it
|
|
60
|
+
float lit = smoothstep(0.42, 0.58, p) * (1.0 - smoothstep(LIT, 1.0, r));
|
|
61
|
+
vec4 col = mix(getFromColor(uv), getToColor(uv), lit);
|
|
62
|
+
return vec4(col.rgb * light, col.a);
|
|
63
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// StopMotion — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/StopMotion.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image is a paper cutout that jerks off the frame in choppy stop-motion steps, with a tiny new tilt and offset each step and a drop shadow, while the incoming cutout jerks in the same way and lands
|
|
5
|
+
// Tags: stop-motion, paper, cutout, slide, shadow, choppy
|
|
6
|
+
|
|
7
|
+
// @range(6, 30, 1) Number of held poses during the transition: fewer is choppier
|
|
8
|
+
uniform int steps; // = 12
|
|
9
|
+
// @range(0, 1) Size of the small random tilt and offset given to the cutouts at each step
|
|
10
|
+
uniform float jitter; // = 0.5
|
|
11
|
+
// @range(0, 1) Darkness of the drop shadow the cutouts cast
|
|
12
|
+
uniform float shadow; // = 0.5
|
|
13
|
+
// @color Color of the background behind the cutouts
|
|
14
|
+
uniform vec4 backColor; // = vec4(0.80, 0.71, 0.56, 1.0)
|
|
15
|
+
// @color Color of the paper rim around the cutouts
|
|
16
|
+
uniform vec4 rimColor; // = vec4(0.97, 0.96, 0.93, 1.0)
|
|
17
|
+
|
|
18
|
+
const float SHRINK = 0.2; // how much smaller the cutouts are than the frame while they move
|
|
19
|
+
const float RIM = 0.012; // width of the paper rim around the cutouts, in frame heights
|
|
20
|
+
const float RADIUS = 0.006; // corner radius of the cutouts, in frame heights
|
|
21
|
+
const float AA = 0.0015; // width of the antialiased edges, in frame heights
|
|
22
|
+
|
|
23
|
+
// Hoskins' hash of an integer step
|
|
24
|
+
float hash11(float p) {
|
|
25
|
+
p = fract(p * 0.1031);
|
|
26
|
+
p *= p + 33.33;
|
|
27
|
+
p *= p + p;
|
|
28
|
+
return fract(p);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// signed distance to a rounded box of half size b and corner radius r
|
|
32
|
+
float roundedBox(vec2 q, vec2 b, float r) {
|
|
33
|
+
vec2 d = abs(q) - b + r;
|
|
34
|
+
return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0) - r;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
vec4 premultiply(vec4 c) {
|
|
38
|
+
return vec4(c.rgb * c.a, c.a);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// distance from the center far enough for a cutout of half size h turned by a, and its shadow, to be out of the frame
|
|
42
|
+
float offFrame(vec2 h, float a) {
|
|
43
|
+
return 0.5 * ratio + abs(cos(a)) * h.x + abs(sin(a)) * h.y + 0.08;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// half size of a cutout scaled by s, with its rim for the lift l
|
|
47
|
+
vec2 cutoutSize(float s, float l) {
|
|
48
|
+
return (0.5 * vec2(ratio, 1.0) + RIM * l) * s;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// draws over col (premultiplied) a cutout of the outgoing or incoming image, centered at c, turned by a, scaled by s, lifted by l
|
|
52
|
+
vec4 drawCutout(vec4 col, vec2 q, vec2 c, float a, float s, float l, bool incoming) {
|
|
53
|
+
vec2 asp = vec2(ratio, 1.0);
|
|
54
|
+
vec2 halfImage = 0.5 * asp;
|
|
55
|
+
vec2 halfCut = halfImage + RIM * l;
|
|
56
|
+
float rad = RADIUS * l;
|
|
57
|
+
float ca = cos(a), sa = sin(a);
|
|
58
|
+
mat2 unrotate = mat2(ca, -sa, sa, ca);
|
|
59
|
+
|
|
60
|
+
// the drop shadow, cast down and to the right, softer and further as the cutout is lifted,
|
|
61
|
+
// as dark as the image casting it is opaque
|
|
62
|
+
vec2 rs = unrotate * (q - c - vec2(0.018, -0.026) * l) / s;
|
|
63
|
+
vec2 ss = clamp(rs / asp + 0.5, 0.0, 1.0);
|
|
64
|
+
float sAlpha = max(incoming ? getToColor(ss).a : getFromColor(ss).a, rimColor.a);
|
|
65
|
+
float ds = roundedBox(rs, halfCut, rad) * s;
|
|
66
|
+
float blur = 0.004 + 0.016 * l;
|
|
67
|
+
col.rgb *= 1.0 - clamp(shadow, 0.0, 1.0) * 0.75 * l * sAlpha * (1.0 - smoothstep(-blur, blur, ds));
|
|
68
|
+
|
|
69
|
+
vec2 r = unrotate * (q - c) / s;
|
|
70
|
+
float dCut = roundedBox(r, halfCut, rad) * s;
|
|
71
|
+
float dImage = roundedBox(r, halfImage, 0.0) * s;
|
|
72
|
+
float cutCover = clamp(0.5 - dCut / AA, 0.0, 1.0);
|
|
73
|
+
float imageCover = clamp(0.5 - dImage / AA, 0.0, 1.0);
|
|
74
|
+
vec2 st = clamp(r / asp + 0.5, 0.0, 1.0);
|
|
75
|
+
vec4 img = premultiply(incoming ? getToColor(st) : getFromColor(st));
|
|
76
|
+
// the image on its paper rim, laid over what is below
|
|
77
|
+
vec4 cut = mix(premultiply(rimColor), img, imageCover) * cutCover;
|
|
78
|
+
return cut + col * (1.0 - cut.a);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
vec4 transition(vec2 uv) {
|
|
82
|
+
float n = float(steps < 2 ? 2 : steps);
|
|
83
|
+
// the pose held at this time: the first and last are the full images, held half a step each
|
|
84
|
+
float k = floor(progress * n + 0.5);
|
|
85
|
+
if (k <= 0.0) return getFromColor(uv);
|
|
86
|
+
if (k >= n) return getToColor(uv);
|
|
87
|
+
|
|
88
|
+
vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
|
|
89
|
+
float j = clamp(jitter, 0.0, 1.0);
|
|
90
|
+
|
|
91
|
+
// the outgoing cutout is picked up off the frame in two poses, then jerked out to the left, faster and faster
|
|
92
|
+
float l0 = min(k / 2.0, 1.0);
|
|
93
|
+
float m0 = clamp((k - 1.0) / (0.45 * n), 0.0, 1.0);
|
|
94
|
+
m0 = m0 * m0 * (0.4 + 0.6 * m0);
|
|
95
|
+
float s0 = 1.0 - SHRINK * l0;
|
|
96
|
+
float a0 = 0.22 * m0 + l0 * j * 0.2 * (hash11(k) - 0.5);
|
|
97
|
+
vec2 c0 = vec2(-offFrame(cutoutSize(s0, l0), a0) * m0, 0.05 * m0 * m0)
|
|
98
|
+
+ l0 * j * vec2(0.07 * (hash11(k + 100.0) - 0.5), 0.05 * (hash11(k + 200.0) - 0.5));
|
|
99
|
+
|
|
100
|
+
// the incoming cutout is jerked in from the right, slowing down, then laid flat onto the frame in two poses
|
|
101
|
+
float l1 = min((n - k) / 2.0, 1.0);
|
|
102
|
+
float m1 = clamp((n - 2.0 - k) / (0.45 * n), 0.0, 1.0);
|
|
103
|
+
m1 = m1 * m1 * (0.4 + 0.6 * m1);
|
|
104
|
+
float s1 = 1.0 - SHRINK * l1;
|
|
105
|
+
float a1 = -0.25 * m1 + l1 * j * 0.2 * (hash11(k + 300.0) - 0.5);
|
|
106
|
+
vec2 c1 = vec2(offFrame(cutoutSize(s1, l1), a1) * m1, -0.06 * m1 * m1)
|
|
107
|
+
+ l1 * j * vec2(0.07 * (hash11(k + 400.0) - 0.5), 0.05 * (hash11(k + 500.0) - 0.5));
|
|
108
|
+
|
|
109
|
+
// the background, then the outgoing cutout, then the incoming one on top
|
|
110
|
+
vec4 col = premultiply(backColor);
|
|
111
|
+
if (m0 < 1.0) col = drawCutout(col, q, c0, a0, s0, l0, false);
|
|
112
|
+
if (m1 < 1.0) col = drawCutout(col, q, c1, a1, s1, l1, true);
|
|
113
|
+
if (col.a <= 0.0) return vec4(0.0);
|
|
114
|
+
col.rgb /= col.a;
|
|
115
|
+
// the light dims a little from one shot to the next
|
|
116
|
+
col.rgb *= 1.0 - 0.04 * j * hash11(k + 600.0);
|
|
117
|
+
return col;
|
|
118
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Vaporize — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/Vaporize.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image goes up in smoke: from one side, the picture itself turns to vapour that rises over what is still intact, curls into wisps and pales as it thins out, revealing the incoming image underneath
|
|
5
|
+
// Tags: smoke, organic, noise, directional, reveal
|
|
6
|
+
|
|
7
|
+
// @param Direction the vapour rises toward (the image starts turning to vapour on the opposite side)
|
|
8
|
+
uniform vec2 direction; // = vec2(0.0, 1.0)
|
|
9
|
+
// @range(0.1, 0.6) How high the vapour rises above the image before it is gone, in frame heights
|
|
10
|
+
uniform float rise; // = 0.4
|
|
11
|
+
// @range(0, 1) How much the vapour swirls and curls as it rises
|
|
12
|
+
uniform float swirl; // = 0.6
|
|
13
|
+
// @color Color the vapour pales to as it thins out
|
|
14
|
+
uniform vec4 color; // = vec4(0.92, 0.92, 0.94, 1.0)
|
|
15
|
+
|
|
16
|
+
// raggedness of the line where the image turns to vapour, and the width over which it dissolves
|
|
17
|
+
const float RAGGED = 0.09;
|
|
18
|
+
const float BAND = 0.12;
|
|
19
|
+
// how long the vapour lives, as a part of the transition
|
|
20
|
+
const float LIFE = 0.16;
|
|
21
|
+
const int TAPS = 6;
|
|
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
|
+
float vnoise(vec2 p) {
|
|
30
|
+
vec2 i = floor(p);
|
|
31
|
+
vec2 f = fract(p);
|
|
32
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
33
|
+
return mix(
|
|
34
|
+
mix(hash12(i), hash12(i + vec2(1.0, 0.0)), f.x),
|
|
35
|
+
mix(hash12(i + vec2(0.0, 1.0)), hash12(i + vec2(1.0, 1.0)), f.x),
|
|
36
|
+
f.y
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
float fbm(vec2 p) {
|
|
41
|
+
return 0.55 * vnoise(p) + 0.3 * vnoise(p * 2.03 + 5.1) + 0.15 * vnoise(p * 4.1 + 9.7);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// a swirling flow without sources or sinks: the curl of a noise field
|
|
45
|
+
vec2 curl(vec2 p) {
|
|
46
|
+
float e = 0.1;
|
|
47
|
+
float n = vnoise(p);
|
|
48
|
+
float nx = vnoise(p + vec2(e, 0.0));
|
|
49
|
+
float ny = vnoise(p + vec2(0.0, e));
|
|
50
|
+
return vec2(ny - n, n - nx) / e;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// where the line is at time t, as a part of its way across: quicker through the margins
|
|
54
|
+
// outside the frame, slower across it
|
|
55
|
+
float sweep(float t) {
|
|
56
|
+
return t + 0.6 * t * (1.0 - t) * (1.0 - 2.0 * t);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
vec2 mirror(vec2 v) {
|
|
60
|
+
return 1.0 - abs(1.0 - mod(v, 2.0));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
vec4 transition(vec2 uv) {
|
|
64
|
+
vec2 dir = length(direction) > 0.0 ? normalize(direction) : vec2(0.0, 1.0);
|
|
65
|
+
vec2 side = vec2(-dir.y, dir.x);
|
|
66
|
+
vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
|
|
67
|
+
float along = dot(q, dir);
|
|
68
|
+
float across = dot(q, side);
|
|
69
|
+
float ext = 0.5 * (abs(dir.x) * ratio + abs(dir.y));
|
|
70
|
+
|
|
71
|
+
// the line where the image turns to vapour sweeps across the frame, ragged
|
|
72
|
+
float ragged = RAGGED * (2.0 * fbm(q * 2.5 + 1.3) - 1.0);
|
|
73
|
+
float start = -ext - RAGGED;
|
|
74
|
+
float travel = 2.0 * ext + 2.0 * RAGGED + BAND;
|
|
75
|
+
float front = start + travel * sweep(progress) + ragged;
|
|
76
|
+
|
|
77
|
+
// under the vapour: the outgoing image where it is still intact, dissolving into the
|
|
78
|
+
// incoming one just behind the line
|
|
79
|
+
float gone = smoothstep(0.0, BAND, front - along);
|
|
80
|
+
vec4 base = mix(getFromColor(uv), getToColor(uv), gone);
|
|
81
|
+
|
|
82
|
+
// the vapour above the line: the higher it is, the longer ago it left the image
|
|
83
|
+
float height = max(rise, 0.05) * (0.7 + 0.6 * vnoise(vec2(across * 3.0 + 2.7, 0.5)));
|
|
84
|
+
float age = (along - front) / height;
|
|
85
|
+
float released = progress - age * LIFE;
|
|
86
|
+
if (age <= 0.0 || age >= 1.0 || released <= 0.0) return base;
|
|
87
|
+
|
|
88
|
+
// where it came from: the line, back when it was released
|
|
89
|
+
float origin = start + travel * sweep(released) + ragged;
|
|
90
|
+
vec2 org = q - dir * (along - origin);
|
|
91
|
+
|
|
92
|
+
// it swirls and curls as it rises
|
|
93
|
+
vec2 sw = curl(org * 3.0 + dir * progress * 1.5) * (swirl * 0.08 * sqrt(age));
|
|
94
|
+
vec2 src = org - sw;
|
|
95
|
+
|
|
96
|
+
// and spreads out sideways, blurring as it rises
|
|
97
|
+
vec2 spreadOut = (side * 0.07 + dir * 0.02) * sqrt(age);
|
|
98
|
+
vec4 c = vec4(0.0);
|
|
99
|
+
for (int i = 0; i < TAPS; i++) {
|
|
100
|
+
float t = float(i) / float(TAPS - 1) - 0.5;
|
|
101
|
+
vec4 img = getFromColor(mirror((src + spreadOut * t) / vec2(ratio, 1.0) + 0.5));
|
|
102
|
+
c += vec4(img.rgb * img.a, img.a);
|
|
103
|
+
}
|
|
104
|
+
c = c.a > 0.0 ? vec4(c.rgb / c.a, c.a / float(TAPS)) : vec4(0.0);
|
|
105
|
+
|
|
106
|
+
// it breaks up into wisps that rise with it and thin out: thin parts go first
|
|
107
|
+
vec2 wq = (q - 0.6 * sw - dir * (progress * 2.5)) * 4.0;
|
|
108
|
+
float w = fbm(vec2(dot(wq, side), dot(wq, dir) * 0.6) + 2.0);
|
|
109
|
+
float density = smoothstep(1.2 * age - 0.2, 1.2 * age + 0.1, w);
|
|
110
|
+
density *= 1.0 - smoothstep(0.3, 1.0, age);
|
|
111
|
+
// (only the image turns to vapour, not what lies beyond its edge)
|
|
112
|
+
density *= smoothstep(-ext, -ext + 0.05, origin);
|
|
113
|
+
|
|
114
|
+
// it pales and loses its colour as it thins
|
|
115
|
+
float pale = smoothstep(0.0, 0.5, age);
|
|
116
|
+
float l = dot(c.rgb, vec3(0.299, 0.587, 0.114));
|
|
117
|
+
c = mix(c, vec4(mix(vec3(l), color.rgb, 0.7), c.a * color.a), pale * 0.85);
|
|
118
|
+
// the edges of the wisps catch the light
|
|
119
|
+
c.rgb = min(c.rgb + 0.12 * pale * density * (1.0 - density), vec3(1.0));
|
|
120
|
+
// laid over what is under it
|
|
121
|
+
float a = density * c.a;
|
|
122
|
+
float outA = a + base.a * (1.0 - a);
|
|
123
|
+
if (outA <= 0.0) return vec4(0.0);
|
|
124
|
+
return vec4((c.rgb * a + base.rgb * base.a * (1.0 - a)) / outA, outA);
|
|
125
|
+
}
|