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,117 @@
1
+ // LightStreaks — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/LightStreaks.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The highlights of the outgoing image flare into long horizontal (or vertical) lens streaks while it smears with motion blur; at the peak the incoming image takes over and its streaks shrink back into its highlights as it sharpens
5
+ // Tags: light, flare, motion-blur, glow
6
+
7
+ // @range(0, 2) Length of the streaks at the peak, in frame widths
8
+ uniform float reach; // = 0.6
9
+ // @range(0, 1) Brightness above which the image flares
10
+ uniform float threshold; // = 0.7
11
+ // @range(0, 4) Brightness of the streaks
12
+ uniform float intensity; // = 1.5
13
+ // @color Tint of the streaks, toward their ends
14
+ uniform vec3 tint; // = vec3(0.45, 0.7, 1.0)
15
+ // @range(0, 0.5) Length of the motion blur at the peak
16
+ uniform float blur; // = 0.1
17
+ // @param Streak and smear vertically instead
18
+ uniform bool vertical; // = false
19
+
20
+ const int BLUR_TAPS = 6;
21
+ // taps on each side of a streak, spaced further and further apart along its falloff
22
+ const int STREAK_TAPS = 11;
23
+
24
+ float hash12(vec2 v) {
25
+ vec3 v3 = fract(vec3(v.xyx) * 0.1031);
26
+ v3 += dot(v3, v3.yzx + 33.33);
27
+ return fract((v3.x + v3.y) * v3.z);
28
+ }
29
+
30
+ // mirror the coordinates back into the frame
31
+ vec2 mirror(vec2 v) {
32
+ return 1.0 - abs(1.0 - mod(v, 2.0));
33
+ }
34
+
35
+ // the image on screen: the outgoing one, then the incoming one after a short switch
36
+ vec4 frame(vec2 st, float m) {
37
+ if (m <= 0.0) return getFromColor(st);
38
+ if (m >= 1.0) return getToColor(st);
39
+ return mix(getFromColor(st), getToColor(st), m);
40
+ }
41
+
42
+ // the light of a pixel: its color above the threshold
43
+ vec3 glow(vec4 c, float knee) {
44
+ float lum = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722));
45
+ return c.rgb * c.a * smoothstep(knee, knee + 0.2, lum);
46
+ }
47
+
48
+ // one image only, for the blur and streak taps: during the switch, every other tap reads each image
49
+ vec4 light(vec2 st, float m, bool incoming) {
50
+ if (m <= 0.0) return getFromColor(st);
51
+ if (m >= 1.0) return getToColor(st);
52
+ return incoming ? getToColor(st) : getFromColor(st);
53
+ }
54
+
55
+ float lightWeight(float m, bool incoming) {
56
+ if (m <= 0.0 || m >= 1.0) return 1.0;
57
+ return incoming ? 2.0 * m : 2.0 * (1.0 - m);
58
+ }
59
+
60
+ vec4 transition(vec2 uv) {
61
+ float p = progress;
62
+ // eased in on the outgoing side, and quickly out after the switch so the incoming image lands sharp
63
+ float amount = p < 0.5 ? smoothstep(0.0, 0.5, p) : pow(2.0 - 2.0 * p, 3.0);
64
+ float peak = amount * amount * amount;
65
+ float m = smoothstep(0.44, 0.56, p);
66
+ vec2 axis = vertical ? vec2(0.0, 1.0) : vec2(1.0, 0.0);
67
+ // a small shift of the taps, under their spacing, blends their copies into a smooth smear;
68
+ // hashed by integer cell so that every GPU computes the same shift
69
+ float jitter = hash12(floor(uv * vec2(ratio, 1.0) * 997.0)) - 0.5;
70
+
71
+ // the image smears along the streaks (a tent filter)
72
+ float smear = blur * amount;
73
+ vec3 base = vec3(0.0);
74
+ float alpha = 0.0;
75
+ float total = 0.0;
76
+ for (int i = 0; i < BLUR_TAPS; i++) {
77
+ float t = (float(i) + 0.5 + jitter) / float(BLUR_TAPS) - 0.5;
78
+ float w = 1.0 - abs(t);
79
+ total += w;
80
+ bool incoming = mod(float(i), 2.0) > 0.5;
81
+ w *= lightWeight(m, incoming);
82
+ vec4 c = light(mirror(uv + axis * t * smear), m, incoming);
83
+ base += w * c.rgb * c.a;
84
+ alpha += w * c.a;
85
+ }
86
+ base /= total;
87
+ alpha /= total;
88
+
89
+ // the streaks: the light above the threshold, spread along the axis with an exponential falloff
90
+ float falloff = 0.25 * reach * amount;
91
+ float knee = mix(threshold, 0.8 * threshold, peak);
92
+ vec3 streak = glow(frame(uv, m), knee);
93
+ float weights = 1.0;
94
+ for (int k = 1; k <= STREAK_TAPS; k++) {
95
+ // the distance in units of the falloff, and the stretch of the streak this tap stands for
96
+ float d = exp(0.14 * (float(k) + 0.8 * jitter)) - 1.0;
97
+ float span = 0.14 * (d + 1.0);
98
+ // white at the source, tinted along the streak, red fading first so the tails turn blue and violet
99
+ vec3 hue = mix(vec3(1.0), tint, smoothstep(0.0, 0.8, d));
100
+ hue *= exp(-d * vec3(0.6, 0.2, -0.15));
101
+ float w = exp(-d) * span * 4.0;
102
+ bool incoming = mod(float(k), 2.0) > 0.5;
103
+ vec4 ahead = light(mirror(uv + axis * d * falloff), m, incoming);
104
+ vec4 behind = light(mirror(uv - axis * d * falloff), m, !incoming);
105
+ streak += w * hue * (glow(ahead, knee) * lightWeight(m, incoming) + glow(behind, knee) * lightWeight(m, !incoming));
106
+ weights += 2.0 * w;
107
+ }
108
+ streak *= intensity * amount * (0.6 + 2.4 * peak) * 2.0 / weights;
109
+ // compressed, so that bright skies never flatten into white
110
+ streak = 0.85 * (1.0 - exp(-streak));
111
+
112
+ // a lift of the exposure at the peak, then the streaks screened on top (premultiplied colors)
113
+ base = min(base * (1.0 + 0.2 * peak), vec3(alpha));
114
+ vec3 color = base + streak - base * streak;
115
+ float a = alpha + max(streak.r, max(streak.g, streak.b)) * (1.0 - alpha);
116
+ return vec4(clamp(color / max(a, 1e-5), 0.0, 1.0), a);
117
+ }
@@ -0,0 +1,89 @@
1
+ // LightWipe — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/LightWipe.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: A band of intense light sweeps across the frame like a glint on glass, blooming the highlights of both images, and leaves the incoming image behind it
5
+ // Tags: wipe, light, glow, glint
6
+
7
+ // @param Direction the band of light moves toward
8
+ uniform vec2 direction; // = vec2(1.0, -0.35)
9
+ // @range(0.005, 0.2) Width of the bright core of the band, in frame heights
10
+ uniform float width; // = 0.04
11
+ // @range(0, 3) Brightness of the light
12
+ uniform float intensity; // = 1.2
13
+ // @color Tint of the light, toward the edges of the band (its core burns white)
14
+ uniform vec3 color; // = vec3(1.0, 0.86, 0.66)
15
+
16
+ const int TAPS = 12;
17
+
18
+ // mirror the coordinates back into the frame
19
+ vec2 mirror(vec2 v) {
20
+ return 1.0 - abs(1.0 - mod(v, 2.0));
21
+ }
22
+
23
+ // a gentle ease in and out, which does not linger at the ends
24
+ float ease(float t) {
25
+ return 0.5 * (t + t * t * (3.0 - 2.0 * t));
26
+ }
27
+
28
+ // the image on screen at a point: the outgoing one ahead of the switch, the incoming one behind it
29
+ // (both always sampled, so that no texture read sits in a branch that differs between pixels)
30
+ vec4 frame(vec2 st, float m) {
31
+ return mix(getFromColor(st), getToColor(st), m);
32
+ }
33
+
34
+ // the light of a pixel (premultiplied): its color above a soft knee
35
+ vec3 highlight(vec4 c) {
36
+ float lum = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722));
37
+ return c.rgb * c.a * smoothstep(0.45, 1.0, lum);
38
+ }
39
+
40
+ vec4 transition(vec2 uv) {
41
+ vec2 dir = length(direction) > 0.0 ? normalize(direction) : vec2(1.0, 0.0);
42
+ vec2 p = (uv - 0.5) * vec2(ratio, 1.0);
43
+ // half extent of the frame along the direction
44
+ float e = 0.5 * (abs(dir.x) * ratio + abs(dir.y));
45
+ float w = max(width, 0.001);
46
+ float s = 0.35 * w;
47
+ // the band starts and ends outside of the frame, with the switch out of sight
48
+ float margin = s + 2.0 * w;
49
+ float pos = -e - margin + 2.0 * (e + margin) * ease(progress);
50
+ // signed distance to the middle of the band: < 0 has been swept
51
+ float d = dot(p, dir) - pos;
52
+ float m = 1.0 - smoothstep(-s, s, d);
53
+
54
+ // the light ignites as it enters and dies away as it leaves: exactly none at both ends
55
+ float env = smoothstep(0.0, 0.2, progress) * (1.0 - smoothstep(0.8, 1.0, progress));
56
+ // a hot core, a thinner glint trailing behind it, and a wide soft halo
57
+ float core = exp(-d * d / (w * w));
58
+ float g = (d + 2.2 * w) / (0.3 * w);
59
+ float glint = 0.45 * exp(-g * g);
60
+ float halo = 0.35 * exp(-abs(d) / (5.0 * w));
61
+ float band = (core + glint + halo) * env * intensity;
62
+ // the moving glint itself, where the highlights bloom
63
+ float glow = (core + glint) * env * intensity;
64
+
65
+ vec4 c = frame(uv, m);
66
+
67
+ // the highlights near the band bloom along it: taps across the band, sampled where the band is brightest
68
+ vec3 bloom = vec3(0.0);
69
+ // spread over the band, short enough that its taps blend into a smooth glow
70
+ float spread = min(3.0 * w, 0.12);
71
+ for (int i = 0; i < TAPS; i++) {
72
+ float t = (float(i) + 0.5) / float(TAPS) * 2.0 - 1.0;
73
+ vec2 st = mirror((p + dir * (t * spread)) / vec2(ratio, 1.0) + 0.5);
74
+ // the image on screen where the tap reads, on the same side of the switch
75
+ float dq = dot((st - 0.5) * vec2(ratio, 1.0), dir) - pos;
76
+ bloom += (1.0 - abs(t)) * highlight(frame(st, 1.0 - smoothstep(-s, s, dq)));
77
+ }
78
+ // the sum of the tent weights
79
+ bloom /= 0.5 * float(TAPS);
80
+
81
+ // white at the heart of the core, tinted toward the edges of the band
82
+ vec3 hue = mix(color, vec3(1.0), core * core);
83
+ float lum = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722));
84
+ // the light lifts the image, the bright parts more: exposure that rolls off softly to white, never clipping
85
+ vec3 light = hue * band * (0.3 + 0.9 * lum) + hue * bloom * glow * 4.0 + hue * core * env * intensity * 1.6;
86
+ vec3 rgb = 1.0 - (1.0 - c.rgb) * exp(-light);
87
+ // light adds to the image, not to its alpha
88
+ return vec4(rgb, c.a);
89
+ }
@@ -0,0 +1,59 @@
1
+ // PhotoDevelop — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/PhotoDevelop.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The outgoing image washes out to a blank cream card, then the incoming image develops on it like an instant photo: shadows first, faint and tinted, then its contrast and colors come up and it settles
5
+ // Tags: fade, color, photo, retro
6
+
7
+ // @color Color of the blank card between the two images
8
+ uniform vec4 card; // = vec4(0.93, 0.91, 0.85, 1.0)
9
+ // @range(0, 1) How long the outgoing image takes to wash out (from 10% to 70% of the transition)
10
+ uniform float wash; // = 0.35
11
+ // @range(0, 1) Strength of the cyan and magenta cast while the image develops
12
+ uniform float tint; // = 0.8
13
+
14
+ vec3 saturation(vec3 c, float s) {
15
+ float lum = dot(c, vec3(0.2126, 0.7152, 0.0722));
16
+ return mix(vec3(lum), c, s);
17
+ }
18
+
19
+ vec4 transition(vec2 uv) {
20
+ vec4 a = getFromColor(uv);
21
+ vec4 b = getToColor(uv);
22
+ float p = progress;
23
+ if (p <= 0.0) return a;
24
+ if (p >= 1.0) return b;
25
+
26
+ // the card only shows where the images are: it takes the alpha of the outgoing image, then the incoming one's
27
+ float split = mix(0.1, 0.7, clamp(wash, 0.0, 1.0));
28
+ float cardAlpha = card.a * mix(a.a, b.a, smoothstep(0.6 * split, split + 0.1, p));
29
+ vec3 cardColor = card.rgb * cardAlpha;
30
+
31
+ // the outgoing image fades and loses its contrast into the card, its lights first
32
+ float w = smoothstep(0.0, split, p);
33
+ float fromLum = dot(a.rgb, vec3(0.2126, 0.7152, 0.0722));
34
+ float wl = clamp(w * (1.0 + 0.5 * fromLum), 0.0, 1.0);
35
+ vec3 washed = mix(a.rgb, mix(vec3(fromLum), a.rgb, 0.4), w) * a.a;
36
+ vec3 outgoing = mix(washed, cardColor, wl);
37
+ float outAlpha = mix(a.a, cardAlpha, wl);
38
+
39
+ // development of the incoming image: quick at first, then slowly settling
40
+ float x = clamp((p - split) / max(1.0 - split, 1e-3), 0.0, 1.0);
41
+ float d = 1.0 - pow(1.0 - x, 1.5);
42
+ float lum = dot(b.rgb, vec3(0.2126, 0.7152, 0.0722));
43
+ // the shadows develop first, the highlights last
44
+ float dev = clamp((d - 0.45 * lum) / 0.55, 0.0, 1.0);
45
+ dev = dev * dev * (3.0 - 2.0 * dev);
46
+ // low contrast and nearly no colors at first, with a cast: cyan in the shadows, magenta in the lights
47
+ float early = 1.0 - smoothstep(0.2, 0.95, d);
48
+ vec3 tinted = saturation(b.rgb, smoothstep(0.3, 1.0, d));
49
+ tinted = mix(vec3(0.6), tinted, mix(0.55, 1.0, d));
50
+ vec3 tone = mix(vec3(-0.2, 0.06, 0.1), vec3(0.12, -0.1, 0.06), smoothstep(0.15, 0.6, lum));
51
+ tinted += tone * tint * early;
52
+ vec3 incoming = mix(cardColor, clamp(tinted, 0.0, 1.0) * b.a, dev);
53
+ float inAlpha = mix(cardAlpha, b.a, dev);
54
+
55
+ vec3 color = p < split ? outgoing : incoming;
56
+ float alpha = p < split ? outAlpha : inAlpha;
57
+ if (alpha <= 0.0) return vec4(0.0);
58
+ return vec4(clamp(color / alpha, 0.0, 1.0), alpha);
59
+ }
@@ -0,0 +1,73 @@
1
+ // PixelStretch — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/PixelStretch.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: A line sweeps across the frame and drags the outgoing image's pixels behind it as long streaks, which shorten as it goes and reveal the incoming image
5
+ // Tags: smear, streaks, directional, chromatic
6
+
7
+ // @param Direction in which the line sweeps
8
+ uniform vec2 direction; // = vec2(1.0, 0.0)
9
+ // @range(0, 1) Length of the streaks at the middle of the sweep, as a part of the frame
10
+ uniform float stretch; // = 0.45
11
+ // @range(0, 1) Amount of RGB split along the streaks
12
+ uniform float chroma; // = 0.5
13
+ // @range(0, 0.2) Softness of the line and of the streaks' ends, as a part of the frame
14
+ uniform float softness; // = 0.03
15
+ // @range(0, 1) How much the streaks jitter, each row at its own length
16
+ uniform float jitter; // = 0.5
17
+
18
+ float hash(float n) {
19
+ n = fract(n * 0.1031);
20
+ n *= n + 33.33;
21
+ n *= n + n;
22
+ return fract(n);
23
+ }
24
+
25
+ // smooth max with a compact support: exactly max(x, y) when they are k apart
26
+ float smax(float x, float y, float k) {
27
+ float h = max(k - abs(x - y), 0.0) / k;
28
+ return max(x, y) + h * h * k * 0.25;
29
+ }
30
+
31
+ // position s along the sweep (0 to 1 across the frame) to a frame coordinate
32
+ vec2 at(vec2 uv, float s0, float s, vec2 d, float ext) {
33
+ return clamp(uv + d * (s - s0) * ext, 0.0, 1.0);
34
+ }
35
+
36
+ vec4 transition(vec2 uv) {
37
+ vec2 d = normalize(direction + vec2(1e-6, 0.0));
38
+ // ext: length of the frame along the sweep, in uv units
39
+ float ext = abs(d.x) + abs(d.y);
40
+ float s = 0.5 + dot(uv - 0.5, d) / ext;
41
+ // rows across the streaks (about one per pixel line), in frame heights
42
+ vec2 n = vec2(-d.y, d.x);
43
+ float t = dot((uv - 0.5) * vec2(ratio, 1.0), n);
44
+ float row = floor(t * 540.0);
45
+ float clump = floor(t * 60.0);
46
+ float rnd = 0.6 * hash(row + 17.0) + 0.4 * hash(clump + 311.0);
47
+
48
+ float p = progress;
49
+ float k = softness + 1e-4;
50
+ // the line starts and ends at rest just beyond the frame, past its soft edge, so both ends are exact;
51
+ // it enters at once and slows down a little toward the end
52
+ float margin = k + 0.002;
53
+ float a = mix(-margin, 1.0 + margin, mix(p, p * p * (3.0 - 2.0 * p), 0.5));
54
+
55
+ // the streaks are longest when the line crosses the middle and vanish as it reaches the edges,
56
+ // so they never repeat the frame's own border (often dark, or letterboxing)
57
+ float h = clamp(4.0 * a * (1.0 - a), 0.0, 1.0);
58
+ float len = stretch * h * (1.0 - 0.6 * jitter * rnd);
59
+ float split = 0.02 * chroma * h;
60
+
61
+ // ahead of the line the outgoing image is intact; behind it, each pixel repeats the pixel at the line
62
+ vec4 fr = getFromColor(at(uv, s, smax(s, a + split, k), d, ext));
63
+ vec4 fg = getFromColor(at(uv, s, smax(s, a, k), d, ext));
64
+ vec4 fb = getFromColor(at(uv, s, smax(s, a - split, k), d, ext));
65
+ vec4 streak = vec4(fr.r, fg.g, fb.b, fg.a);
66
+ // a faint flicker along the streaks
67
+ float behind = step(s, a);
68
+ streak.rgb *= 1.0 + 0.06 * jitter * h * (hash(row * 3.0 + 5.0) - 0.5) * behind;
69
+
70
+ // past the end of its streak, each row shows the incoming image as it is
71
+ float w = smoothstep(len - k, len + k, a - s);
72
+ return mix(streak, getToColor(uv), w);
73
+ }
@@ -0,0 +1,38 @@
1
+ // PlusWipe — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/PlusWipe.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: A plus-shaped cross grows from the center and widens its arms until the incoming image fills the frame
5
+ // Tags: shape, wipe, cross, plus
6
+
7
+ // @range(0, 0.1) Softness of the cross's edge
8
+ uniform float smoothness; // = 0.01
9
+ // @param Close four corner rectangles in toward the middle instead
10
+ uniform bool reverse; // = false
11
+
12
+ float boxDist (vec2 p, vec2 halfSize) {
13
+ vec2 d = abs(p) - halfSize;
14
+ return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
15
+ }
16
+
17
+ // 1 inside the cross at time t, 0 outside
18
+ float plus (vec2 q, float t, float s) {
19
+ vec2 frame = vec2(0.5 * ratio, 0.5);
20
+ float k = min(frame.x, frame.y);
21
+ // The arms start equally thick, then widen with the frame's proportions,
22
+ // so the four corners left uncovered vanish together
23
+ vec2 halfWidth = k * t + (frame - k) * t * t;
24
+ // The arms reach out at the same speed in every direction
25
+ float halfLength = 3.0 * max(frame.x, frame.y) * t;
26
+ float d = min(boxDist(q, vec2(halfLength, halfWidth.y)), boxDist(q, vec2(halfWidth.x, halfLength)));
27
+ // The soft edge slides from outside to inside the cross, so nothing shows at
28
+ // t = 0 and everything at t = 1, whatever the softness
29
+ return 1.0 - smoothstep(0.0, s, d + s * (1.0 - t));
30
+ }
31
+
32
+ vec4 transition (vec2 uv) {
33
+ // Measured in square pixels, so the cross is not stretched
34
+ vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
35
+ float s = max(smoothness, 0.001);
36
+ float m = reverse ? 1.0 - plus(q, 1.0 - progress, s) : plus(q, progress, s);
37
+ return mix(getFromColor(uv), getToColor(uv), m);
38
+ }
@@ -0,0 +1,57 @@
1
+ // PopIn — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/PopIn.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The incoming image pops in as a rounded card over the outgoing one, with an elastic overshoot: too big, a bit small, then it settles into the full frame as its corners square off
5
+ // Tags: pop, scale, zoom, elastic, bounce, shadow
6
+
7
+ // @param Point of the frame the incoming image pops from
8
+ uniform vec2 center; // = vec2(0.5, 0.5)
9
+ // @range(0, 1.5) How far the card overshoots (too big, then a bit small) before it settles
10
+ uniform float bounce; // = 1.0
11
+ // @range(0, 0.5) Corner radius of the card while it pops, relative to its shorter side
12
+ uniform float corner; // = 0.12
13
+ // @range(0, 1) Darkness of the drop shadow the card casts on the outgoing image
14
+ uniform float shadow; // = 0.5
15
+
16
+ const float PI = 3.141592653589793;
17
+
18
+ // signed distance to a rounded box of half size b and corner radius r
19
+ float roundedBox(vec2 p, vec2 b, float r) {
20
+ vec2 q = abs(p) - b + r;
21
+ return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;
22
+ }
23
+
24
+ vec4 transition(vec2 uv) {
25
+ float t = progress;
26
+ // scale of the card: an ease-out, plus a damped spring that overshoots and lands exactly at t = 1
27
+ float easeOut = 1.0 - (1.0 - t) * (1.0 - t) * (1.0 - t);
28
+ float spring = 1.0 - exp(-1.5 * t) * cos(2.5 * PI * t) * (1.0 - t);
29
+ float s = mix(easeOut, spring, bounce);
30
+
31
+ // the card is the incoming frame scaled by s around the center, in aspect-corrected space
32
+ vec2 asp = vec2(ratio, 1.0);
33
+ float side = min(ratio, 1.0);
34
+ vec2 cardCenter = center + (0.5 - center) * s;
35
+ vec2 halfSize = 0.5 * s * asp;
36
+ float r = corner * s * side * (1.0 - t);
37
+ float aa = 0.002;
38
+ // the edge is pushed out by one antialiasing width, so at t = 1 the card covers the whole frame
39
+ float d = roundedBox((uv - cardCenter) * asp, halfSize, r) - aa;
40
+ float cover = clamp(0.5 - d / aa, 0.0, 1.0) * smoothstep(0.0, 0.08, t);
41
+
42
+ // drop shadow on the outgoing image, offset down and blurred, growing with the card
43
+ float k = min(s, 1.0) * side;
44
+ float blur = 0.05 * k + 1e-4;
45
+ vec2 offset = vec2(0.0, -0.03 * k);
46
+ float ds = roundedBox((uv - cardCenter - offset) * asp, halfSize, r);
47
+ float shade = shadow * (1.0 - smoothstep(-blur, blur, ds)) * smoothstep(0.0, 0.15, t);
48
+
49
+ vec4 a = getFromColor(uv);
50
+ // the shadow darkens the outgoing image, it does not change its alpha (no shadow on transparent areas)
51
+ a.rgb *= 1.0 - shade;
52
+ // clamped: only the antialiased rim, one pixel or two outside the card, reads past the edge
53
+ vec4 b = getToColor(clamp((uv - center) / max(s, 1e-4) + center, 0.0, 1.0));
54
+ // blend premultiplied, then back to straight alpha
55
+ vec4 c = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), cover);
56
+ return c.a > 0.0 ? vec4(c.rgb / c.a, c.a) : vec4(0.0);
57
+ }
@@ -0,0 +1,95 @@
1
+ // Refraction — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/Refraction.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The frame is seen through flowing liquid glass that bends the outgoing image more and more, with rainbow fringes, flares up as the incoming image takes over, then calms down and clears
5
+ // Tags: distortion, refraction, chromatic-aberration, glow
6
+
7
+ // @range(0, 0.3) How far the glass bends the image at the peak
8
+ uniform float strength; // = 0.15
9
+ // @range(0.5, 8) Size of the flowing waves: higher makes smaller waves
10
+ uniform float scale; // = 2.5
11
+ // @range(0, 1) Spread of the rainbow fringes
12
+ uniform float dispersion; // = 0.5
13
+ // @range(0, 3) Brightness of the flare at the peak
14
+ uniform float brightness; // = 1.0
15
+
16
+ // the wavelengths sampled from red to violet
17
+ const int TAPS = 7;
18
+
19
+ // the glass surface: smooth waves of a few sizes, warped into each other and flowing over time
20
+ float surface(vec2 q, float t) {
21
+ q += 0.45 * vec2(sin(1.3 * q.y + 0.9 * t), sin(1.1 * q.x - 1.2 * t));
22
+ float h = sin(q.x + 0.6 * t) * sin(1.2 * q.y - 0.8 * t);
23
+ h += 0.5 * sin(dot(q, vec2(1.6, -1.2)) + 1.4 * t);
24
+ h += 0.3 * sin(dot(q, vec2(-1.1, 2.9)) - 1.9 * t + 1.7 * sin(0.9 * q.x));
25
+ h += 0.15 * sin(dot(q, vec2(4.3, 3.1)) + 2.6 * t);
26
+ return h;
27
+ }
28
+
29
+ // a hash without sin, to jitter the wavelengths from pixel to pixel
30
+ float hash12(vec2 v) {
31
+ vec3 v3 = fract(vec3(v.xyx) * 0.1031);
32
+ v3 += dot(v3, v3.yzx + 33.33);
33
+ return fract((v3.x + v3.y) * v3.z);
34
+ }
35
+
36
+ // mirror the coordinates back into the frame
37
+ vec2 mirror(vec2 v) {
38
+ return 1.0 - abs(1.0 - mod(v, 2.0));
39
+ }
40
+
41
+ // rough spectral response of a wavelength w (0 = red, 1 = violet), in RGB
42
+ vec3 spectrum(float w) {
43
+ vec3 c = vec3(
44
+ 1.0 - smoothstep(0.0, 0.55, w) + 0.35 * smoothstep(0.75, 1.0, w),
45
+ 1.0 - abs(2.0 * w - 1.0) * 1.2,
46
+ smoothstep(0.45, 1.0, w)
47
+ );
48
+ return clamp(c, 0.0, 1.0);
49
+ }
50
+
51
+ vec4 transition(vec2 uv) {
52
+ float p = progress;
53
+ // 0 at both ends, 1 in the middle: the glass builds up slowly, then calms down
54
+ float h = 1.0 - abs(2.0 * p - 1.0);
55
+ float amount = h * h * (2.0 - h);
56
+
57
+ // the glass refracts along the slope of its surface
58
+ vec2 q = (uv - 0.5) * vec2(ratio, 1.0) * scale;
59
+ float t = 3.0 * p;
60
+ float e = 0.01;
61
+ vec2 slope = vec2(
62
+ surface(q + vec2(e, 0.0), t) - surface(q - vec2(e, 0.0), t),
63
+ surface(q + vec2(0.0, e), t) - surface(q - vec2(0.0, e), t)
64
+ ) / (2.0 * e);
65
+ vec2 offset = slope * strength * amount / scale;
66
+ // the switch to the incoming image, around the peak: it appears through the glass's waves,
67
+ // the crests first, then the troughs
68
+ float wave = clamp(0.5 * surface(q, t), -1.0, 1.0);
69
+ float m = smoothstep(-0.015, 0.015, p - 0.5 + 0.1 * wave);
70
+
71
+ // each wavelength bends a little differently: red the least, violet the most
72
+ vec3 color = vec3(0.0);
73
+ vec3 weights = vec3(0.0);
74
+ float alpha = 0.0;
75
+ // jittered wavelengths blend the fringes into a continuous rainbow
76
+ float jitter = hash12(uv * vec2(ratio, 1.0) * 1000.0) - 0.5;
77
+ for (int i = 0; i < TAPS; i++) {
78
+ float w = float(i) / float(TAPS - 1);
79
+ float wj = (float(i) + jitter) / float(TAPS - 1);
80
+ vec2 st = mirror(uv + offset * (1.0 + dispersion * (wj - 0.5) * 1.6));
81
+ vec4 c = mix(getFromColor(st), getToColor(st), m);
82
+ vec3 s = spectrum(w);
83
+ color += s * c.rgb * c.a;
84
+ weights += s;
85
+ alpha += c.a;
86
+ }
87
+ alpha /= float(TAPS);
88
+ color = color / weights / max(alpha, 1e-5);
89
+
90
+ // a flare at the peak: the image is pushed toward an overexposed white
91
+ float flare = 2.0 * brightness * pow(h, 8.0);
92
+ color = color * (1.0 + flare) / (1.0 + flare * color);
93
+ color += 0.1 * flare * dot(color, vec3(0.3333));
94
+ return vec4(clamp(color, 0.0, 1.0), alpha);
95
+ }
@@ -0,0 +1,102 @@
1
+ // SmokeDissolve — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/SmokeDissolve.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: Billowing smoke drifts in across the outgoing image, with lit tops, darker folds and wispy edges, and thickens until it covers the frame; as it thins out and drifts away, the incoming image shows through
5
+ // Tags: smoke, fog, organic, noise, cover
6
+
7
+ // @param Direction the smoke drifts toward (it comes in from the opposite side); its length is how far it drifts, in frame heights
8
+ uniform vec2 direction; // = vec2(0.5, 0.1)
9
+ // @range(1, 8) Size of the billows: more, smaller ones with a larger value
10
+ uniform float scale; // = 2.5
11
+ // @range(0, 1) How much the smoke rolls in from one side rather than everywhere at once
12
+ uniform float spread; // = 0.4
13
+ // @range(0.05, 1) Softness of the smoke: wispier, more see-through edges with a larger value
14
+ uniform float softness; // = 0.5
15
+ // @color Color of the smoke, lit from above
16
+ uniform vec4 color; // = vec4(0.86, 0.86, 0.88, 1.0)
17
+
18
+ float hash12(vec2 v) {
19
+ vec3 v3 = fract(vec3(v.xyx) * 0.1031);
20
+ v3 += dot(v3, v3.yzx + 33.33);
21
+ return fract((v3.x + v3.y) * v3.z);
22
+ }
23
+
24
+ float vnoise(vec2 v) {
25
+ vec2 i = floor(v);
26
+ vec2 f = fract(v);
27
+ f = f * f * (3.0 - 2.0 * f);
28
+ return mix(
29
+ mix(hash12(i), hash12(i + vec2(1.0, 0.0)), f.x),
30
+ mix(hash12(i + vec2(0.0, 1.0)), hash12(i + vec2(1.0, 1.0)), f.x),
31
+ f.y
32
+ );
33
+ }
34
+
35
+ float fbm(vec2 v) {
36
+ float sum = 0.0;
37
+ float amp = 0.5;
38
+ for (int i = 0; i < 4; i++) {
39
+ sum += amp * vnoise(v);
40
+ v = mat2(1.6, 1.2, -1.2, 1.6) * v + 5.3;
41
+ amp *= 0.5;
42
+ }
43
+ return sum / 0.9375;
44
+ }
45
+
46
+ vec4 transition(vec2 uv) {
47
+ float p = progress;
48
+ vec2 pos = (uv - 0.5) * vec2(ratio, 1.0);
49
+
50
+ // where along the drift the pixel is: 0 on the side the smoke comes from, 1 on the other
51
+ float len = length(direction);
52
+ vec2 dir = len > 1e-4 ? direction / len : vec2(0.0);
53
+ float ext = 0.5 * (abs(dir.x) * ratio + abs(dir.y)) + 1e-4;
54
+ float along = len > 1e-4 ? 0.5 + 0.5 * dot(pos, dir) / ext : 0.5;
55
+
56
+ // the smoke rolls in (until 0.45), covers the whole frame, then thins out (from 0.55),
57
+ // each side of the frame in turn
58
+ float arrive = (p / 0.45) * (1.0 + spread) - spread * along;
59
+ float leave = ((p - 0.55) / 0.45) * (1.0 + spread) - spread * along;
60
+ float body = smoothstep(0.0, 1.0, arrive) * (1.0 - smoothstep(0.0, 1.0, leave));
61
+ // the images switch while the smoke is fully dense everywhere
62
+ float m = smoothstep(0.48, 0.52, p);
63
+ // no smoke here (yet, or any more): one image only
64
+ if (body <= 0.0) return m < 0.5 ? getFromColor(uv) : getToColor(uv);
65
+
66
+ // billows: noise warped by itself, drifting with the smoke and slowly churning
67
+ vec2 q = (pos - direction * (p - 0.5)) * scale;
68
+ vec2 churn = vec2(0.5 * p, -0.35 * p);
69
+ vec2 warp = vec2(fbm(q + vec2(3.1, 1.7) + churn), fbm(q + vec2(8.3, 2.8) - churn));
70
+ vec2 w = q + 1.1 * (warp - 0.5);
71
+ float n = fbm(w);
72
+ // the billows catch the light from above: brighter where the smoke rises toward it
73
+ // (on the coarse octave only, which shapes them)
74
+ float lit = 0.53 * (vnoise(w) - vnoise(w + vec2(0.0, 0.2)));
75
+ // finer curls that fray the edges into wisps
76
+ float wisp = vnoise(w * 3.3 - 2.0 * churn) - 0.5;
77
+
78
+ // density: the billows fill in first, the gaps between them last, and thin out first
79
+ float edge = 2.0 * body - (1.0 - smoothstep(0.1, 0.6, n)) + 1.6 * body * (1.0 - body) * wisp;
80
+ float d = smoothstep(0.0, softness, edge) * mix(0.5, 1.0, smoothstep(0.2, 0.9, body));
81
+
82
+ // the image under the smoke: one image, or both mixed (premultiplied) during the switch
83
+ vec4 base;
84
+ if (m <= 0.0) base = getFromColor(uv);
85
+ else if (m >= 1.0) base = getToColor(uv);
86
+ else {
87
+ vec4 a = getFromColor(uv);
88
+ vec4 b = getToColor(uv);
89
+ base = mix(vec4(a.rgb * a.a, a.a), vec4(b.rgb * b.a, b.a), m);
90
+ base = base.a > 0.0 ? vec4(base.rgb / base.a, base.a) : vec4(0.0);
91
+ }
92
+ if (d <= 0.0) return base;
93
+
94
+ // soft volumetric shading: lit tops, darker folds deep in the smoke, lighter thin wisps
95
+ float shade = 0.92 + 1.3 * lit;
96
+ shade *= mix(0.76, 1.04, smoothstep(0.25, 0.75, n));
97
+ shade = mix(1.0, shade, 0.3 + 0.7 * d);
98
+ vec3 smoke = clamp(color.rgb * shade, 0.0, 1.0);
99
+
100
+ // the smoke color mixes as straight RGBA, like every fill color
101
+ return mix(base, vec4(smoke, color.a), d);
102
+ }