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.
Files changed (106) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/compatibility.json +306 -0
  3. package/gl-transitions.js +1 -1
  4. package/gl-transitions.json +1 -1
  5. package/glsl3/CardDeal.glsl +146 -0
  6. package/glsl3/CircleBurst.glsl +77 -0
  7. package/glsl3/CodeRain.glsl +114 -0
  8. package/glsl3/CurtainRise.glsl +71 -0
  9. package/glsl3/EchoSlide.glsl +93 -0
  10. package/glsl3/GeometricCollage.glsl +241 -0
  11. package/glsl3/GravityLens.glsl +66 -0
  12. package/glsl3/HingedSquares.glsl +121 -0
  13. package/glsl3/HorizontalHold.glsl +62 -0
  14. package/glsl3/LayoutGrid.glsl +147 -0
  15. package/glsl3/ProjectorThrow.glsl +75 -0
  16. package/glsl3/Reassemble.glsl +156 -0
  17. package/glsl3/RingSpin.glsl +112 -0
  18. package/glsl3/Shockwave.glsl +103 -0
  19. package/glsl3/ShoreWash.glsl +150 -0
  20. package/glsl3/ShutterWipe.glsl +68 -0
  21. package/glsl3/SpotlightWipe.glsl +63 -0
  22. package/glsl3/StopMotion.glsl +118 -0
  23. package/glsl3/Vaporize.glsl +125 -0
  24. package/index.js +1 -1
  25. package/layouts.json +725 -1
  26. package/llms-full.txt +734 -422
  27. package/llms.txt +238 -219
  28. package/msl/CardDeal.metal +539 -0
  29. package/msl/CircleBurst.metal +351 -0
  30. package/msl/CodeRain.metal +451 -0
  31. package/msl/CurtainRise.metal +263 -0
  32. package/msl/EchoSlide.metal +438 -0
  33. package/msl/GeometricCollage.metal +1188 -0
  34. package/msl/GravityLens.metal +236 -0
  35. package/msl/HingedSquares.metal +564 -0
  36. package/msl/HorizontalHold.metal +286 -0
  37. package/msl/LayoutGrid.metal +544 -0
  38. package/msl/ProjectorThrow.metal +313 -0
  39. package/msl/Reassemble.metal +667 -0
  40. package/msl/RingSpin.metal +474 -0
  41. package/msl/Shockwave.metal +256 -0
  42. package/msl/ShoreWash.metal +538 -0
  43. package/msl/ShutterWipe.metal +286 -0
  44. package/msl/SpotlightWipe.metal +217 -0
  45. package/msl/StopMotion.metal +551 -0
  46. package/msl/Vaporize.metal +462 -0
  47. package/package.json +1 -1
  48. package/skills/gl-transitions/references/catalog.md +94 -44
  49. package/sksl/CardDeal.sksl +156 -0
  50. package/sksl/CircleBurst.sksl +84 -0
  51. package/sksl/CodeRain.sksl +124 -0
  52. package/sksl/CurtainRise.sksl +84 -0
  53. package/sksl/EchoSlide.sksl +99 -0
  54. package/sksl/GeometricCollage.sksl +242 -0
  55. package/sksl/GravityLens.sksl +77 -0
  56. package/sksl/HingedSquares.sksl +124 -0
  57. package/sksl/HorizontalHold.sksl +74 -0
  58. package/sksl/LayoutGrid.sksl +156 -0
  59. package/sksl/ProjectorThrow.sksl +85 -0
  60. package/sksl/Reassemble.sksl +166 -0
  61. package/sksl/RingSpin.sksl +121 -0
  62. package/sksl/Shockwave.sksl +116 -0
  63. package/sksl/ShoreWash.sksl +159 -0
  64. package/sksl/ShutterWipe.sksl +80 -0
  65. package/sksl/SpotlightWipe.sksl +74 -0
  66. package/sksl/StopMotion.sksl +126 -0
  67. package/sksl/Vaporize.sksl +134 -0
  68. package/sksl/index.js +1 -1
  69. package/transitions/CardDeal.glsl +145 -0
  70. package/transitions/CircleBurst.glsl +76 -0
  71. package/transitions/CodeRain.glsl +113 -0
  72. package/transitions/CurtainRise.glsl +70 -0
  73. package/transitions/EchoSlide.glsl +92 -0
  74. package/transitions/GeometricCollage.glsl +240 -0
  75. package/transitions/GravityLens.glsl +65 -0
  76. package/transitions/HingedSquares.glsl +120 -0
  77. package/transitions/HorizontalHold.glsl +61 -0
  78. package/transitions/LayoutGrid.glsl +146 -0
  79. package/transitions/ProjectorThrow.glsl +74 -0
  80. package/transitions/Reassemble.glsl +155 -0
  81. package/transitions/RingSpin.glsl +111 -0
  82. package/transitions/Shockwave.glsl +102 -0
  83. package/transitions/ShoreWash.glsl +149 -0
  84. package/transitions/ShutterWipe.glsl +67 -0
  85. package/transitions/SpotlightWipe.glsl +62 -0
  86. package/transitions/StopMotion.glsl +117 -0
  87. package/transitions/Vaporize.glsl +124 -0
  88. package/wgsl/CardDeal.wgsl +496 -0
  89. package/wgsl/CircleBurst.wgsl +310 -0
  90. package/wgsl/CodeRain.wgsl +415 -0
  91. package/wgsl/CurtainRise.wgsl +235 -0
  92. package/wgsl/EchoSlide.wgsl +386 -0
  93. package/wgsl/GeometricCollage.wgsl +1075 -0
  94. package/wgsl/GravityLens.wgsl +206 -0
  95. package/wgsl/HingedSquares.wgsl +506 -0
  96. package/wgsl/HorizontalHold.wgsl +243 -0
  97. package/wgsl/LayoutGrid.wgsl +495 -0
  98. package/wgsl/ProjectorThrow.wgsl +274 -0
  99. package/wgsl/Reassemble.wgsl +609 -0
  100. package/wgsl/RingSpin.wgsl +426 -0
  101. package/wgsl/Shockwave.wgsl +226 -0
  102. package/wgsl/ShoreWash.wgsl +492 -0
  103. package/wgsl/ShutterWipe.wgsl +252 -0
  104. package/wgsl/SpotlightWipe.wgsl +186 -0
  105. package/wgsl/StopMotion.wgsl +496 -0
  106. package/wgsl/Vaporize.wgsl +420 -0
@@ -0,0 +1,75 @@
1
+ // ProjectorThrow — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/ProjectorThrow.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The lights go down on the outgoing image and a projector throws the incoming one onto it: a small, blurred, keystoned picture of light lands on the scene, tinted by the colors it falls on, then grows, comes into focus and squares up until it fills the frame as the scene beneath it fades away
5
+ // Tags: light, projector, projection, keystone, focus, reveal
6
+
7
+ // @range(0, 1) How dark the outgoing image gets once the lights go down
8
+ uniform float darkness; // = 0.8
9
+ // @range(0, 0.8) How much wider the top of the projected picture is than its bottom when it lands
10
+ uniform float keystone; // = 0.45
11
+ // @range(0, 0.05) How out of focus the projected picture is when it lands, in frame heights
12
+ uniform float blur; // = 0.015
13
+
14
+ // folds coordinates back into the frame, so the picture never shows its clamped edges
15
+ vec2 mirror(vec2 v) {
16
+ return 1.0 - abs(1.0 - mod(v, 2.0));
17
+ }
18
+
19
+ // the projected picture, sampled with 8 taps on a disc of radius r (in its own coordinates),
20
+ // averaged premultiplied so transparent texels do not bleed into it
21
+ vec4 projected(vec2 q, vec2 r) {
22
+ vec4 c = vec4(0.0);
23
+ for (int i = 0; i < 8; i++) {
24
+ float a = float(i) * 2.39996;
25
+ vec2 o = sqrt((float(i) + 0.5) / 8.0) * vec2(cos(a), sin(a));
26
+ vec4 t = getToColor(mirror(q + o * r));
27
+ c += vec4(t.rgb * t.a, t.a);
28
+ }
29
+ return c.a > 0.0 ? vec4(c.rgb / c.a, c.a / 8.0) : vec4(0.0);
30
+ }
31
+
32
+ vec4 transition(vec2 uv) {
33
+ float p = progress;
34
+ if (p <= 0.0) return getFromColor(uv);
35
+ if (p >= 1.0) return getToColor(uv);
36
+ vec4 from = getFromColor(uv);
37
+
38
+ // the lamp warms up as the room lights go down
39
+ float on = smoothstep(0.06, 0.26, p);
40
+ float ambient = 1.0 - darkness * smoothstep(0.0, 0.2, p);
41
+ // the picture grows and squares up, while it comes into focus
42
+ float g = smoothstep(0.02, 1.0, p);
43
+ float focus = 1.0 - smoothstep(0.15, 0.85, p);
44
+ float size = mix(0.32, 1.0, g * (0.6 + 0.4 * g));
45
+ float k = keystone * (1.0 - g);
46
+ float cy = mix(0.58, 0.5, g);
47
+
48
+ // keystone: the picture is a trapezoid seen in perspective, its rows spaced wider where it is wider
49
+ float y = (uv.y - cy) / size + 0.5;
50
+ float wy = max(1.0 - 0.5 * k + k * y, 0.05);
51
+ vec2 q = vec2((uv.x - 0.5) / (size * wy) + 0.5, y * (1.0 + 0.5 * k) / wy);
52
+
53
+ // soft edges of the beam, in frame heights, sharp once in focus
54
+ float e = min((0.5 * size * wy - abs(uv.x - 0.5)) * ratio, size * min(y, 1.0 - y));
55
+ float soft = 0.0015 + 0.035 * focus;
56
+ float cov = mix(smoothstep(-soft, soft, e), 1.0, smoothstep(0.9, 1.0, p));
57
+ // stray light spilling around the beam
58
+ float halo = 0.15 * focus * on * exp(-24.0 * max(-e, 0.0)) * (1.0 - cov);
59
+
60
+ // the light of the picture: brighter while concentrated on a small area, with a lamp vignette
61
+ vec2 d = q - 0.5;
62
+ float gain = on * mix(1.25, 1.0, g) * (1.0 + focus * (0.15 - 1.2 * dot(d, d)));
63
+ // the blur is round on the frame: picture coordinates stretch with the keystone
64
+ vec2 r = blur * focus / (size * wy) * vec2(1.0 / ratio, (1.0 - 0.25 * k * k) / wy);
65
+ vec4 pic = projected(q, r);
66
+ vec3 light = pic.rgb * gain * cov + halo;
67
+
68
+ // light lands on the dimmed scene and is tinted by its colors; under the picture, the scene
69
+ // fades to a plain screen
70
+ float screen = smoothstep(0.35, 0.95, p);
71
+ vec3 surface = mix(from.rgb, vec3(1.0), 0.35 + 0.65 * screen);
72
+ vec3 col = from.rgb * ambient * (1.0 - cov * screen) + surface * light;
73
+ // the picture of light shows even over a transparent scene
74
+ return vec4(col, mix(max(from.a, pic.a * cov * on), pic.a, cov * screen));
75
+ }
@@ -0,0 +1,156 @@
1
+ // Reassemble — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/Reassemble.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The outgoing image cracks into irregular shards that burst apart toward the viewer, each one turning over in 3D at its own moment, then fly back together and lock into place as the incoming image carried on their backs
5
+ // Tags: 3d, shards, flip, explode
6
+
7
+ // @range(2, 8, 1) Number of rows of shards
8
+ uniform int rows; // = 4
9
+ // @range(0, 1) How far the shards come toward the viewer
10
+ uniform float depth; // = 0.8
11
+ // @range(0, 0.5) How far the shards spread apart, as a part of their distance from the center
12
+ uniform float spread; // = 0.05
13
+ // @color Color seen between the shards
14
+ uniform vec4 backColor; // = vec4(0.04, 0.04, 0.05, 1.0)
15
+
16
+ const float PI = 3.141592653589793;
17
+ // distance of the eye, in frame heights
18
+ const float EYE = 2.5;
19
+ // width of the anti-aliased edges and half width of the open cracks, in frame heights
20
+ const float EDGE = 0.0015;
21
+ const float CRACK = 0.005;
22
+ // the shards leave between START and START + DELAY, and each one flies for FLIGHT
23
+ const float START = 0.03;
24
+ const float DELAY = 0.08;
25
+ const float FLIGHT = 0.86;
26
+
27
+ vec3 hash3(vec2 p) {
28
+ vec3 q = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
29
+ q += dot(q, q.yxz + 33.33);
30
+ return fract((q.xxy + q.yzz) * q.zyx);
31
+ }
32
+
33
+ // the seed of the shard of grid cell g, in frame heights from the center
34
+ vec2 seed(vec2 g, float size) {
35
+ return (g + 0.5 + 0.7 * (hash3(g).xy - 0.5)) * size;
36
+ }
37
+
38
+ // distance from q to the border of the shard of cell g (its Voronoi cell), negative outside it
39
+ float shardDist(vec2 q, vec2 g, float size) {
40
+ vec2 sj = seed(g, size);
41
+ float d = 1e9;
42
+ for (int y = -1; y <= 1; y++) {
43
+ for (int x = -1; x <= 1; x++) {
44
+ if (x == 0 && y == 0) continue;
45
+ vec2 sk = seed(g + vec2(float(x), float(y)), size);
46
+ vec2 dir = sk - sj;
47
+ d = min(d, dot(0.5 * (sj + sk) - q, dir) / length(dir));
48
+ }
49
+ }
50
+ return d;
51
+ }
52
+
53
+ float ease(float t) {
54
+ return t * t * (3.0 - 2.0 * t);
55
+ }
56
+
57
+ // how far a shard is out of place along its flight t: a quick burst, then a soft landing
58
+ float burst(float t) {
59
+ float u = clamp(t / 0.4, 0.0, 1.0);
60
+ float v = clamp((t - 0.4) / 0.6, 0.0, 1.0);
61
+ return t < 0.4 ? 1.0 - (1.0 - u) * (1.0 - u) : 1.0 - ease(v);
62
+ }
63
+
64
+ vec4 transition(vec2 uv) {
65
+ vec2 aspect = vec2(ratio, 1.0);
66
+ vec2 x = (uv - 0.5) * aspect;
67
+ float size = 1.0 / clamp(float(rows), 1.0, 8.0);
68
+ float E = clamp(spread, 0.0, 0.5);
69
+ float Z = clamp(depth, 0.0, 1.0);
70
+ float p = clamp(progress, 0.0, 1.0);
71
+ vec3 L = normalize(vec3(-0.45, 0.55, 1.0));
72
+ vec3 H = normalize(L + vec3(0.0, 0.0, 1.0));
73
+ vec3 eye = vec3(0.0, 0.0, EYE);
74
+ vec3 dir = vec3(x, -EYE);
75
+ // the cracks open as the image breaks and close as the shards lock back into place
76
+ float act = smoothstep(0.0, START + DELAY, p) * (1.0 - smoothstep(START + FLIGHT, 1.0, p));
77
+
78
+ // where this point roughly comes from, to find the shards that can cover it
79
+ float b0 = burst(clamp((p - START - 0.5 * DELAY) / FLIGHT, 0.0, 1.0));
80
+ vec2 x0 = x * (EYE - 0.75 * Z * b0) / EYE / (1.0 + E * b0);
81
+ vec2 cell0 = floor(x0 / size);
82
+
83
+ // the two nearest shards seen here: depth, image point, side (1 front), coverage, shading, rim
84
+ float z1 = 1e9, z2 = 1e9;
85
+ vec2 q1 = x, q2 = x;
86
+ float f1 = 1.0, f2 = 1.0, m1 = 0.0, m2 = 0.0;
87
+ float s1 = 1.0, s2 = 1.0, r1 = 0.0, r2 = 0.0;
88
+ for (int j = -1; j <= 1; j++) {
89
+ for (int i = -1; i <= 1; i++) {
90
+ vec2 g = cell0 + vec2(float(i), float(j));
91
+ vec3 h = hash3(g + 17.0);
92
+ float t = clamp((p - START - DELAY * h.x) / FLIGHT, 0.0, 1.0);
93
+ float b = burst(t);
94
+ // each shard turns over around its own axis at its own moment, while it is out of place
95
+ float th = PI * ease(clamp((t - 0.1 - 0.48 * h.z) / 0.24, 0.0, 1.0));
96
+ float ct = cos(th), st = sin(th);
97
+ // and turns a little in the frame, back straight when it lands
98
+ float phi = PI * h.y;
99
+ float rz = 0.5 * (h.z - 0.5) * b;
100
+ vec2 a0 = vec2(cos(phi), sin(phi));
101
+ vec2 p0 = vec2(-a0.y, a0.x);
102
+ vec3 a = vec3(cos(phi + rz), sin(phi + rz), 0.0);
103
+ vec3 w = vec3(-a.y, a.x, 0.0) * ct + vec3(0.0, 0.0, st);
104
+ vec2 c = seed(g, size);
105
+ vec3 center = vec3(c * (1.0 + E * b), Z * b * (0.5 + 0.5 * h.x));
106
+ vec3 nrm = cross(a, w);
107
+ float den = dot(dir, nrm);
108
+ if (abs(den) < 1e-6) continue;
109
+ float lam = dot(center - eye, nrm) / den;
110
+ if (lam <= 0.0) continue;
111
+ vec3 hit = eye + lam * dir - center;
112
+ float u = dot(hit, a), v = dot(hit, w);
113
+ // the front carries the outgoing image, the back the incoming one, mirrored so that it lands in place;
114
+ // the side seen is the one facing the eye, which swaps where the shard is seen edge-on
115
+ float front = den < 0.0 ? 1.0 : -1.0;
116
+ vec2 q = c + u * a0 + front * v * p0;
117
+ // anti-aliased edges, scaled to the screen; at rest the shards overlap a little to hide their seams
118
+ float k = EYE / (EYE - center.z);
119
+ float e = shardDist(q, g, size) - CRACK * act;
120
+ vec2 box = 0.5 * aspect - abs(q);
121
+ e = min(e, min(box.x, box.y)) * k * mix(1.0, max(abs(ct), 0.2), min(b * 8.0, 1.0)) + 4.0 * EDGE * (1.0 - act);
122
+ float m = clamp(e / (2.0 * EDGE) + 0.5, 0.0, 1.0);
123
+ // at rest the shards lie at the same depth: the one that covers this point fully comes first
124
+ float zk = lam - 0.001 * m;
125
+ if (m <= 0.0 || zk >= z2) continue;
126
+ // lit from the upper left, with a glint as a shard faces the light; unchanged at rest
127
+ vec3 n = nrm * front;
128
+ float lit = mix(0.45, 1.0, clamp(dot(n, L) / L.z, 0.0, 1.0));
129
+ float glint = 0.2 * min(b * 4.0, 1.0) * pow(max(dot(n, H), 0.0), 24.0);
130
+ // a pale rim on the broken edges while they fly, flashing as each shard locks into place
131
+ float lock = sin(PI * clamp((t - 0.86) / 0.14, 0.0, 1.0));
132
+ float rim = (0.3 * act * min(b * 4.0, 1.0) + 0.35 * lock) * (1.0 - smoothstep(0.0, 0.006, e));
133
+ if (zk < z1) {
134
+ z2 = z1; q2 = q1; f2 = f1; m2 = m1; s2 = s1; r2 = r1;
135
+ z1 = zk; q1 = q; f1 = front; m1 = m; s1 = lit + glint; r1 = rim;
136
+ } else {
137
+ z2 = zk; q2 = q; f2 = front; m2 = m; s2 = lit + glint; r2 = rim;
138
+ }
139
+ }
140
+ }
141
+
142
+ vec4 col = backColor;
143
+ if (m2 > 0.0) {
144
+ vec2 src = q2 / aspect + 0.5;
145
+ vec4 img = f2 > 0.0 ? getFromColor(src) : getToColor(src);
146
+ img.rgb = mix(min(img.rgb * s2, vec3(img.a)), vec3(img.a), r2);
147
+ col = mix(col, img, m2);
148
+ }
149
+ if (m1 > 0.0) {
150
+ vec2 src = q1 / aspect + 0.5;
151
+ vec4 img = f1 > 0.0 ? getFromColor(src) : getToColor(src);
152
+ img.rgb = mix(min(img.rgb * s1, vec3(img.a)), vec3(img.a), r1);
153
+ col = mix(col, img, m1);
154
+ }
155
+ return col;
156
+ }
@@ -0,0 +1,112 @@
1
+ // RingSpin — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/RingSpin.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The frame is cut into concentric rings that spin like the dials of a combination lock, in alternating directions and blurred with speed, one after another from the center outward; each ring overshoots a little and locks into place on the incoming image
5
+ // Tags: rotate, circle, rings, motion-blur
6
+
7
+ // @range(2, 12, 1) Number of rings, from the center to the farthest corner
8
+ uniform int rings; // = 6
9
+ // @param Square rings, like nested frames, instead of round ones
10
+ uniform bool square; // = false
11
+ // @range(1, 3, 1) Full turns made by each ring
12
+ uniform int turns; // = 1
13
+ // @range(0, 0.8) Delay between the first ring and the last one, as a part of the transition
14
+ uniform float stagger; // = 0.5
15
+ // @range(0, 1) Amount of angular motion blur while the rings spin fast
16
+ uniform float blur; // = 0.6
17
+ // @range(0, 1) Size of the overshoot when a ring locks
18
+ uniform float settle; // = 0.5
19
+
20
+ const float PI = 3.141592653589793;
21
+ // part of a ring's time spent overshooting and coming back
22
+ const float SETTLE = 0.2;
23
+ // half width of the gaps between the rings, width of their rims and of the anti-aliased edges, in frame heights
24
+ const float GAP = 0.0035;
25
+ const float RIM = 0.012;
26
+ const float EDGE = 0.0015;
27
+
28
+ vec2 mirrorUV(vec2 v) {
29
+ return 1.0 - abs(1.0 - mod(v, 2.0));
30
+ }
31
+
32
+ vec2 rotate(vec2 v, float a) {
33
+ float c = cos(a), s = sin(a);
34
+ return vec2(c * v.x + s * v.y, c * v.y - s * v.x);
35
+ }
36
+
37
+ // the delay between two rings, kept shorter than the time a ring moves so that the motion never pauses
38
+ float ringDelay(float n) {
39
+ float m = max(n - 1.0, 1.0);
40
+ return min(clamp(stagger, 0.0, 0.8) / m, 0.7 / (1.0 + 0.7 * m));
41
+ }
42
+
43
+ // local time of ring i: 0 until it starts, 1 once it is locked
44
+ float ringTime(float i, float n) {
45
+ float d = ringDelay(n);
46
+ return progress >= 1.0 ? 1.0 : clamp((progress - d * i) / (1.0 - d * (n - 1.0)), 0.0, 1.0);
47
+ }
48
+
49
+ // how much a ring is moving, which opens the gaps around it
50
+ float activity(float i, float n) {
51
+ float t = ringTime(i, n);
52
+ return smoothstep(0.0, 0.08, t) * (1.0 - smoothstep(0.88, 1.0, t));
53
+ }
54
+
55
+ // the ring's angle at its time t: it speeds up, reaches `total` a little fast, overshoots and springs back
56
+ float spin(float t, float total) {
57
+ float amp = 0.1 * settle * sign(total);
58
+ float stopT = 1.0 - SETTLE;
59
+ // speed at the stop, matched with the start of the overshoot
60
+ float v1 = amp * PI * stopT / (total * SETTLE);
61
+ float u = clamp(t / stopT, 0.0, 1.0);
62
+ float b = clamp((t - stopT) / SETTLE, 0.0, 1.0);
63
+ return total * (u * u * (3.0 - 2.0 * u) + v1 * (u * u * u - u * u)) + amp * sin(PI * b) * (1.0 - b) * (1.0 - b);
64
+ }
65
+
66
+ vec4 transition(vec2 uv) {
67
+ vec2 aspect = vec2(ratio, 1.0);
68
+ vec2 c = (uv - 0.5) * aspect;
69
+ float r = square ? max(abs(c.x), abs(c.y)) : length(c);
70
+ float n = clamp(float(rings), 1.0, 12.0);
71
+ float w = (square ? 0.5 * max(ratio, 1.0) : length(0.5 * aspect)) / n;
72
+ float f = r / w;
73
+ float i = min(floor(f), n - 1.0);
74
+ float t = ringTime(i, n);
75
+
76
+ vec4 col;
77
+ if (t <= 0.0) col = getFromColor(uv);
78
+ else if (t >= 1.0) col = getToColor(uv);
79
+ else {
80
+ float total = 2.0 * PI * max(float(turns), 1.0) * (mod(i, 2.0) < 0.5 ? 1.0 : -1.0);
81
+ float a = spin(t, total);
82
+ // angular speed per unit of progress, without the small overshoot; the blur spans what the ring
83
+ // travels in about a frame, at most a short arc so that the 8 taps stay close together
84
+ float u = min(t / (1.0 - SETTLE), 1.0);
85
+ float omega = abs(total) * 6.0 * u * (1.0 - u) / ((1.0 - SETTLE) * (1.0 - ringDelay(n) * (n - 1.0)));
86
+ float span = blur * min(omega * 0.015, 0.1 / max(r, 0.01));
87
+ // the incoming image takes over at full speed, hidden by the blur; the whole turns bring it back upright
88
+ float m = smoothstep(0.3, 0.5, t);
89
+ col = vec4(0.0);
90
+ float ws = 0.0;
91
+ for (int k = 0; k < 8; k++) {
92
+ float x = float(k) / 7.0 - 0.5;
93
+ vec2 q = mirrorUV(rotate(c, a + span * x) / aspect + 0.5);
94
+ vec4 s = mix(getFromColor(q), getToColor(q), m);
95
+ col += (1.0 - abs(x)) * s;
96
+ ws += 1.0 - abs(x);
97
+ }
98
+ col /= ws;
99
+ }
100
+
101
+ // the nearest boundary between two rings, open while one of them moves: a dark gap
102
+ // with a bevelled rim on each side, lit from the top left
103
+ float bj = clamp(floor(f + 0.5), 1.0, max(n - 1.0, 1.0));
104
+ float act = n > 1.5 ? max(activity(bj - 1.0, n), activity(bj, n)) : 0.0;
105
+ float d = (f - bj) * w;
106
+ vec2 nr = square ? (abs(c.x) > abs(c.y) ? vec2(sign(c.x), 0.0) : vec2(0.0, sign(c.y))) : c / max(r, 1e-4);
107
+ // the outer ring's inner rim faces the center, the inner ring's outer rim faces away from it
108
+ float light = -sign(d) * dot(nr, vec2(-0.6, 0.8)) * (1.0 - smoothstep(GAP, GAP + RIM, abs(d))) * act;
109
+ col.rgb = light > 0.0 ? mix(col.rgb, vec3(col.a), 0.35 * light) : col.rgb * (1.0 + 0.45 * light);
110
+ col.rgb *= 1.0 - 0.85 * act * (1.0 - smoothstep(GAP - EDGE, GAP + EDGE, abs(d)));
111
+ return col;
112
+ }
@@ -0,0 +1,103 @@
1
+ // Shockwave — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/Shockwave.glsl
2
+ // Author: Gilad Levi, github @Giladx
3
+ // License: MIT
4
+ // Description: A diagonal shockwave breaks the outgoing image into tiny falling glass tiles. Each tile slips away with a brief chromatic split and neon edge glow, revealing the incoming image beneath it.
5
+ // Tags: diagonal, mosaic, pixel, cascade, glass, prism, chromatic, neon, cinematic
6
+
7
+ // @range(0.012, 0.10) Size of each square tile relative to slide height
8
+ uniform float tileSize; // = 0.035
9
+ // @range(0.0, 1.5) How far the tiles slide and fall
10
+ uniform float scatter; // = 0.85
11
+ // @range(0.0, 1.0) 0 is a horizontal sweep; 1 is a strongly diagonal sweep
12
+ uniform float diagonal; // = 0.9
13
+ // @range(0.0, 1.0) Amount of red/blue optical separation at the moving edges
14
+ uniform float prism; // = 0.65
15
+ // @range(0.0, 1.0) Brightness of the colored edges around moving tiles
16
+ uniform float glow; // = 0.75
17
+
18
+ // A deterministic pseudo-random value per cell, stable between frames.
19
+ float toseeHash(vec2 p) {
20
+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
21
+ }
22
+
23
+ vec4 transition(vec2 uv) {
24
+ // Preserve perfect, undistorted source and destination frames.
25
+ if (progress <= 0.0) return getFromColor(uv);
26
+ if (progress >= 1.0) return getToColor(uv);
27
+
28
+ // Build an aspect-correct grid: square cells on wide and tall sliders.
29
+ float size = max(tileSize, 0.008);
30
+ vec2 grid = max(vec2(1.0), floor(vec2(ratio, 1.0) / size));
31
+ vec2 cell = floor(uv * grid);
32
+ vec2 cellUV = fract(uv * grid);
33
+ vec2 centerUV = (cell + 0.5) / grid;
34
+
35
+ // Schedule each tile in a diagonal wave with random stagger.
36
+ float sweep = mix(
37
+ centerUV.x,
38
+ 0.64 * centerUV.x + 0.36 * (1.0 - centerUV.y),
39
+ clamp(diagonal, 0.0, 1.0)
40
+ );
41
+
42
+ float noise = toseeHash(cell);
43
+ float start = 0.62 * sweep + 0.07 * noise;
44
+ float t = clamp((progress - start) / 0.29, 0.0, 1.0);
45
+ float movement = t * clamp(scatter, 0.0, 1.5);
46
+
47
+ // Move each outgoing image tile sideways and downward.
48
+ float wobble = toseeHash(cell + vec2(19.3, 7.7)) * 2.0 - 1.0;
49
+ vec2 drift = vec2(0.65 * wobble, -0.95) * movement;
50
+ vec2 movingCellUV = cellUV - drift;
51
+
52
+ // Clip moving tiles to their cells, revealing the next image.
53
+ float inside =
54
+ step(0.012, movingCellUV.x) *
55
+ step(movingCellUV.x, 0.988) *
56
+ step(0.012, movingCellUV.y) *
57
+ step(movingCellUV.y, 0.988);
58
+
59
+ float tileShape = mix(1.0, inside, smoothstep(0.0, 0.13, t));
60
+ float oldVisibility = 1.0 - smoothstep(0.48, 0.87, t);
61
+ float oldMask = tileShape * oldVisibility;
62
+
63
+ // Sample the old image using the tile's displaced position.
64
+ vec2 oldUV = clamp(uv - drift / grid, 0.0, 1.0);
65
+ vec4 oldColor = getFromColor(oldUV);
66
+
67
+ // Add chromatic separation while each tile is moving.
68
+ float flare = sin(3.14159265 * t);
69
+ vec2 shift = vec2(0.006, -0.002) * prism * flare;
70
+ vec4 offsetColor = getFromColor(
71
+ clamp(oldUV + shift, 0.0, 1.0)
72
+ );
73
+ oldColor.r = offsetColor.r;
74
+
75
+ // Reveal the incoming image below the falling tiles.
76
+ vec4 result = mix(getToColor(uv), oldColor, oldMask);
77
+
78
+ // Draw a temporary cyan or pink glowing rim around moving tiles.
79
+ float edgeDistance = min(
80
+ min(movingCellUV.x, 1.0 - movingCellUV.x),
81
+ min(movingCellUV.y, 1.0 - movingCellUV.y)
82
+ );
83
+
84
+ float edge =
85
+ (1.0 - smoothstep(0.0, 0.10, edgeDistance)) * inside;
86
+
87
+ vec3 cyan = vec3(0.12, 0.95, 1.0);
88
+ vec3 pink = vec3(1.0, 0.20, 0.65);
89
+
90
+ vec3 rimColor = mix(
91
+ cyan,
92
+ pink,
93
+ toseeHash(cell + vec2(5.4, 28.6))
94
+ );
95
+
96
+ result.rgb = clamp(
97
+ result.rgb + rimColor * edge * flare * glow * oldMask * 0.60,
98
+ 0.0,
99
+ 1.0
100
+ );
101
+
102
+ return result;
103
+ }
@@ -0,0 +1,150 @@
1
+ // ShoreWash — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/ShoreWash.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: A thin sheet of water runs up over the outgoing image like the last of a wave on a beach, its lobed front edged with bubbly foam; it slows, stops just past the far edge and drains back, leaving the incoming image wet and glossy as it dries
5
+ // Tags: water, foam, beach, liquid, directional, reveal
6
+
7
+ // @param Direction the water runs up toward
8
+ uniform vec2 direction; // = vec2(0.0, 1.0)
9
+ // @range(0, 1) Amount of foam on the front and left behind
10
+ uniform float foam; // = 0.7
11
+ // @range(0, 0.05) How much the sheet of water bends the image under it
12
+ uniform float refraction; // = 0.02
13
+ // @color Color of the water (its alpha is its strength)
14
+ uniform vec4 water; // = vec4(0.1, 0.6, 0.62, 0.4)
15
+
16
+ // half width of the antialiased edges, in frame heights
17
+ const float AA = 0.002;
18
+ // how far the lobes of the front lead or trail, in frame heights
19
+ const float LOBE = 0.06;
20
+ // width of the band of foam lace behind the front, in frame heights
21
+ const float LACE = 0.3;
22
+ // size of the foam bubbles, in frame heights
23
+ const float CELL = 0.045;
24
+ // part of the transition the water runs up during; it drains back during the rest
25
+ const float RUNUP = 0.4;
26
+ // width of the dense band of foam right behind the front, in frame heights
27
+ const float FOAMW = 0.1;
28
+
29
+ float hash12(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
+ vec2 hash22(vec2 p) {
36
+ vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
37
+ p3 += dot(p3, p3.yzx + 33.33);
38
+ return fract((p3.xx + p3.yz) * p3.zy);
39
+ }
40
+
41
+ float vnoise(vec2 p) {
42
+ vec2 i = floor(p);
43
+ vec2 f = fract(p);
44
+ f = f * f * (3.0 - 2.0 * f);
45
+ return mix(
46
+ mix(hash12(i), hash12(i + vec2(1.0, 0.0)), f.x),
47
+ mix(hash12(i + vec2(0.0, 1.0)), hash12(i + vec2(1.0, 1.0)), f.x),
48
+ f.y
49
+ );
50
+ }
51
+
52
+ // foam: bubbles packed side by side, white where they touch and open at their centers.
53
+ // Sparse foam is a faint lace; the denser it is, the brighter it is and the smaller the
54
+ // holes, until they close (density 1)
55
+ float bubbles(vec2 p, float density) {
56
+ vec2 i = floor(p);
57
+ vec2 f = fract(p);
58
+ float d1 = 8.0;
59
+ float d2 = 8.0;
60
+ for (int y = -1; y <= 1; y++) {
61
+ for (int x = -1; x <= 1; x++) {
62
+ vec2 o = vec2(float(x), float(y));
63
+ vec2 c = o + 0.15 + 0.7 * hash22(i + o) - f;
64
+ float d = dot(c, c);
65
+ if (d < d1) {
66
+ d2 = d1;
67
+ d1 = d;
68
+ } else if (d < d2) {
69
+ d2 = d;
70
+ }
71
+ }
72
+ }
73
+ float e = sqrt(d2) - sqrt(d1);
74
+ float w = 0.12 + 0.6 * density;
75
+ return (1.0 - smoothstep(w - 0.12, w + 0.12, e)) * smoothstep(0.0, 0.35, density);
76
+ }
77
+
78
+ vec2 mirror(vec2 v) {
79
+ return 1.0 - abs(1.0 - mod(v, 2.0));
80
+ }
81
+
82
+ vec4 transition(vec2 uv) {
83
+ vec2 dir = length(direction) > 0.0 ? normalize(direction) : vec2(0.0, 1.0);
84
+ vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
85
+ // distance along the run-up, 0 at the middle of the frame, and across it
86
+ float a = dot(q, dir);
87
+ float b = dot(q, vec2(-dir.y, dir.x));
88
+ // half the extent of the frame along the run-up
89
+ float extent = 0.5 * (abs(dir.x) * ratio + abs(dir.y));
90
+ float start = -extent - LOBE - 0.1;
91
+ float stop = extent + LOBE + 0.01;
92
+
93
+ // the front races in, slows down and stops (run-up), then drains back faster and faster
94
+ float up = clamp(progress / RUNUP, 0.0, 1.0);
95
+ float back = clamp((progress - RUNUP) / (1.0 - RUNUP), 0.0, 1.0);
96
+ float front = mix(start, stop, 1.0 - pow(1.0 - up, 1.6)) - (stop - start) * pow(back, 1.5);
97
+
98
+ // lobed front: tongues of water run ahead in some places, and drift sideways a little
99
+ float lobes = vnoise(vec2(b * 7.0 + 3.1, progress * 2.0)) * 0.7 + vnoise(vec2(b * 17.0, 5.0 + progress * 3.0)) * 0.3;
100
+ float behind = front + LOBE * (lobes - 0.5) * 2.0 - a; // > 0 under the water
101
+ float sheet = smoothstep(-AA, AA, behind);
102
+
103
+ // the image swaps under the dense foam right behind the running front, and finishes
104
+ // swapping under the water as it stops by the far edge
105
+ float swapped = max(smoothstep(0.01, 0.8 * FOAMW, behind), (progress < RUNUP ? sheet : 1.0) * smoothstep(RUNUP - 0.08, RUNUP, progress));
106
+
107
+ // the sheet of water ripples (stretched across the flow) and bends what is under it
108
+ vec2 rp = vec2(a * 20.0, b * 5.0 + 3.0 * vnoise(q * 4.0)) - vec2(7.0 * min(progress, RUNUP) - 5.0 * back, 0.0);
109
+ float n0 = vnoise(rp);
110
+ vec2 g = (vnoise(rp + vec2(0.15, 0.0)) - n0) / 0.15 * dir + (vnoise(rp + vec2(0.0, 0.15)) - n0) / 0.15 * vec2(-dir.y, dir.x);
111
+ // the water is thin at its edge and deeper behind it
112
+ float thick = sheet * smoothstep(0.0, 0.12, behind);
113
+ vec2 off = g * refraction * thick * vec2(1.0 / ratio, 1.0);
114
+
115
+ vec4 c = mix(getFromColor(mirror(uv + off)), getToColor(mirror(uv + off)), swapped);
116
+ c.rgb = mix(c.rgb, water.rgb, water.a * sheet * (0.3 + 0.7 * smoothstep(0.0, 0.35, behind)));
117
+ // soft glints on the ripples
118
+ float glint = pow(max(dot(normalize(vec3(-g, 3.0)), normalize(vec3(-0.3, 0.6, 1.0))), 0.0), 14.0);
119
+ c.rgb += glint * 0.4 * thick;
120
+
121
+ // wet: what the water has drained off is darker and glossier, and dries out
122
+ float wet = (1.0 - sheet) * exp(min(behind, 0.0) * 2.5) * smoothstep(RUNUP, RUNUP + 0.05, progress) * (1.0 - smoothstep(0.7, 1.0, progress));
123
+ c.rgb *= mix(vec3(1.0), c.rgb, 0.55 * wet);
124
+ c.rgb += 0.1 * wet * smoothstep(0.4, 0.9, vnoise(vec2(a * 30.0, b * 6.0)));
125
+
126
+ // foam: thick and bubbly right behind the running front, a lace trailing behind it,
127
+ // and a thin line on the draining front; none is left on the image the water has drained off
128
+ // the foam drifts with the water as it runs up, then stays where it is
129
+ vec2 lp = vec2(a - 0.4 * (progress < RUNUP ? front : stop), b) / CELL;
130
+ // the lace gathers in streaks along the front, broken into patches
131
+ float patches = smoothstep(0.45, 0.8, 0.6 * vnoise(lp * vec2(0.4, 0.1) + 4.0) + 0.4 * vnoise(lp * 0.3 + 9.0));
132
+ float bandW = FOAMW * (0.5 + vnoise(vec2(b * 25.0, 2.0)));
133
+ float density = (1.0 - smoothstep(0.0, bandW, behind)) * (1.0 - smoothstep(RUNUP - 0.05, RUNUP + 0.12, progress));
134
+ density = max(density, 0.55 * patches * (1.0 - smoothstep(0.0, LACE, behind)) * (1.0 - 0.5 * back));
135
+ density = max(density, 0.9 * (1.0 - smoothstep(0.0, 0.012 + 0.02 * vnoise(vec2(b * 40.0, 1.0)), behind)));
136
+ density *= sheet;
137
+ // bubbles of two sizes, over a milky haze where the foam is dense
138
+ float f = 0.0;
139
+ if (density > 0.0) {
140
+ f = max(bubbles(lp, density), 0.85 * bubbles(lp * 1.7 + 7.0, density * 0.9));
141
+ f = max(f, 0.45 * smoothstep(0.15, 0.7, density)) * foam;
142
+ }
143
+ // the foam shades the water around it a little
144
+ c.rgb *= 1.0 - 0.25 * sheet * foam * (1.0 - f) * smoothstep(0.0, 0.6, density);
145
+ c.rgb = mix(c.rgb, vec3(0.97, 0.98, 0.97), clamp(f, 0.0, 1.0));
146
+ // a thin shadow just ahead of the running front
147
+ float sh = smoothstep(-0.03, 0.0, behind);
148
+ c.rgb *= 1.0 - 0.35 * (1.0 - sheet) * sh * sh * (1.0 - smoothstep(RUNUP - 0.05, RUNUP, progress));
149
+ return c;
150
+ }
@@ -0,0 +1,68 @@
1
+ // ShutterWipe — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/ShutterWipe.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: A camera's focal-plane shutter fires across the frame, seen through the camera's gate: thin metal blades fan down from a tight stack above it until they overlap over the whole frame, then keep running down and stack below it, uncovering the incoming image from the top
5
+ // Tags: camera, shutter, wipe, metal
6
+
7
+ // @range(3, 10, 1) Number of metal blades
8
+ uniform int blades; // = 5
9
+ // @range(0, 0.2) How much the blades tilt on their arms while they travel
10
+ uniform float tilt; // = 0.06
11
+ // @range(0, 0.08) Width of the camera's gate framing the image while the shutter fires, in frame heights
12
+ uniform float gate; // = 0.035
13
+ // @color Color of the metal blades
14
+ uniform vec4 color; // = vec4(0.09, 0.09, 0.1, 1.0)
15
+
16
+ // spacing of the blades in their stacks, and how far the stacks rest outside the frame, in frame heights
17
+ const float STACK = 0.016;
18
+ const float REST = 0.05;
19
+
20
+ vec4 transition(vec2 uv) {
21
+ float n = clamp(float(blades), 3.0, 10.0);
22
+ // tall enough to still overlap, past their blurred edges, when they are spread the most
23
+ float h = 1.7 / n + 0.02;
24
+ float pile = (n - 1.0) * STACK;
25
+ // the bottoms of the blades run from a stack above the frame to a stack below it: the
26
+ // lowest blade leads, the highest one trails
27
+ float travel = 1.0 + 2.0 * REST + h + pile;
28
+ vec2 t = clamp((progress - vec2(0.0, 0.3)) / 0.7, 0.0, 1.0);
29
+ vec2 pos = 1.0 + REST + vec2(0.0, pile) - travel * t * t * (3.0 - 2.0 * t);
30
+ vec2 vel = travel * 6.0 * t * (1.0 - t) / 0.7;
31
+
32
+ float x = (uv.x - 0.5) * ratio;
33
+ // the images are swapped halfway, behind the closed shutter
34
+ vec4 col = progress < 0.5 ? getFromColor(uv) : getToColor(uv);
35
+ // painted from the lowest blade to the highest, each one over the top of the one below it
36
+ for (int i = 0; i < 10; i++) {
37
+ float k = float(i) / (n - 1.0);
38
+ if (k < 1.0001) {
39
+ float v = mix(vel.x, vel.y, k);
40
+ // the blades ride on arms, so the fast ones tilt a little, and their travel blurs their edges
41
+ float d = uv.y - mix(pos.x, pos.y, k) + tilt * 0.1 * v * x;
42
+ // contact shadow cast on what lies just below the leading edge
43
+ float aa = 0.002 + 0.005 * v;
44
+ float sh = (1.0 - smoothstep(0.0, 0.03 + 0.012 * v, -d)) * (1.0 - smoothstep(-aa, aa, d));
45
+ col.rgb *= 1.0 - 0.65 * color.a * sh * sh;
46
+ // matte metal, slightly curved: lighter toward the leading edge, which ends in a bright
47
+ // rolled lip, darker toward the top where it slides under the next blade, with a sheen
48
+ // that crosses each blade as it passes the light
49
+ float l = clamp(d / h, 0.0, 1.0);
50
+ float lip = smoothstep(0.003, 0.007, d) * (1.0 - smoothstep(0.007, 0.014, d));
51
+ float s = (uv.y - d - 0.55 + 0.3 * x) * 2.5;
52
+ float sheen = 0.3 * exp(-s * s) * (1.0 - l) * (1.0 - l);
53
+ vec3 metal = color.rgb * (1.3 - 0.75 * l) + (0.25 * lip + sheen) * (0.6 + 0.4 * color.rgb) * color.a;
54
+ metal *= 0.4 + 0.6 * smoothstep(0.0, 0.005, d);
55
+ float cover = smoothstep(-aa, aa, d) * (1.0 - smoothstep(h - aa, h + aa, d));
56
+ col = mix(col, vec4(clamp(metal, 0.0, 1.0), color.a), cover);
57
+ }
58
+ }
59
+ // the camera's gate frames the image while the shutter fires
60
+ float g = gate * smoothstep(0.0, 0.12, progress) * (1.0 - smoothstep(0.88, 1.0, progress));
61
+ vec2 c = abs(uv - 0.5) * vec2(ratio, 1.0) - vec2(0.5 * ratio, 0.5) + 1.5 * g;
62
+ float e = length(max(c, 0.0)) + min(max(c.x, c.y), 0.0) - 0.5 * g;
63
+ float on = smoothstep(0.0, 0.002, gate) * smoothstep(0.0, 0.04, progress) * (1.0 - smoothstep(0.96, 1.0, progress));
64
+ // it shades the image along its inner edge
65
+ col.rgb *= 1.0 - 0.5 * color.a * on * smoothstep(-0.4 * g - 0.001, 0.0, e);
66
+ vec3 housing = min(color.rgb * (1.5 - smoothstep(0.0, 0.2 * g + 0.001, e)), 1.0);
67
+ return mix(col, vec4(housing, color.a), on * smoothstep(-0.002, 0.002, e));
68
+ }