gl-transitions 2.2.0 → 2.4.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 (156) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/compatibility.json +464 -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/ColorPanelWipe.glsl +75 -0
  14. package/glsl3/CurvedWipe.glsl +52 -0
  15. package/glsl3/Disintegrate.glsl +112 -0
  16. package/glsl3/EyeBlink.glsl +83 -0
  17. package/glsl3/FilmDissolve.glsl +49 -0
  18. package/glsl3/FilmStrip.glsl +105 -0
  19. package/glsl3/FlameWipe.glsl +154 -0
  20. package/glsl3/Gallery.glsl +133 -0
  21. package/glsl3/GooeyWipe.glsl +97 -0
  22. package/glsl3/InkBleed.glsl +96 -0
  23. package/glsl3/LensFlare.glsl +125 -0
  24. package/glsl3/LightRays.glsl +106 -0
  25. package/glsl3/LightWipe.glsl +89 -0
  26. package/glsl3/PhotoDevelop.glsl +59 -0
  27. package/glsl3/PlusWipe.glsl +38 -0
  28. package/glsl3/PopIn.glsl +57 -0
  29. package/glsl3/SmokeDissolve.glsl +102 -0
  30. package/glsl3/SplatterWipe.glsl +154 -0
  31. package/glsl3/StretchSlide.glsl +62 -0
  32. package/glsl3/VhsTracking.glsl +127 -0
  33. package/glsl3/WedgeWipe.glsl +35 -0
  34. package/index.js +1 -1
  35. package/layouts.json +1091 -17
  36. package/llms-full.txt +774 -304
  37. package/llms.txt +189 -160
  38. package/msl/Accordion.metal +421 -0
  39. package/msl/Ascii.metal +567 -0
  40. package/msl/BlockCover.metal +403 -0
  41. package/msl/BloomDissolve.metal +416 -0
  42. package/msl/BokehDissolve.metal +447 -0
  43. package/msl/BrushWipe.metal +488 -0
  44. package/msl/CameraShake.metal +393 -0
  45. package/msl/CardSwipe.metal +342 -0
  46. package/msl/ColorPanelWipe.metal +314 -0
  47. package/msl/CurvedWipe.metal +229 -0
  48. package/msl/Disintegrate.metal +468 -0
  49. package/msl/EyeBlink.metal +355 -0
  50. package/msl/FilmDissolve.metal +199 -0
  51. package/msl/FilmStrip.metal +429 -0
  52. package/msl/FlameWipe.metal +575 -0
  53. package/msl/Gallery.metal +813 -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/LightWipe.metal +321 -0
  59. package/msl/PhotoDevelop.metal +245 -0
  60. package/msl/PlusWipe.metal +199 -0
  61. package/msl/PopIn.metal +245 -0
  62. package/msl/SmokeDissolve.metal +400 -0
  63. package/msl/SplatterWipe.metal +677 -0
  64. package/msl/StretchSlide.metal +243 -0
  65. package/msl/VhsTracking.metal +514 -0
  66. package/msl/WedgeWipe.metal +154 -0
  67. package/package.json +1 -1
  68. package/skills/gl-transitions/references/catalog.md +115 -39
  69. package/sksl/Accordion.sksl +94 -0
  70. package/sksl/Ascii.sksl +131 -0
  71. package/sksl/BlockCover.sksl +96 -0
  72. package/sksl/BloomDissolve.sksl +119 -0
  73. package/sksl/BokehDissolve.sksl +132 -0
  74. package/sksl/BrushWipe.sksl +109 -0
  75. package/sksl/CameraShake.sksl +108 -0
  76. package/sksl/CardSwipe.sksl +93 -0
  77. package/sksl/ColorPanelWipe.sksl +85 -0
  78. package/sksl/CurvedWipe.sksl +64 -0
  79. package/sksl/Disintegrate.sksl +117 -0
  80. package/sksl/EyeBlink.sksl +94 -0
  81. package/sksl/FilmDissolve.sksl +60 -0
  82. package/sksl/FilmStrip.sksl +114 -0
  83. package/sksl/FlameWipe.sksl +162 -0
  84. package/sksl/Gallery.sksl +139 -0
  85. package/sksl/GooeyWipe.sksl +109 -0
  86. package/sksl/InkBleed.sksl +109 -0
  87. package/sksl/LensFlare.sksl +135 -0
  88. package/sksl/LightRays.sksl +115 -0
  89. package/sksl/LightWipe.sksl +97 -0
  90. package/sksl/PhotoDevelop.sksl +72 -0
  91. package/sksl/PlusWipe.sksl +50 -0
  92. package/sksl/PopIn.sksl +69 -0
  93. package/sksl/SmokeDissolve.sksl +115 -0
  94. package/sksl/SplatterWipe.sksl +161 -0
  95. package/sksl/StretchSlide.sksl +74 -0
  96. package/sksl/VhsTracking.sksl +138 -0
  97. package/sksl/WedgeWipe.sksl +46 -0
  98. package/sksl/index.js +1 -1
  99. package/transitions/Accordion.glsl +84 -0
  100. package/transitions/Ascii.glsl +123 -0
  101. package/transitions/BlockCover.glsl +86 -0
  102. package/transitions/BloomDissolve.glsl +109 -0
  103. package/transitions/BokehDissolve.glsl +122 -0
  104. package/transitions/BrushWipe.glsl +99 -0
  105. package/transitions/CameraShake.glsl +97 -0
  106. package/transitions/CardSwipe.glsl +80 -0
  107. package/transitions/ColorPanelWipe.glsl +74 -0
  108. package/transitions/CurvedWipe.glsl +51 -0
  109. package/transitions/Disintegrate.glsl +111 -0
  110. package/transitions/EyeBlink.glsl +82 -0
  111. package/transitions/FilmDissolve.glsl +48 -0
  112. package/transitions/FilmStrip.glsl +104 -0
  113. package/transitions/FlameWipe.glsl +153 -0
  114. package/transitions/Gallery.glsl +132 -0
  115. package/transitions/GooeyWipe.glsl +96 -0
  116. package/transitions/InkBleed.glsl +95 -0
  117. package/transitions/LensFlare.glsl +124 -0
  118. package/transitions/LightRays.glsl +105 -0
  119. package/transitions/LightWipe.glsl +88 -0
  120. package/transitions/PhotoDevelop.glsl +58 -0
  121. package/transitions/PlusWipe.glsl +37 -0
  122. package/transitions/PopIn.glsl +56 -0
  123. package/transitions/SmokeDissolve.glsl +101 -0
  124. package/transitions/SplatterWipe.glsl +153 -0
  125. package/transitions/StretchSlide.glsl +61 -0
  126. package/transitions/VhsTracking.glsl +126 -0
  127. package/transitions/WedgeWipe.glsl +34 -0
  128. package/wgsl/Accordion.wgsl +376 -0
  129. package/wgsl/Ascii.wgsl +519 -0
  130. package/wgsl/BlockCover.wgsl +352 -0
  131. package/wgsl/BloomDissolve.wgsl +372 -0
  132. package/wgsl/BokehDissolve.wgsl +409 -0
  133. package/wgsl/BrushWipe.wgsl +443 -0
  134. package/wgsl/CameraShake.wgsl +348 -0
  135. package/wgsl/CardSwipe.wgsl +308 -0
  136. package/wgsl/ColorPanelWipe.wgsl +274 -0
  137. package/wgsl/CurvedWipe.wgsl +198 -0
  138. package/wgsl/Disintegrate.wgsl +426 -0
  139. package/wgsl/EyeBlink.wgsl +308 -0
  140. package/wgsl/FilmDissolve.wgsl +169 -0
  141. package/wgsl/FilmStrip.wgsl +381 -0
  142. package/wgsl/FlameWipe.wgsl +531 -0
  143. package/wgsl/Gallery.wgsl +741 -0
  144. package/wgsl/GooeyWipe.wgsl +353 -0
  145. package/wgsl/InkBleed.wgsl +366 -0
  146. package/wgsl/LensFlare.wgsl +406 -0
  147. package/wgsl/LightRays.wgsl +380 -0
  148. package/wgsl/LightWipe.wgsl +277 -0
  149. package/wgsl/PhotoDevelop.wgsl +213 -0
  150. package/wgsl/PlusWipe.wgsl +165 -0
  151. package/wgsl/PopIn.wgsl +213 -0
  152. package/wgsl/SmokeDissolve.wgsl +363 -0
  153. package/wgsl/SplatterWipe.wgsl +613 -0
  154. package/wgsl/StretchSlide.wgsl +213 -0
  155. package/wgsl/VhsTracking.wgsl +462 -0
  156. package/wgsl/WedgeWipe.wgsl +126 -0
@@ -0,0 +1,127 @@
1
+ // VhsTracking — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/VhsTracking.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: Tape-tracking bands of white snow roll down the frame, tearing the lines around them, with smeared color, wobbling lines, a jittering strip at the bottom and a dropout flash, as the incoming image is recorded over the outgoing one under the densest band
5
+ // Tags: retro, glitch, noise, tape, scanlines
6
+
7
+ // @range(1, 4, 1) Number of noise bands rolling down (the first one carries the cut)
8
+ uniform int bands; // = 3
9
+ // @range(0, 1) Amount of snow and tearing in the bands
10
+ uniform float noise; // = 0.6
11
+ // @range(0, 1) How far the color smears to the right of the picture
12
+ uniform float bleed; // = 0.5
13
+ // @range(0, 1) How much the lines wobble sideways
14
+ uniform float wobble; // = 0.5
15
+
16
+ const float LINES = 220.0; // tape lines over the frame height
17
+ const float FRAMES = 40.0; // the noise changes this many times over the transition
18
+ const float BAND = 0.11; // half height of the main band
19
+ const float STRIP = 0.06; // height of the jittering strip at the bottom
20
+ const int TAPS = 6;
21
+
22
+ float hash12(vec2 v) {
23
+ vec3 v3 = fract(vec3(v.xyx) * 0.1031);
24
+ v3 += dot(v3, v3.yzx + 33.33);
25
+ return fract((v3.x + v3.y) * v3.z);
26
+ }
27
+
28
+ vec2 mirror(vec2 v) {
29
+ return 1.0 - abs(1.0 - mod(v, 2.0));
30
+ }
31
+
32
+ // the tape image on the outgoing (or, once re-recorded, incoming) side, premultiplied
33
+ vec4 tape(vec2 p, bool fresh) {
34
+ p = mirror(p);
35
+ vec4 c = fresh ? getToColor(p) : getFromColor(p);
36
+ return vec4(c.rgb * c.a, c.a);
37
+ }
38
+
39
+ float luma(vec3 c) {
40
+ return dot(c, vec3(0.299, 0.587, 0.114));
41
+ }
42
+
43
+ // how dense a band centered at y = c of half height w is on line y, with ragged edges
44
+ float bandDensity(float y, float c, float w, float jitter) {
45
+ float d = abs(y - c) / w + 0.35 * jitter;
46
+ return 1.0 - smoothstep(0.0, 1.0, d);
47
+ }
48
+
49
+ vec4 transition(vec2 uv) {
50
+ // the effects build up quickly and settle at the end: exactly 0 at both ends
51
+ float h = clamp(2.5 * (1.0 - abs(2.0 * progress - 1.0)), 0.0, 1.0);
52
+ float env = h * h * (3.0 - 2.0 * h);
53
+ // a short dropout flash when the main band crosses the middle of the frame
54
+ float f = clamp(1.0 - abs(progress - 0.5) / 0.04, 0.0, 1.0);
55
+ float flash = f * f * (3.0 - 2.0 * f);
56
+
57
+ float frame = floor(progress * FRAMES);
58
+ float line = floor(uv.y * LINES);
59
+ float jitter = hash12(vec2(line, frame + 7.0)) - 0.5;
60
+
61
+ // the main band rolls from above the frame to below it; the incoming image is above it
62
+ float c0 = mix(1.0 + 1.2 * BAND, -1.2 * BAND, progress);
63
+ // (the cut is ragged, line by line)
64
+ bool fresh = uv.y > c0 + 0.8 * BAND * jitter;
65
+ float dens = bandDensity(uv.y, c0, BAND, jitter);
66
+ float tear = 1.0 - smoothstep(0.0, 1.0, abs(uv.y - c0) / (2.5 * BAND));
67
+ // thinner and weaker bands roll faster, wrapping around the frame
68
+ for (int i = 1; i < 4; i++) {
69
+ if (i < bands) {
70
+ float k = float(i);
71
+ float w = BAND * (0.35 + 0.2 * hash12(vec2(k, 3.0)));
72
+ float speed = 1.3 + 0.9 * k;
73
+ float cy = -w + (1.0 + 2.0 * w) * fract(hash12(vec2(k, 5.0)) - speed * progress);
74
+ dens = max(dens, 0.6 * bandDensity(uv.y, cy, w, jitter));
75
+ tear = max(tear, 0.5 * (1.0 - smoothstep(0.0, 1.0, abs(uv.y - cy) / (2.5 * w))));
76
+ }
77
+ }
78
+ dens *= env;
79
+ tear *= env;
80
+
81
+ // horizontal displacement of the line: a slow wobble, a fine jitter and the tearing
82
+ float rowTear = hash12(vec2(floor(uv.y * LINES * 0.5), frame + 31.0)) - 0.5;
83
+ float dx = wobble * env * (0.006 * sin(uv.y * 7.0 + progress * 23.0) + 0.004 * jitter);
84
+ dx += (0.3 + 0.7 * noise) * tear * 0.18 * rowTear;
85
+ // the head-switching strip at the bottom: lines skewed sideways and jittering
86
+ float strip = env * (1.0 - smoothstep(0.0, STRIP, uv.y));
87
+ dx += strip * (0.03 + 0.06 * (1.0 - uv.y / STRIP)) * (0.6 + 0.8 * hash12(vec2(frame, 41.0)));
88
+ vec2 q = vec2(uv.x + dx, uv.y);
89
+
90
+ vec4 c = tape(q, fresh);
91
+ if (c.a <= 0.0) return vec4(0.0);
92
+ // chroma bleed: the color is smeared to the right of the luma
93
+ float len = bleed * (0.02 + 0.05 * dens) * env;
94
+ vec4 avg = c;
95
+ if (len > 0.0) {
96
+ avg = vec4(0.0);
97
+ for (int i = 0; i < TAPS; i++) {
98
+ float u = (float(i) + 0.5) / float(TAPS);
99
+ avg += tape(q - vec2(len * (0.4 + u), 0.0), fresh);
100
+ }
101
+ avg /= float(TAPS);
102
+ }
103
+ vec3 chroma = (avg.rgb - luma(avg.rgb)) / max(avg.a, 1e-5);
104
+ vec3 rgb = luma(c.rgb) + chroma * c.a; // premultiplied by c.a
105
+ // the signal fades and loses color under the bands
106
+ rgb = mix(rgb, vec3(luma(rgb)), 0.6 * dens);
107
+
108
+ // snow: short white streaks on the tape lines, denser in the bands
109
+ // (the streaks of each line start at a random offset so they never line up vertically)
110
+ vec2 cell = vec2(floor(uv.x * LINES * 0.3 * ratio + 40.0 * jitter), line);
111
+ float n = hash12(cell + frame * vec2(37.0, 17.0));
112
+ float amount = clamp(noise * max(1.3 * dens, 0.8 * strip) + 0.35 * flash, 0.0, 1.0);
113
+ float snow = amount > 0.0 ? smoothstep(1.0 - amount, 1.0 - 0.6 * amount, n) : 0.0;
114
+ snow *= 0.55 + 0.45 * hash12(cell.yx + frame);
115
+ // and a finer sparkle between them
116
+ float g = hash12(vec2(floor(uv.x * LINES * ratio), line) + frame * vec2(13.0, 29.0));
117
+ snow = max(snow, amount > 0.0 ? 0.7 * smoothstep(1.0 - 0.4 * amount, 1.0, g) : 0.0);
118
+ // and a few dark specks
119
+ float dark = g < 0.1 * amount ? 1.0 : 0.0;
120
+ // the dropout: whole stretches of a few lines go white
121
+ float group = floor(uv.y * LINES / 3.0);
122
+ float drop = step(1.0 - 0.15 * flash, hash12(vec2(group, floor(uv.x * 6.0 + 5.0 * hash12(vec2(group, frame))) + frame * 7.0)));
123
+ rgb *= 1.0 - 0.5 * dark;
124
+ rgb += (clamp(snow + drop + 0.12 * flash, 0.0, 1.0)) * (c.a - rgb);
125
+
126
+ return vec4(clamp(rgb / c.a, 0.0, 1.0), c.a);
127
+ }
@@ -0,0 +1,35 @@
1
+ // WedgeWipe — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/WedgeWipe.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: Two hands sweep away from each other around the center, opening a widening wedge that reveals the incoming image
5
+ // Tags: wipe, radial, clock, wedge
6
+
7
+ #define PI 3.141592653589793
8
+
9
+ // @range(-180, 180) Direction the wedge opens from, in degrees clockwise from 12 o'clock
10
+ uniform float angle; // = 0.0
11
+ // @range(0, 0.2) Softness of the hands' edges
12
+ uniform float smoothness; // = 0.01
13
+ // @param Point the hands turn around
14
+ uniform vec2 center; // = vec2(0.5)
15
+
16
+ vec4 transition (vec2 uv) {
17
+ // At the end, float PI rounds above pi and sin(spread) can turn slightly negative
18
+ if (progress >= 1.0) return getToColor(uv);
19
+ // Measured in square pixels, so the angles are not stretched
20
+ vec2 q = (uv - center) * vec2(ratio, 1.0);
21
+ float a = radians(angle);
22
+ // Local frame: y along the starting direction, x across it (the wedge is symmetric)
23
+ vec2 p = vec2(abs(q.x * cos(a) - q.y * sin(a)), q.x * sin(a) + q.y * cos(a));
24
+ // Each hand has turned by half a turn at the end
25
+ float spread = PI * progress;
26
+ vec2 hand = vec2(sin(spread), cos(spread));
27
+ // Signed distance to the wedge: the nearest hand, negative inside
28
+ float l = length(p);
29
+ float d = length(p - hand * clamp(dot(p, hand), 0.0, l)) * sign(hand.y * p.x - hand.x * p.y);
30
+ // The soft edge keeps an even width and slides from outside to inside the hands,
31
+ // so nothing is revealed at the start and everything is at the end
32
+ float s = max(smoothness, 0.001);
33
+ float m = 1.0 - smoothstep(0.0, s, d + s * (1.0 - progress));
34
+ return mix(getFromColor(uv), getToColor(uv), m);
35
+ }