gl-transitions 2.1.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.
Files changed (166) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/compatibility.json +496 -0
  3. package/gl-transitions.js +1 -1
  4. package/gl-transitions.json +1 -1
  5. package/glsl3/Accordion.glsl +85 -0
  6. package/glsl3/Ascii.glsl +124 -0
  7. package/glsl3/BlockCover.glsl +87 -0
  8. package/glsl3/BloomDissolve.glsl +110 -0
  9. package/glsl3/BokehDissolve.glsl +123 -0
  10. package/glsl3/BrushWipe.glsl +100 -0
  11. package/glsl3/CameraShake.glsl +98 -0
  12. package/glsl3/CardSwipe.glsl +81 -0
  13. package/glsl3/CurvedWipe.glsl +52 -0
  14. package/glsl3/CylinderRoll.glsl +102 -0
  15. package/glsl3/Disintegrate.glsl +112 -0
  16. package/glsl3/FilmDissolve.glsl +49 -0
  17. package/glsl3/FilmStrip.glsl +105 -0
  18. package/glsl3/FlameWipe.glsl +154 -0
  19. package/glsl3/GooeyWipe.glsl +97 -0
  20. package/glsl3/InkBleed.glsl +96 -0
  21. package/glsl3/LensFlare.glsl +125 -0
  22. package/glsl3/LightRays.glsl +106 -0
  23. package/glsl3/LightStreaks.glsl +117 -0
  24. package/glsl3/LightWipe.glsl +89 -0
  25. package/glsl3/PhotoDevelop.glsl +59 -0
  26. package/glsl3/PixelStretch.glsl +73 -0
  27. package/glsl3/PlusWipe.glsl +38 -0
  28. package/glsl3/PopIn.glsl +57 -0
  29. package/glsl3/Refraction.glsl +95 -0
  30. package/glsl3/SmokeDissolve.glsl +102 -0
  31. package/glsl3/SplatterWipe.glsl +154 -0
  32. package/glsl3/StretchSlide.glsl +62 -0
  33. package/glsl3/WedgeWipe.glsl +35 -0
  34. package/glsl3/WhipSpin.glsl +69 -0
  35. package/glsl3/WhipTilt.glsl +79 -0
  36. package/index.js +1 -1
  37. package/layouts.json +1512 -371
  38. package/llms-full.txt +793 -292
  39. package/llms.txt +185 -154
  40. package/msl/Accordion.metal +421 -0
  41. package/msl/Ascii.metal +567 -0
  42. package/msl/BlockCover.metal +403 -0
  43. package/msl/BloomDissolve.metal +416 -0
  44. package/msl/BokehDissolve.metal +447 -0
  45. package/msl/BrushWipe.metal +488 -0
  46. package/msl/CameraShake.metal +393 -0
  47. package/msl/CardSwipe.metal +342 -0
  48. package/msl/CurvedWipe.metal +229 -0
  49. package/msl/CylinderRoll.metal +374 -0
  50. package/msl/Disintegrate.metal +468 -0
  51. package/msl/FilmDissolve.metal +199 -0
  52. package/msl/FilmStrip.metal +429 -0
  53. package/msl/FlameWipe.metal +575 -0
  54. package/msl/GooeyWipe.metal +398 -0
  55. package/msl/InkBleed.metal +409 -0
  56. package/msl/LensFlare.metal +455 -0
  57. package/msl/LightRays.metal +427 -0
  58. package/msl/LightStreaks.metal +518 -0
  59. package/msl/LightWipe.metal +321 -0
  60. package/msl/PhotoDevelop.metal +245 -0
  61. package/msl/PixelStretch.metal +337 -0
  62. package/msl/PlusWipe.metal +199 -0
  63. package/msl/PopIn.metal +245 -0
  64. package/msl/Refraction.metal +333 -0
  65. package/msl/SmokeDissolve.metal +400 -0
  66. package/msl/SplatterWipe.metal +677 -0
  67. package/msl/StretchSlide.metal +243 -0
  68. package/msl/WedgeWipe.metal +154 -0
  69. package/msl/WhipSpin.metal +278 -0
  70. package/msl/WhipTilt.metal +327 -0
  71. package/package.json +1 -1
  72. package/skills/gl-transitions/references/catalog.md +113 -37
  73. package/sksl/Accordion.sksl +94 -0
  74. package/sksl/Ascii.sksl +131 -0
  75. package/sksl/BlockCover.sksl +96 -0
  76. package/sksl/BloomDissolve.sksl +119 -0
  77. package/sksl/BokehDissolve.sksl +132 -0
  78. package/sksl/BrushWipe.sksl +109 -0
  79. package/sksl/CameraShake.sksl +108 -0
  80. package/sksl/CardSwipe.sksl +93 -0
  81. package/sksl/CurvedWipe.sksl +64 -0
  82. package/sksl/CylinderRoll.sksl +112 -0
  83. package/sksl/Disintegrate.sksl +117 -0
  84. package/sksl/FilmDissolve.sksl +60 -0
  85. package/sksl/FilmStrip.sksl +114 -0
  86. package/sksl/FlameWipe.sksl +162 -0
  87. package/sksl/GooeyWipe.sksl +109 -0
  88. package/sksl/InkBleed.sksl +109 -0
  89. package/sksl/LensFlare.sksl +135 -0
  90. package/sksl/LightRays.sksl +115 -0
  91. package/sksl/LightStreaks.sksl +126 -0
  92. package/sksl/LightWipe.sksl +97 -0
  93. package/sksl/PhotoDevelop.sksl +72 -0
  94. package/sksl/PixelStretch.sksl +84 -0
  95. package/sksl/PlusWipe.sksl +50 -0
  96. package/sksl/PopIn.sksl +69 -0
  97. package/sksl/Refraction.sksl +103 -0
  98. package/sksl/SmokeDissolve.sksl +115 -0
  99. package/sksl/SplatterWipe.sksl +161 -0
  100. package/sksl/StretchSlide.sksl +74 -0
  101. package/sksl/WedgeWipe.sksl +46 -0
  102. package/sksl/WhipSpin.sksl +79 -0
  103. package/sksl/WhipTilt.sksl +90 -0
  104. package/sksl/index.js +1 -1
  105. package/transitions/Accordion.glsl +84 -0
  106. package/transitions/Ascii.glsl +123 -0
  107. package/transitions/BlockCover.glsl +86 -0
  108. package/transitions/BloomDissolve.glsl +109 -0
  109. package/transitions/BokehDissolve.glsl +122 -0
  110. package/transitions/BrushWipe.glsl +99 -0
  111. package/transitions/CameraShake.glsl +97 -0
  112. package/transitions/CardSwipe.glsl +80 -0
  113. package/transitions/CurvedWipe.glsl +51 -0
  114. package/transitions/CylinderRoll.glsl +101 -0
  115. package/transitions/Disintegrate.glsl +111 -0
  116. package/transitions/FilmDissolve.glsl +48 -0
  117. package/transitions/FilmStrip.glsl +104 -0
  118. package/transitions/FlameWipe.glsl +153 -0
  119. package/transitions/GooeyWipe.glsl +96 -0
  120. package/transitions/InkBleed.glsl +95 -0
  121. package/transitions/LensFlare.glsl +124 -0
  122. package/transitions/LightRays.glsl +105 -0
  123. package/transitions/LightStreaks.glsl +116 -0
  124. package/transitions/LightWipe.glsl +88 -0
  125. package/transitions/PhotoDevelop.glsl +58 -0
  126. package/transitions/PixelStretch.glsl +72 -0
  127. package/transitions/PlusWipe.glsl +37 -0
  128. package/transitions/PopIn.glsl +56 -0
  129. package/transitions/Refraction.glsl +94 -0
  130. package/transitions/SmokeDissolve.glsl +101 -0
  131. package/transitions/SplatterWipe.glsl +153 -0
  132. package/transitions/StretchSlide.glsl +61 -0
  133. package/transitions/WedgeWipe.glsl +34 -0
  134. package/transitions/WhipSpin.glsl +68 -0
  135. package/transitions/WhipTilt.glsl +78 -0
  136. package/wgsl/Accordion.wgsl +376 -0
  137. package/wgsl/Ascii.wgsl +519 -0
  138. package/wgsl/BlockCover.wgsl +352 -0
  139. package/wgsl/BloomDissolve.wgsl +372 -0
  140. package/wgsl/BokehDissolve.wgsl +409 -0
  141. package/wgsl/BrushWipe.wgsl +443 -0
  142. package/wgsl/CameraShake.wgsl +348 -0
  143. package/wgsl/CardSwipe.wgsl +308 -0
  144. package/wgsl/CurvedWipe.wgsl +198 -0
  145. package/wgsl/CylinderRoll.wgsl +330 -0
  146. package/wgsl/Disintegrate.wgsl +426 -0
  147. package/wgsl/FilmDissolve.wgsl +169 -0
  148. package/wgsl/FilmStrip.wgsl +381 -0
  149. package/wgsl/FlameWipe.wgsl +531 -0
  150. package/wgsl/GooeyWipe.wgsl +353 -0
  151. package/wgsl/InkBleed.wgsl +366 -0
  152. package/wgsl/LensFlare.wgsl +406 -0
  153. package/wgsl/LightRays.wgsl +380 -0
  154. package/wgsl/LightStreaks.wgsl +460 -0
  155. package/wgsl/LightWipe.wgsl +277 -0
  156. package/wgsl/PhotoDevelop.wgsl +213 -0
  157. package/wgsl/PixelStretch.wgsl +298 -0
  158. package/wgsl/PlusWipe.wgsl +165 -0
  159. package/wgsl/PopIn.wgsl +213 -0
  160. package/wgsl/Refraction.wgsl +294 -0
  161. package/wgsl/SmokeDissolve.wgsl +363 -0
  162. package/wgsl/SplatterWipe.wgsl +613 -0
  163. package/wgsl/StretchSlide.wgsl +213 -0
  164. package/wgsl/WedgeWipe.wgsl +126 -0
  165. package/wgsl/WhipSpin.wgsl +241 -0
  166. package/wgsl/WhipTilt.wgsl +291 -0
@@ -0,0 +1,154 @@
1
+ // FlameWipe — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/FlameWipe.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: A wall of flames sweeps across the frame, scorching the outgoing image ahead of it and leaving the incoming image under a fading warm glow
5
+ // Tags: fire, flame, burn, wipe, directional
6
+
7
+ // @param Direction in which the flames sweep across the frame
8
+ uniform vec2 direction; // = vec2(0.0, 1.0)
9
+ // @range(0, 1) Height of the flames, as a fraction of the frame height
10
+ uniform float height; // = 0.4
11
+ // @range(0, 1) How much the outgoing image browns and chars ahead of the flames
12
+ uniform float scorch; // = 0.7
13
+ // @range(0, 1) Strength of the warm glow left on the incoming image
14
+ uniform float glow; // = 0.6
15
+ // @color Tint of the body of the flames
16
+ uniform vec3 color; // = vec3(1.0, 0.4, 0.08)
17
+
18
+ // width of the scorched band ahead of the flames, and of the glow behind them
19
+ const float BAND = 0.45;
20
+ // how far off the frame the front starts and ends
21
+ const float PAD = 0.3;
22
+ // how far the front of the fire wanders around its straight line
23
+ const float RAGGED = 0.05;
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 noise(vec2 v) {
32
+ vec2 i = floor(v);
33
+ vec2 f = v - i;
34
+ f = f * f * (3.0 - 2.0 * f);
35
+ return mix(mix(hash12(i), hash12(i + vec2(1.0, 0.0)), f.x),
36
+ mix(hash12(i + vec2(0.0, 1.0)), hash12(i + vec2(1.0, 1.0)), f.x), f.y);
37
+ }
38
+
39
+ float fbm(vec2 v) {
40
+ float sum = 0.0;
41
+ float amp = 0.5;
42
+ for (int i = 0; i < 4; i++) {
43
+ sum += amp * noise(v);
44
+ v = v * 2.03 + vec2(17.3, 9.1);
45
+ amp *= 0.5;
46
+ }
47
+ return sum / 0.9375;
48
+ }
49
+
50
+ // mirror the coordinates back into the frame
51
+ vec2 mirror(vec2 v) {
52
+ return 1.0 - abs(1.0 - mod(v, 2.0));
53
+ }
54
+
55
+ // color of the fire by its heat: dark red tips, a tinted body, a white-yellow core
56
+ vec3 fire(float h) {
57
+ vec3 c = mix(vec3(0.22, 0.01, 0.0), color * color * vec3(1.0, 0.6, 0.4), smoothstep(0.0, 0.3, h));
58
+ c = mix(c, color, smoothstep(0.25, 0.55, h));
59
+ c = mix(c, vec3(1.0, 0.8, 0.35), smoothstep(0.55, 0.8, h));
60
+ return mix(c, vec3(1.0, 0.96, 0.82), smoothstep(0.8, 1.0, h));
61
+ }
62
+
63
+ // width of a flame tongue climbing along an upright line, from its base (s = 0) to its tip
64
+ // (s = 1), with a random size
65
+ float climbing(float s, float size) {
66
+ return (0.42 + 0.56 * size) * 6.75 * s * (1.0 - s) * (1.0 - s);
67
+ }
68
+
69
+ vec4 transition(vec2 uv) {
70
+ vec2 dir = length(direction) > 1e-5 ? normalize(direction) : vec2(1.0, 0.0);
71
+ vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
72
+ // the flames rise upward from the front: over this distance along the direction
73
+ float rise = height * dir.y;
74
+ // half-width of the burning line, and how far it swells
75
+ float w = 0.05 + 0.35 * height;
76
+ float reach = w * (1.75 + 0.6 * abs(dir.x));
77
+ // the front crosses the frame at the same pace whatever the height of the flames
78
+ float extent = 0.5 * (abs(dir.x) * ratio + abs(dir.y)) + PAD;
79
+ float e = mix(progress, progress * progress * (3.0 - 2.0 * progress), 0.3);
80
+ // the fire catches at the start and dies out at the end, the scorch grows in, the glow fades
81
+ float burn = smoothstep(0.0, 0.12, progress) * (1.0 - smoothstep(0.88, 1.0, progress));
82
+ float scorchAmount = scorch * smoothstep(0.0, 0.2, progress);
83
+ float glowAmount = glow * (1.0 - smoothstep(0.75, 1.0, progress));
84
+ // the flames flicker as they go
85
+ float t = progress * 5.0;
86
+
87
+ float side = dot(q, vec2(-dir.y, dir.x));
88
+ float front = mix(-extent, extent, e) + RAGGED * (2.0 * noise(vec2(side * 4.0, t * 0.4)) - 1.0);
89
+ // > 0 ahead of the fire, on the outgoing image
90
+ float k = dot(q, dir) - front;
91
+
92
+ // heat before the turbulence: the burning line, and the flames rising from it.
93
+ // Billows rising in screen space swell and thin the line; where it stands upright,
94
+ // they are tongues climbing along it, each widest at its base and pointed at its tip
95
+ float billow = noise(vec2(q.x * 3.0 + 5.0, q.y * 2.5 - t * 1.6));
96
+ float y = q.y * 3.0 - t * 1.4;
97
+ float y2 = y + 0.5;
98
+ float climb = max(climbing(fract(y), hash12(vec2(floor(y), 3.0))),
99
+ climbing(fract(y2), hash12(vec2(floor(y2), 7.0))));
100
+ billow = mix(billow, 0.4 * billow + climb, abs(dir.x));
101
+ float lineWidth = w * (0.25 + 1.5 * billow);
102
+ float line = 1.0 - smoothstep(0.0, lineWidth, abs(k));
103
+ float tongue = 0.0;
104
+ if (abs(rise) > 1e-4) {
105
+ float s = k / rise;
106
+ if (s >= 0.0) tongue = clamp(1.0 - s, 0.0, 1.0);
107
+ }
108
+ float heat = max(line, tongue) * burn;
109
+ float near = 1.0 - smoothstep(0.0, BAND, abs(k));
110
+
111
+ // the outgoing image shimmers in the heat ahead of the fire
112
+ vec2 h = q * vec2(9.0, 5.0) + vec2(0.0, -t * 3.0);
113
+ vec2 shimmer = (vec2(noise(h), noise(h + 31.7)) - 0.5) * 0.012 * min(near + heat, 1.0) * burn;
114
+ vec4 a = getFromColor(mirror(uv + shimmer));
115
+ vec4 b = getToColor(uv);
116
+
117
+ // the outgoing image browns, then chars close to the flames
118
+ float brown = k > 0.0 ? scorchAmount * near : 0.0;
119
+ float lum = dot(a.rgb, vec3(0.299, 0.587, 0.114));
120
+ a.rgb = mix(a.rgb, lum * vec3(0.9, 0.55, 0.28), brown) * (1.0 - 0.35 * brown) * (1.0 - 0.9 * brown * near * near);
121
+ // the incoming image under a warm glow fading away from the fire
122
+ float g = k < 0.0 ? glowAmount * near : 0.0;
123
+ b.rgb = b.rgb * mix(vec3(1.0), vec3(1.0, 0.6, 0.35), 0.7 * g) + color * 0.4 * g * g;
124
+
125
+ // far from the fire, only one of the images shows
126
+ if (k >= max(BAND, max(rise, reach))) return a.a > 0.0 ? a : vec4(0.0);
127
+ if (-k >= max(BAND, max(-rise, reach))) return b.a > 0.0 ? b : vec4(0.0);
128
+
129
+ // the two images meet under the burning line (mixed premultiplied)
130
+ float m = smoothstep(-0.5 * w, 0.5 * w, k);
131
+ vec4 c = mix(vec4(b.rgb * b.a, b.a), vec4(a.rgb * a.a, a.a), m);
132
+ if (c.a <= 0.0) return vec4(0.0);
133
+ vec3 col = c.rgb / c.a;
134
+
135
+ // turbulence rising in screen space, stretched upward and swaying into pointed tongues
136
+ vec2 f = vec2(q.x * mix(10.0, 6.0, abs(dir.x)), q.y * mix(1.8, 3.2, abs(dir.x)) - t * 2.4);
137
+ float sway = fbm(vec2(q.x * 2.5, q.y * 1.5 - t * 1.2));
138
+ float n = fbm(f + vec2(1.5 * sway - 0.75, 0.0));
139
+ n = clamp(1.7 * n - 0.35, 0.0, 1.0);
140
+ // a continuous hot core hugging the base of the flames
141
+ float core = (1.0 - smoothstep(0.0, 0.35 * lineWidth, abs(k + 0.4 * w * (sway - 0.5)))) * burn * (1.0 - 0.5 * abs(dir.x));
142
+ // under the flames, where they take root, the turbulence calms down into a soft glow
143
+ float root = rise > 0.0 ? clamp(-k / w, 0.0, 1.0) : rise < 0.0 ? clamp(k / w, 0.0, 1.0) : 0.0;
144
+ root *= abs(dir.y);
145
+ float flame = clamp(heat * 0.95 + 0.45 * core * (0.75 + 0.25 * n) - (1.0 - n) * 1.1 * (1.0 - 0.8 * root), 0.0, 1.0);
146
+
147
+ // the flames darken what is behind their body and add their light, with a soft halo;
148
+ // the alpha stays the image's
149
+ // crisp around the tongues, soft at their roots
150
+ float body = smoothstep(0.0, 0.08 + 0.5 * root, flame);
151
+ col = col * (1.0 - 0.7 * body) + fire(flame) * (0.45 + 0.65 * flame) * body;
152
+ col += color * 0.25 * heat * heat * (1.0 - body);
153
+ return vec4(clamp(col, 0.0, 1.0), c.a);
154
+ }
@@ -0,0 +1,97 @@
1
+ // GooeyWipe — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/GooeyWipe.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: Soft, glossy blobs of liquid pop up over the outgoing image, swell and melt into each other, revealing the incoming image until they cover the whole frame
5
+ // Tags: blob, liquid, organic, reveal
6
+
7
+ // @range(2, 12, 1) Number of blobs across the frame
8
+ uniform float blobs; // = 5.0
9
+ // @range(0, 1) How smoothly neighbouring blobs melt into each other
10
+ uniform float smoothness; // = 0.5
11
+ // @color Color of the glossy highlight on the rim of the blobs (its alpha is its strength)
12
+ uniform vec4 highlight; // = vec4(1.0, 1.0, 1.0, 0.7)
13
+ // @color Color of the soft shadow that the blobs cast on the outgoing image
14
+ uniform vec4 shadow; // = vec4(0.0, 0.0, 0.0, 0.3)
15
+
16
+ float hash (vec2 p) {
17
+ vec3 p3 = fract(vec3(p.xyx) * 0.1031);
18
+ p3 += dot(p3, p3.yzx + 33.33);
19
+ return fract((p3.x + p3.y) * p3.z);
20
+ }
21
+
22
+ vec2 fold (vec2 p) {
23
+ return 1.0 - abs(1.0 - mod(p, 2.0));
24
+ }
25
+
26
+ // signed distance to the blob of a grid cell (in cells), its center returned in .yz
27
+ vec3 blob (vec2 cell, float rStart, float rEnd) {
28
+ vec2 c = cell + 0.5 + 0.7 * (vec2(hash(cell + 0.5), hash(cell + 41.3)) - 0.5);
29
+ float t0 = 0.02 + 0.43 * hash(cell + 17.9); // when it pops up
30
+ float s = clamp((progress - t0) / (1.0 - t0), 0.0, 1.0);
31
+ // it pops up fast with a little wobble, then swells slowly
32
+ float pop = clamp((progress - t0) / 0.12, 0.0, 1.0);
33
+ pop = 1.0 - (1.0 - pop) * (1.0 - pop) * (1.0 - pop);
34
+ float r = mix(rStart, 0.18, pop) + (rEnd - 0.18) * s * sqrt(s);
35
+ r += 0.05 * sin(pop * 9.0) * (1.0 - s) * pop;
36
+ return vec3(r, c);
37
+ }
38
+
39
+ vec4 transition (vec2 uv) {
40
+ float n = max(1.0, floor(blobs + 0.5));
41
+ float cellSize = max(ratio, 1.0) / n;
42
+ vec2 q = vec2(uv.x * ratio, uv.y) / cellSize; // in cells
43
+ vec2 base = floor(q);
44
+ float k = 0.02 + 0.25 * smoothness; // melting distance, in cells
45
+ float w = 0.16; // width of the rounded rim, in cells
46
+ // a blob starts far enough below the surface not to show (the union of 49 blobs bulges by up to k * log(49)),
47
+ // and ends up covering the whole of its cell (its center is at most 0.85 * sqrt(2) cells away) and its rim
48
+ float rStart = -(0.03 + 4.0 * k);
49
+ float rEnd = 0.85 * sqrt(2.0) + w + 0.05;
50
+ // smooth union (log-sum-exp, computed online) of the blobs around, with its gradient;
51
+ // blobs further than 3 cells away weigh less than exp(-7) and are left out
52
+ float m = 1e3; // distance to the nearest blob
53
+ float sum = 0.0;
54
+ vec2 grad = vec2(0.0);
55
+ float rNear = 0.0; // radius of the nearest blob
56
+ for (int j = -3; j <= 3; j++) {
57
+ for (int i = -3; i <= 3; i++) {
58
+ vec3 b = blob(base + vec2(float(i), float(j)), rStart, rEnd);
59
+ vec2 dq = q - b.yz;
60
+ float l = length(dq);
61
+ float dist = l - b.x;
62
+ vec2 g = dq / max(l, 1e-4);
63
+ if (dist < m) {
64
+ float scale = exp((dist - m) / k);
65
+ sum = sum * scale + 1.0;
66
+ grad = grad * scale + g;
67
+ m = dist;
68
+ rNear = b.x;
69
+ } else {
70
+ float wt = exp((m - dist) / k);
71
+ sum += wt;
72
+ grad += wt * g;
73
+ }
74
+ }
75
+ }
76
+ float d = m - k * log(sum); // < 0 inside the goo
77
+ grad /= sum;
78
+ float aa = 0.012 * n / 5.0;
79
+ float inside = 1.0 - smoothstep(-aa, aa, d);
80
+ // a rounded, glossy surface near the edge, flat further inside; the goo settles flat at the end
81
+ float h = clamp(-d / w, 0.0, 1.0);
82
+ float settle = 1.0 - smoothstep(0.45, 0.85, progress);
83
+ float tilt = (1.0 - h) * (1.0 - h) * settle;
84
+ vec3 nrm = normalize(vec3(grad * tilt * 3.0, 1.0));
85
+ vec3 halfway = normalize(vec3(-0.35, 0.45, 1.0) + vec3(0.0, 0.0, 1.0));
86
+ float spec = pow(max(dot(nrm, halfway), 0.0), 200.0) * settle;
87
+ // thick, opaque goo: darker toward its edge, more so on the side away from the light
88
+ float shade = 1.0 - tilt * (0.25 + 0.3 * clamp(dot(grad, vec2(0.6, -0.8)) + 0.3, 0.0, 1.0));
89
+ vec4 to = getToColor(fold(uv - grad * tilt * 0.01 * cellSize / vec2(ratio, 1.0)));
90
+ float t2 = tilt * tilt;
91
+ float gloss = 0.3 * t2 * t2; // a thin bright line right on the rim
92
+ to.rgb = mix(to.rgb * shade, highlight.rgb, clamp(spec + gloss, 0.0, 1.0) * highlight.a);
93
+ vec4 from = getFromColor(uv);
94
+ float sh = shadow.a * (1.0 - smoothstep(0.0, 0.15, d + 0.03)) * smoothstep(0.0, 0.3, rNear);
95
+ from.rgb = mix(from.rgb, shadow.rgb, sh);
96
+ return mix(from, to, inside);
97
+ }
@@ -0,0 +1,96 @@
1
+ // InkBleed — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/InkBleed.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The incoming image spreads over the outgoing one like drops of ink in water, blooming from a few points with curling, wispy edges and a darker rim, until it fills the frame
5
+ // Tags: ink, organic, fluid, noise
6
+
7
+ // @range(1, 8, 1) Number of ink drops
8
+ uniform float drops; // = 4.0
9
+ // @range(0, 1) How far the curling tendrils reach out of the blooms
10
+ uniform float tendrils; // = 0.7
11
+ // @range(0, 1) How dark the rim of ink at the front of the blooms is
12
+ uniform float rim; // = 0.5
13
+ // @param Random seed for the drop positions and the swirls
14
+ uniform float seed; // = 3.0
15
+
16
+ float hash (vec2 p) {
17
+ vec3 p3 = fract(vec3(p.xyx) * 0.1031);
18
+ p3 += dot(p3, p3.yzx + 33.33);
19
+ return fract((p3.x + p3.y) * p3.z);
20
+ }
21
+
22
+ float vnoise (vec2 p) {
23
+ vec2 i = floor(p);
24
+ vec2 f = fract(p);
25
+ f = f * f * (3.0 - 2.0 * f);
26
+ return mix(
27
+ mix(hash(i), hash(i + vec2(1.0, 0.0)), f.x),
28
+ mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), f.x),
29
+ f.y
30
+ );
31
+ }
32
+
33
+ float fbm (vec2 p) {
34
+ float v = 0.0;
35
+ float a = 0.5;
36
+ for (int i = 0; i < 4; i++) {
37
+ v += a * vnoise(p);
38
+ p = mat2(1.6, 1.2, -1.2, 1.6) * p + 7.3;
39
+ a *= 0.5;
40
+ }
41
+ return v / 0.9375;
42
+ }
43
+
44
+ vec2 fold (vec2 p) {
45
+ return 1.0 - abs(1.0 - mod(p, 2.0));
46
+ }
47
+
48
+ vec4 transition (vec2 uv) {
49
+ float p = progress;
50
+ vec2 q = vec2(uv.x * ratio, uv.y);
51
+ // swirls: noise warped twice by itself, drifting as the ink spreads
52
+ vec2 o = vec2(seed * 3.1, seed * 1.7);
53
+ vec2 sq = q * 2.2 + o;
54
+ vec2 w1 = vec2(fbm(sq + vec2(0.0, 0.6 * p)), fbm(sq + vec2(5.2, 1.3) - vec2(0.5 * p, 0.0)));
55
+ vec2 w2 = vec2(fbm(sq + 3.0 * w1 + vec2(1.7, 9.2)), fbm(sq + 3.0 * w1 + vec2(8.3, 2.8)));
56
+ float swirl = fbm(sq * 0.8 + 2.5 * w2) - 0.5; // marbled, curling pattern
57
+ vec2 flow = w2 - 0.5;
58
+ float amp = 0.05 + 0.35 * tendrils;
59
+ float n = clamp(floor(drops + 0.5), 1.0, 8.0);
60
+ float rimW = 0.1;
61
+ float feather = 0.05; // soft, diluted ink around the front
62
+ float margin = 1.2 * amp + rimW + 0.08; // how far the swirls can pull the front back
63
+ float f = -1e3; // > 0 inside the ink
64
+ float fs = -1e3; // the same, only for the drops already fallen, which fades their haze in
65
+ for (int i = 0; i < 8; i++) {
66
+ float fi = float(i);
67
+ if (fi < n) {
68
+ vec2 hs = vec2(fi * 7.13 + seed, fi * 3.71 - seed);
69
+ vec2 c = vec2(mix(0.15, 0.85, hash(hs)) * ratio, mix(0.15, 0.85, hash(hs + 19.7)));
70
+ float start = 0.2 * fi / n;
71
+ float s = clamp((p - start) / (1.0 - start), 0.0, 1.0);
72
+ // distance to the farthest corner: each bloom alone covers the frame in the end
73
+ vec2 m = max(c, vec2(ratio, 1.0) - c);
74
+ float far = length(m) + margin;
75
+ float s3 = s * s * s;
76
+ float r = (far + 0.02) * s * (0.35 + 0.65 * s3 * s3) - 0.02;
77
+ // a drop starts round, then its front curls more and more as it spreads
78
+ float reach = amp * min(1.0, max(r, 0.0) * 5.0);
79
+ float g = r - length(q - c + 1.3 * reach * flow) + reach * 0.9 * swirl;
80
+ f = max(f, g);
81
+ fs = max(fs, g - 0.15 * (1.0 - min(1.0, s * 12.0)));
82
+ }
83
+ }
84
+ float aa = 0.003;
85
+ float inside = smoothstep(-aa, aa, f);
86
+ // feathered wisps of diluted ink, streaked along the swirls, ahead of the front
87
+ float wisp = 1.0 - smoothstep(0.0, 0.08, abs(fbm(sq * 2.0 + 5.0 * w2) - 0.5));
88
+ float soft = smoothstep(-feather, 0.0, fs) * (0.35 + 0.4 * wisp);
89
+ float haze = 0.35 * wisp * (1.0 - smoothstep(0.0, 0.1, -fs));
90
+ float cover = max(inside, max(soft, haze));
91
+ // the ink is denser, and still moving, close to its front
92
+ float edge = 1.0 - smoothstep(0.0, rimW, f);
93
+ vec4 to = getToColor(fold(uv - 0.015 * edge * flow / vec2(ratio, 1.0)));
94
+ to.rgb = mix(to.rgb, to.rgb * to.rgb * 0.7, rim * edge);
95
+ return mix(getFromColor(uv), to, cover);
96
+ }
@@ -0,0 +1,125 @@
1
+ // LensFlare — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/LensFlare.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: A bright light sweeps across the frame and flares the lens: a long thin horizontal streak, a glowing core and a trail of colored ghost reflections; at its peak the incoming image spreads out from the light under its glare
5
+ // Tags: light, flare, glow, streak
6
+
7
+ // @range(-90, 90) Angle of the path of the light, in degrees (0 sweeps from left to right)
8
+ uniform float angle; // = -12.0
9
+ // @range(-0.5, 0.5) How far above the center of the frame the light passes
10
+ uniform float height; // = 0.18
11
+ // @range(0, 2) Brightness of the flare
12
+ uniform float intensity; // = 1.0
13
+ // @color Color of the streak and of the glare
14
+ uniform vec3 color; // = vec3(0.35, 0.6, 1.0)
15
+
16
+ const int BLOOM_TAPS = 12;
17
+ const int GHOSTS = 6;
18
+
19
+ // mirror the coordinates back into the frame
20
+ vec2 mirror(vec2 v) {
21
+ return 1.0 - abs(1.0 - mod(v, 2.0));
22
+ }
23
+
24
+ vec4 premultiplied(vec4 c) {
25
+ return vec4(c.rgb * c.a, c.a);
26
+ }
27
+
28
+ // the image on screen (premultiplied): the outgoing one, then the incoming one after the cut
29
+ vec4 frame(vec2 st, float m) {
30
+ if (m <= 0.0) return premultiplied(getFromColor(st));
31
+ if (m >= 1.0) return premultiplied(getToColor(st));
32
+ return mix(premultiplied(getFromColor(st)), premultiplied(getToColor(st)), m);
33
+ }
34
+
35
+ // the light of a pixel (premultiplied): its color above a knee
36
+ vec3 highlight(vec4 c) {
37
+ float lum = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722));
38
+ return c.rgb * smoothstep(0.55, 0.95, lum);
39
+ }
40
+
41
+ vec4 transition(vec2 uv) {
42
+ float p = progress;
43
+ if (p <= 0.0) return getFromColor(uv);
44
+ if (p >= 1.0) return getToColor(uv);
45
+
46
+ // 0 at both ends, 1 at the peak
47
+ float env = 4.0 * p * (1.0 - p);
48
+ float peak = pow(env, 24.0);
49
+ // frame coordinates, centered, with square units
50
+ vec2 aspect = vec2(ratio, 1.0);
51
+ vec2 q = (uv - 0.5) * aspect;
52
+ float r = radians(angle);
53
+ vec2 dir = vec2(cos(r), -sin(r));
54
+ vec2 normal = vec2(-dir.y, dir.x);
55
+ // the light crosses the frame, slowing down as it passes the middle
56
+ float t = p - 0.5;
57
+ float travel = 0.5 * (abs(dir.x) * ratio + abs(dir.y)) + 0.3;
58
+ float along = travel * (2.0 * t) * (0.55 + 1.8 * t * t);
59
+ vec2 src = dir * along + normal * height;
60
+
61
+ vec2 d = q - src;
62
+ float dist = length(d);
63
+ float k = intensity * env;
64
+
65
+ // the cut, under the glare: the incoming image spreads out from the light in a soft circle,
66
+ // slower as the flare gets dimmer so that it still reads as intended
67
+ float cut = mix(0.2, 0.06, clamp(intensity, 0.0, 1.0));
68
+ float s = clamp((p - 0.5 + cut) / (2.0 * cut), 0.0, 1.0);
69
+ float soft = 0.3;
70
+ float reach = 0.5 * length(aspect) + length(src) + soft;
71
+ float front = s * (reach + soft);
72
+ float m = smoothstep(front, front - soft, dist);
73
+ vec4 base = frame(uv, m);
74
+
75
+ // the anamorphic streak: long and thin, always horizontal, white at the center and tinted along
76
+ float ax = abs(d.x);
77
+ float ay = abs(d.y);
78
+ float thin = exp(-ay * 140.0) * exp(-ax * 0.7);
79
+ float wide = exp(-ay * 30.0) * exp(-ax * 1.6);
80
+ vec3 tint = color;
81
+ vec3 streak = (thin * mix(vec3(1.0), tint, smoothstep(0.0, 0.3, ax)) + 0.5 * wide * tint) * 3.0;
82
+
83
+ // the core and its halo
84
+ vec3 core = vec3(1.0, 0.97, 0.92) * exp(-dist * dist * 600.0) * 3.0 + mix(vec3(1.0), tint, 0.5) * exp(-dist * 7.0) * 0.6;
85
+
86
+ // ghosts on the line from the light through the center of the frame
87
+ vec3 ghosts = vec3(0.0);
88
+ for (int i = 0; i < GHOSTS; i++) {
89
+ float fi = float(i);
90
+ float f = -0.45 + 0.42 * fi + 0.08 * sin(fi * 2.3);
91
+ vec2 g = -src * f;
92
+ float size = 0.025 + 0.06 * fract(fi * 0.618 + 0.2);
93
+ float gd = length(q - g) / size;
94
+ // a soft disc with a brighter rim
95
+ float disc = smoothstep(1.0, 0.8, gd) * (0.35 + 0.65 * smoothstep(0.4, 0.95, gd));
96
+ vec3 hue = mix(tint, vec3(1.0, 0.65, 0.35), fract(fi * 0.53));
97
+ hue = mix(hue, vec3(0.5, 1.0, 0.6), step(4.5, fi) * 0.6);
98
+ ghosts += disc * hue * 0.45;
99
+ }
100
+
101
+ // the highlights of the image bloom at the peak
102
+ vec3 bloom = vec3(0.0);
103
+ if (peak > 1e-3) {
104
+ float radius = 0.06 * env;
105
+ for (int i = 0; i < BLOOM_TAPS; i++) {
106
+ float fi = float(i);
107
+ float a = fi * 2.39996;
108
+ float rr = radius * sqrt((fi + 0.5) / float(BLOOM_TAPS));
109
+ vec2 o = vec2(cos(a), sin(a)) * rr / aspect;
110
+ bloom += highlight(frame(mirror(uv + o), m));
111
+ }
112
+ bloom /= float(BLOOM_TAPS);
113
+ }
114
+
115
+ // at the peak, the glare: a wide halo around the light and a light veil over the frame, to hide the cut
116
+ vec3 glare = mix(vec3(1.0), tint, 0.5) * peak * (0.45 + 2.2 * exp(-dist * 3.0));
117
+
118
+ vec3 light = k * (streak + core + ghosts) + intensity * (bloom * 2.5 * peak + glare);
119
+ light = 1.0 - exp(-light);
120
+
121
+ // screened over the image; the flare only shows on the image, so transparency is kept
122
+ vec3 c = base.rgb + light * base.a - base.rgb * light;
123
+ if (base.a <= 0.0) return vec4(0.0);
124
+ return vec4(clamp(c / base.a, 0.0, 1.0), base.a);
125
+ }
@@ -0,0 +1,106 @@
1
+ // LightRays — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/LightRays.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: Shafts of light burst from the highlights of the outgoing image and stream outward from a slowly drifting center; at their peak the incoming image takes over and its own rays shrink back into its highlights
5
+ // Tags: light, glow, rays, radial
6
+
7
+ // @param Point the rays stream away from, at the middle of the transition
8
+ uniform vec2 center; // = vec2(0.5, 0.6)
9
+ // @range(0, 0.5) How far the center drifts during the transition, from left to right
10
+ uniform float drift; // = 0.15
11
+ // @range(0, 1) Length of the rays at the peak, as a fraction of their distance to the center
12
+ uniform float reach; // = 0.6
13
+ // @range(0, 0.8) Brightness above which the image casts rays
14
+ uniform float threshold; // = 0.65
15
+ // @range(0, 4) Brightness of the rays
16
+ uniform float intensity; // = 1.5
17
+ // @color Tint of the rays, toward their ends
18
+ uniform vec3 tint; // = vec3(1.0, 0.82, 0.55)
19
+
20
+ const int TAPS = 20;
21
+ // number of shafts around the center
22
+ const float SHAFTS = 23.0;
23
+ const float PI = 3.141592653589793;
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
+ // smooth noise around the center, wrapping over a full turn (t in 0..1)
32
+ float shaftNoise(float t, float n, float seed) {
33
+ float x = t * n;
34
+ float i = floor(x);
35
+ float f = x - i;
36
+ float a = hash12(vec2(mod(i, n), seed));
37
+ float b = hash12(vec2(mod(i + 1.0, n), seed));
38
+ return mix(a, b, f * f * (3.0 - 2.0 * f));
39
+ }
40
+
41
+ // mirror the coordinates back into the frame
42
+ vec2 mirror(vec2 v) {
43
+ return 1.0 - abs(1.0 - mod(v, 2.0));
44
+ }
45
+
46
+ // the light of a pixel (premultiplied): its color above the threshold
47
+ vec3 glow(vec4 c, float knee) {
48
+ float lum = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722));
49
+ return c.rgb * c.a * smoothstep(knee, knee + 0.2, lum);
50
+ }
51
+
52
+ // the light at a ray tap: one image, or both during the short switch
53
+ vec3 light(vec2 st, float knee, float m) {
54
+ if (m <= 0.0) return glow(getFromColor(st), knee);
55
+ if (m >= 1.0) return glow(getToColor(st), knee);
56
+ return mix(glow(getFromColor(st), knee), glow(getToColor(st), knee), m);
57
+ }
58
+
59
+ vec4 transition(vec2 uv) {
60
+ float p = progress;
61
+ // the rays grow on the outgoing image, and shrink back into the incoming one
62
+ float amount = p < 0.5 ? smoothstep(0.0, 0.5, p) : 1.0 - smoothstep(0.5, 1.0, p);
63
+ float peak = amount * amount * amount;
64
+ float m = smoothstep(0.46, 0.54, p);
65
+ vec4 fromColor = getFromColor(uv);
66
+ vec4 toColor = getToColor(uv);
67
+ if (amount <= 0.0) return m < 0.5 ? fromColor : toColor;
68
+
69
+ // the rays stream away from a center drifting slowly across the frame
70
+ vec2 origin = center + vec2(drift * (p - 0.5), 0.0);
71
+ float len = reach * amount;
72
+ // more and more of the image catches the light as the rays grow
73
+ float knee = mix(threshold, 0.75 * threshold, peak);
74
+ // a small shift of the taps, under their spacing, blends them into smooth shafts;
75
+ // hashed by integer cell so that every GPU computes the same shift
76
+ float jitter = hash12(floor(uv * vec2(ratio, 1.0) * 997.0));
77
+
78
+ // the light gathered on the way to the center, fading with the distance it travels
79
+ vec3 rays = vec3(0.0);
80
+ float total = 0.0;
81
+ for (int i = 0; i < TAPS; i++) {
82
+ float s = (float(i) + jitter) / float(TAPS);
83
+ float w = exp(-2.0 * s);
84
+ // warm white near the sources, tinted further along the rays
85
+ vec3 hue = mix(vec3(1.0), tint, smoothstep(0.0, 0.6, s));
86
+ rays += w * hue * light(mirror(mix(uv, origin, s * len)), knee, m);
87
+ total += w;
88
+ }
89
+ // the light breaks into shafts of different strengths, slowly turning
90
+ vec2 d = (uv - origin) * vec2(ratio, 1.0);
91
+ // atan is undefined at the center itself
92
+ float turn = length(d) > 1e-6 ? atan(d.y, d.x) / (2.0 * PI) + 0.5 : 0.0;
93
+ float shafts = 0.6 * shaftNoise(fract(turn + 0.03 * p), SHAFTS, 1.0) + 0.4 * shaftNoise(fract(turn - 0.05 * p), 2.0 * SHAFTS + 1.0, 7.0);
94
+ // merged back into a soft glow close to the center, where the shafts would meet in a point
95
+ rays *= mix(1.0, mix(0.2, 1.6, smoothstep(0.15, 0.85, shafts)), smoothstep(0.0, 0.3, length(d)));
96
+ rays *= intensity * amount * (1.0 + 3.0 * peak) / total;
97
+ // compressed, so that bright areas never flatten into white
98
+ rays = 0.9 * (1.0 - exp(-rays));
99
+
100
+ // the image stays sharp, with a slight lift of the exposure at the peak; the rays are screened
101
+ // on top of its colors and add nothing to its alpha
102
+ vec4 c = mix(vec4(fromColor.rgb * fromColor.a, fromColor.a), vec4(toColor.rgb * toColor.a, toColor.a), m);
103
+ if (c.a <= 0.0) return vec4(0.0);
104
+ vec3 base = min(c.rgb / c.a * (1.0 + 0.2 * peak), 1.0);
105
+ return vec4(base + rays - base * rays, c.a);
106
+ }