gl-transitions 2.1.0 → 2.2.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 (41) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/compatibility.json +96 -0
  3. package/gl-transitions.js +1 -1
  4. package/gl-transitions.json +1 -1
  5. package/glsl3/CylinderRoll.glsl +102 -0
  6. package/glsl3/LightStreaks.glsl +117 -0
  7. package/glsl3/PixelStretch.glsl +73 -0
  8. package/glsl3/Refraction.glsl +95 -0
  9. package/glsl3/WhipSpin.glsl +69 -0
  10. package/glsl3/WhipTilt.glsl +79 -0
  11. package/index.js +1 -1
  12. package/layouts.json +236 -0
  13. package/llms-full.txt +392 -292
  14. package/llms.txt +160 -154
  15. package/msl/CylinderRoll.metal +374 -0
  16. package/msl/LightStreaks.metal +518 -0
  17. package/msl/PixelStretch.metal +337 -0
  18. package/msl/Refraction.metal +333 -0
  19. package/msl/WhipSpin.metal +278 -0
  20. package/msl/WhipTilt.metal +327 -0
  21. package/package.json +1 -1
  22. package/skills/gl-transitions/references/catalog.md +24 -12
  23. package/sksl/CylinderRoll.sksl +112 -0
  24. package/sksl/LightStreaks.sksl +126 -0
  25. package/sksl/PixelStretch.sksl +84 -0
  26. package/sksl/Refraction.sksl +103 -0
  27. package/sksl/WhipSpin.sksl +79 -0
  28. package/sksl/WhipTilt.sksl +90 -0
  29. package/sksl/index.js +1 -1
  30. package/transitions/CylinderRoll.glsl +101 -0
  31. package/transitions/LightStreaks.glsl +116 -0
  32. package/transitions/PixelStretch.glsl +72 -0
  33. package/transitions/Refraction.glsl +94 -0
  34. package/transitions/WhipSpin.glsl +68 -0
  35. package/transitions/WhipTilt.glsl +78 -0
  36. package/wgsl/CylinderRoll.wgsl +330 -0
  37. package/wgsl/LightStreaks.wgsl +460 -0
  38. package/wgsl/PixelStretch.wgsl +298 -0
  39. package/wgsl/Refraction.wgsl +294 -0
  40. package/wgsl/WhipSpin.wgsl +241 -0
  41. package/wgsl/WhipTilt.wgsl +291 -0
@@ -1,6 +1,6 @@
1
- # Catalog (gl-transitions@2.1.0)
1
+ # Catalog (gl-transitions@2.2.0)
2
2
 
3
- 143 transitions. Generated from gl-transitions.json; full details (parameter hints, authors, source links) in https://cdn.jsdelivr.net/npm/gl-transitions@2.1.0/llms-full.txt.
3
+ 149 transitions. Generated from gl-transitions.json; full details (parameter hints, authors, source links) in https://cdn.jsdelivr.net/npm/gl-transitions@2.2.0/llms-full.txt.
4
4
 
5
5
  ## By tag
6
6
 
@@ -9,21 +9,22 @@
9
9
  - **zoom**: Box, CrossWarp, CrossZoom, DirectionalScaled, DreamyZoom, Fisheye, LeftRight, Mosaic, RectangleIris, Revolve, RotateScaleFade, RotateScaleVanish, ScaleIn, SimpleZoom, SimpleZoomOut, StereoViewer, TopBottom, Tunnel, ZoomInCircles, ZoomInOut, ZoomWipeLeft, ZoomWipeRight
10
10
  - **slide**: Bounce, Comb, Directional, DirectionalEased, DirectionalScaled, Fold, LeftRight, SlideAwayRight, Slides, SplitSlideInHorizontal, SplitSlideInOutHorizontal, SplitSlideInOutVertical, SplitSlideInVertical, SplitSlideOutHorizontal, SplitSlideOutVertical, TangentMotionBlur, TopBottom, WhipPan
11
11
  - **horizontal**: BowTieHorizontal, Comb, CrossWarp, Curtains, Fold, LeftRight, PaperTear, SimpleFlip, SlideAwayRight, SplitSlideInHorizontal, SplitSlideInOutHorizontal, SplitSlideOutHorizontal, Wind, WipeLeft, WipeRight, ZoomWipeLeft, ZoomWipeRight
12
- - **rotate**: ApertureWipe, Cube, DreamyZoom, FallOver, Honeycomb, Pinwheel, Prisms, Puzzle, Revolve, Rolls, RotateFade, RotateScaleFade, RotateScaleVanish, Swirl, TangentMotionBlur
12
+ - **rotate**: ApertureWipe, Cube, DreamyZoom, FallOver, Honeycomb, Pinwheel, Prisms, Puzzle, Revolve, Rolls, RotateFade, RotateScaleFade, RotateScaleVanish, Swirl, TangentMotionBlur, WhipSpin, WhipTilt
13
+ - **vertical**: Bounce, BowTieVertical, CylinderRoll, FallOver, Shred, SplitSlideInOutVertical, SplitSlideInVertical, SplitSlideOutVertical, Squeeze, StaticWipe, TopBottom, TvRoll, TvTurnOff, WhipTilt, WipeDown, WipeUp
13
14
  - **fade**: ColorPhase, ColorWrap, EdgeGlow, Fade, FadeColor, FadeGrayscale, FlashFade, HsvFade, MultiplyBlend, Overexposure, RotateScaleFade, ScaleIn, SimpleZoom, SimpleZoomOut
14
- - **vertical**: Bounce, BowTieVertical, FallOver, Shred, SplitSlideInOutVertical, SplitSlideInVertical, SplitSlideOutVertical, Squeeze, StaticWipe, TopBottom, TvRoll, TvTurnOff, WipeDown, WipeUp
15
15
  - **shape**: ApertureWipe, BowTie, BowTieHorizontal, BowTieVertical, Box, CircleIris, DiamondWipe, FlowerWipe, HeartWipe, LeafWipe, RectangleCover, SpiralWipe, StarWipe
16
16
  - **split**: Curtains, HorizontalClose, HorizontalOpen, PaperTear, SplitSlideInHorizontal, SplitSlideInOutHorizontal, SplitSlideInOutVertical, SplitSlideInVertical, SplitSlideOutHorizontal, SplitSlideOutVertical, VerticalClose, VerticalOpen
17
+ - **3d**: BookFlip, Cube, Curtains, CylinderRoll, Doorway, FallOver, InvertedPageCurl, Prisms, Swap, Tunnel, WhipTilt
17
18
  - **noise**: BlockDissolve, BurnThrough, Crosshatch, LuminanceMelt, NoiseDissolve, PerlinDissolve, StaticFade, StaticWipe, TvStatic, Wind
18
19
  - **retro**: DitherDissolve, DoomMelt, Halftone, LissajousTiles, StaticFade, StereoViewer, TvLostSignal, TvRoll, TvStatic, TvTurnOff
19
- - **3d**: BookFlip, Cube, Curtains, Doorway, FallOver, InvertedPageCurl, Prisms, Swap, Tunnel
20
+ - **directional**: Directional, DirectionalEased, DirectionalScaled, DirectionalWarp, DirectionalWipe, PixelStretch, Slides, SquaresWipe, WhipPan
20
21
  - **distort**: ButterflyWaveScrawler, ColorCoords, CrazyParametricFun, DisplacementMap, Fisheye, FlyEye, Kaleidoscope, Morph, PowerKaleido
21
- - **directional**: Directional, DirectionalEased, DirectionalScaled, DirectionalWarp, DirectionalWipe, Slides, SquaresWipe, WhipPan
22
+ - **chromatic**: ButterflyWaveScrawler, CylinderRoll, FlyEye, GlitchFlicker, GlitchMemories, PixelStretch, Squeeze, StripDatamoshGlitch
22
23
  - **color**: ColorDistance, ColorPhase, ColorWrap, FadeColor, FadeGrayscale, FlashFade, HsvFade
23
24
  - **glitch**: ColorWrap, GlitchBands, GlitchDisplace, GlitchFlicker, GlitchMemories, StripDatamoshGlitch, TvLostSignal
24
- - **chromatic**: ButterflyWaveScrawler, FlyEye, GlitchFlicker, GlitchMemories, Squeeze, StripDatamoshGlitch
25
25
  - **dissolve**: BlockDissolve, DitherDissolve, GlowDissolve, NoiseDissolve, PerlinDissolve, RandomSquares
26
26
  - **iris**: ApertureWipe, CircleIris, CircleOpen, DiamondWipe, RectangleCover, RectangleIris
27
+ - **motion-blur**: CylinderRoll, LightStreaks, TangentMotionBlur, WhipPan, WhipSpin, WhipTilt
27
28
  - **radial**: ClockWipe, Honeycomb, Pinwheel, RadialWipe, SpiralWipe, Tunnel
28
29
  - **tiles**: GridFlip, Honeycomb, LissajousTiles, Mosaic, Puzzle, TilesWave
29
30
  - **blur**: CrossZoom, DefocusBlur, LinearBlur, Revolve, ZoomInOut
@@ -40,9 +41,11 @@
40
41
  - **box**: Box, RectangleCover, RectangleIris
41
42
  - **displace**: ColorCoords, DisplacementMap, GlitchDisplace
42
43
  - **flip**: BookFlip, GridFlip, SimpleFlip
44
+ - **glow**: GlowDissolve, LightStreaks, Refraction
43
45
  - **mosaic**: Mosaic, MosaicBlend, MosaicFade
44
46
  - **reflection**: Cube, Doorway, Swap
45
47
  - **scanlines**: GlitchFlicker, TvLostSignal, TvRoll
48
+ - **spin**: RotateFade, RotateScaleVanish, WhipSpin
46
49
  - **squares**: Chessboard, RandomSquares, SquaresWipe
47
50
  - **static**: StaticFade, StaticWipe, TvStatic
48
51
  - **warp**: CrossWarp, DirectionalWarp, Tunnel
@@ -53,33 +56,34 @@
53
56
  - **hexagon**: Hexagonalize, Honeycomb
54
57
  - **kaleidoscope**: Kaleidoscope, PowerKaleido
55
58
  - **lens**: Fisheye, FlyEye
59
+ - **light**: LightStreaks, Overexposure
56
60
  - **luma**: LumaWipe, LuminanceMelt
57
61
  - **melt**: DoomMelt, LuminanceMelt
58
- - **motion-blur**: TangentMotionBlur, WhipPan
59
62
  - **page**: BookFlip, InvertedPageCurl
60
63
  - **psychedelic**: ColorWrap, CrazyParametricFun
61
64
  - **ripple**: Ripple, WaterDrop
65
+ - **roll**: CylinderRoll, Rolls
62
66
  - **slices**: Shred, WindowSlices
63
- - **spin**: RotateFade, RotateScaleVanish
64
67
  - **swirl**: Revolve, Swirl
65
68
  - **blinds**: WindowBlinds
66
69
  - **blocks**: BlockDissolve
67
70
  - **bounce**: Bounce
68
71
  - **cards**: StereoViewer
72
+ - **chromatic-aberration**: Refraction
69
73
  - **columns**: DoomMelt
70
74
  - **cube**: Cube
71
75
  - **curl**: InvertedPageCurl
72
76
  - **datamosh**: StripDatamoshGlitch
77
+ - **distortion**: Refraction
73
78
  - **doors**: Doorway
74
79
  - **edges**: EdgeGlow
75
80
  - **film**: FilmBurn
76
81
  - **fire**: BurnThrough
82
+ - **flare**: LightStreaks
77
83
  - **flicker**: GlitchFlicker
78
- - **glow**: GlowDissolve
79
84
  - **grayscale**: FadeGrayscale
80
85
  - **heart**: HeartWipe
81
86
  - **hue**: HsvFade
82
- - **light**: Overexposure
83
87
  - **light-leak**: FilmBurn
84
88
  - **lines**: Crosshatch
85
89
  - **mask**: LumaWipe
@@ -87,10 +91,12 @@
87
91
  - **motion**: LissajousTiles
88
92
  - **pinwheel**: Pinwheel
89
93
  - **polar**: FlowerWipe
90
- - **roll**: Rolls
94
+ - **refraction**: Refraction
91
95
  - **shatter**: Shatter
96
+ - **smear**: PixelStretch
92
97
  - **squeeze**: Squeeze
93
98
  - **star**: StarWipe
99
+ - **streaks**: PixelStretch
94
100
  - **swap**: Swap
95
101
  - **water**: WaterDrop
96
102
 
@@ -123,6 +129,7 @@
123
129
  - `Crosshatch`: The incoming image appears through a crosshatch of lines spreading from the center. Params: center (vec2 = vec2(0.5, 0.5)), threshold (float = 3), fadeEdge (float = 0.1)
124
130
  - `Cube`: The two images are faces of a rotating 3D cube, with a floor reflection. Params: persp (float = 0.7), unzoom (float = 0.3), reflection (float = 0.4), floating (float = 3)
125
131
  - `Curtains`: The outgoing image parts in the middle like stage curtains, gathering into shaded folds as it is pulled to the sides. Params: folds (float = 7), shading (float = 0.7), bunch (float = 0.12), sway (float = 0.4)
132
+ - `CylinderRoll`: The frame wraps around a drum that rolls up, the outgoing image turning away over its top in a motion blur and the incoming one coming around from below and unrolling flat. Params: curvature (float = 0.8), blur (float = 0.5), shading (float = 0.6), chroma (float = 0.5), downward (bool = false)
126
133
  - `DefocusBlur`: A crossfade through an out-of-focus blur. Params: blurSize (float = 0.02)
127
134
  - `DiamondWipe`: A soft-edged diamond grows from the center to reveal the incoming image. Params: center (vec2 = vec2(0.5, 0.5)), smoothness (float = 0.03)
128
135
  - `Directional`: The incoming image pushes the outgoing one out in a given direction. Params: direction (vec2 = vec2(0, 1))
@@ -164,6 +171,7 @@
164
171
  - `Kaleidoscope`: A crossfade through a spinning kaleidoscope. Params: speed (float = 1), angle (float = 1), power (float = 1.5)
165
172
  - `LeafWipe`: A leaf shape grows from the center to reveal the incoming image
166
173
  - `LeftRight`: The outgoing image shrinks away to the left while the incoming one slides in from the right
174
+ - `LightStreaks`: 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. Params: reach (float = 0.6), threshold (float = 0.7), intensity (float = 1.5), tint (vec3 = vec3(0.45, 0.7, 1)), blur (float = 0.1), vertical (bool = false)
167
175
  - `LinearBlur`: A crossfade through a blur. Params: intensity (float = 0.1)
168
176
  - `LissajousTiles`: The image breaks into a grid of tiles that swirl along Lissajous curves, in a Scanimate style, and flip one by one to the incoming image before settling back. Params: speed (float = 0.5), freq (vec2 = vec2(2, 3)), offset (float = 2), zoom (float = 0.8), fade (float = 3)
169
177
  - `LumaWipe`: A wipe that follows the brightness of a grayscale mask (the luma texture). Extra textures: luma
@@ -178,6 +186,7 @@
178
186
  - `PaperTear`: The outgoing image tears in two along a ragged line, and the halves are pulled apart to reveal the incoming one. Params: roughness (float = 0.12), tilt (float = 0.1), rim (float = 0.012), paper (vec4 = vec4(1, 0.98, 0.94, 1)), shadow (vec4 = vec4(0, 0, 0, 0.35))
179
187
  - `PerlinDissolve`: The incoming image appears through blobs of Perlin noise. Params: scale (float = 4), smoothness (float = 0.01), seed (float = 12.9898)
180
188
  - `Pinwheel`: A spinning pinwheel reveals the incoming image. Params: speed (float = 2)
189
+ - `PixelStretch`: 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. Params: direction (vec2 = vec2(1, 0)), stretch (float = 0.45), chroma (float = 0.5), softness (float = 0.03), jitter (float = 0.5)
181
190
  - `Pixelize`: Both images pixelate, crossfade, then sharpen again. Params: squaresMin (ivec2 = ivec2(20, 20)), steps (int = 50)
182
191
  - `PolkaDotsCurtain`: The incoming image appears through growing polka dots. Params: dots (float = 20), center (vec2 = vec2(0, 0))
183
192
  - `PowerKaleido`: The image folds into an animated kaleidoscope before revealing the incoming one. Params: scale (float = 2), z (float = 1.5), speed (float = 5)
@@ -187,6 +196,7 @@
187
196
  - `RandomSquares`: The incoming image appears in random squares. Params: size (ivec2 = ivec2(10, 10)), smoothness (float = 0.5)
188
197
  - `RectangleCover`: A rectangle grows from the center to cover the outgoing image, then shrinks to reveal the incoming one. Params: bgcolor (vec4 = vec4(0, 0, 0, 1))
189
198
  - `RectangleIris`: The outgoing image shrinks into a small rectangle over a background color, then the incoming one grows from it. Params: bgcolor (vec4 = vec4(0, 0, 0, 1))
199
+ - `Refraction`: 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. Params: strength (float = 0.15), scale (float = 2.5), dispersion (float = 0.5), brightness (float = 1)
190
200
  - `Revolve`: The outgoing image swirls and zooms with motion blur into the incoming one. Params: center (vec2 = vec2(0.46, 0.52)), direction (float = -1), maxRotation (float = 1.95), peakZoom (float = 2.22), swirl (float = 2.85), barrel (float = 0.38), motionBlur (float = 1), switchStart (float = 0.3), switchEnd (float = 0.5), shadow (float = 0.16)
191
201
  - `Ripple`: Ripples spread from the center while crossfading. Params: amplitude (float = 100), speed (float = 50)
192
202
  - `Rolls`: The outgoing image rolls away around a corner, revealing the incoming one. Params: type (int = 0), RotDown (bool = false)
@@ -230,6 +240,8 @@
230
240
  - `VerticalOpen`: The incoming image opens from a line in the middle toward the left and right edges
231
241
  - `WaterDrop`: Ripples spread from the center like a drop falling into water, crossfading to the incoming image. Params: amplitude (float = 30), speed (float = 30)
232
242
  - `WhipPan`: A fast camera pan that streaks both images with motion blur, the incoming one arriving from the opposite side. Params: direction (vec2 = vec2(-1, 0)), blur (float = 0.4)
243
+ - `WhipSpin`: The camera rolls faster and faster around the center of the frame, streaking the outgoing image in a spin blur, then the incoming one takes over mid-spin and slows to a stop. Params: turns (float = 1), blur (float = 0.5), chroma (float = 0.6), zoom (float = 0.25)
244
+ - `WhipTilt`: The camera tilts fast from the outgoing image to the incoming one, set edge to edge at an angle above it, streaking both in perspective with a vertical motion blur. Params: down (bool = false), blur (float = 0.5), chroma (float = 0.5), perspective (float = 0.7)
233
245
  - `Wind`: A ragged left-to-right wipe, as if the image was blown away by the wind. Params: size (float = 0.2), reversed (bool = false)
234
246
  - `WindowBlinds`: A crossfade through horizontal window blinds
235
247
  - `WindowSlices`: The incoming image appears through vertical slices that widen. Params: count (float = 10), smoothness (float = 0.5)
@@ -0,0 +1,112 @@
1
+ // CylinderRoll — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/CylinderRoll.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The frame wraps around a drum that rolls up, the outgoing image turning away over its top in a motion blur and the incoming one coming around from below and unrolling flat
5
+
6
+ uniform shader _from;
7
+ uniform shader _to;
8
+ uniform float2 _resolution;
9
+ uniform float progress;
10
+ uniform float ratio;
11
+
12
+ vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
13
+ vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
14
+
15
+ uniform float curvature;
16
+
17
+ uniform float blur;
18
+
19
+ uniform float shading;
20
+
21
+ uniform float chroma;
22
+
23
+ uniform int downward;
24
+
25
+ const int SAMPLES = 24;
26
+
27
+ const float MAX_ANGLE = 1.1;
28
+
29
+ const float DIST = 2.6;
30
+
31
+ const float ARC = 0.12;
32
+
33
+ float hash(vec2 c) {
34
+ vec2 q = fract(c * vec2(0.1031, 0.1030));
35
+ q += dot(q, q.yx + 33.33);
36
+ return fract((q.x + q.y) * q.x);
37
+ }
38
+
39
+ float fold(float v) {
40
+ return 1.0 - abs(1.0 - mod(v, 2.0));
41
+ }
42
+
43
+ vec4 strip(float x, float v) {
44
+ if ((downward != 0) ? v > 1.0 : v < 0.0) {
45
+ return getToColor(vec2(x, fold((downward != 0) ? v - 1.0 : v + 1.0)));
46
+ }
47
+ return getFromColor(vec2(x, fold(v)));
48
+ }
49
+
50
+ float angleAt(float c) {
51
+ c = clamp(c, -0.98 / sqrt(DIST * DIST - 1.0), 0.98 / sqrt(DIST * DIST - 1.0));
52
+ return asin(c * DIST / sqrt(1.0 + c * c)) - atan(c);
53
+ }
54
+
55
+ vec4 transition(vec2 uv) {
56
+ float p = progress;
57
+
58
+ float h = 1.0 - abs(2.0 * p - 1.0);
59
+ float e = 0.5 * h * (0.1 + 0.9 * h * h);
60
+ float roll = p < 0.5 ? e : 1.0 - e;
61
+
62
+ float h3 = h * h * h;
63
+ float peak = h3 * h3;
64
+
65
+
66
+ float bend = curvature * (p < 0.5 ? h * (2.0 - h) : h * h * (3.0 - 2.0 * h));
67
+ float phi = MAX_ANGLE * bend + 1e-4;
68
+ float arcK = ARC * bend;
69
+
70
+ float edgeY = sin(phi) / (DIST - cos(phi));
71
+
72
+ vec2 n = 2.0 * uv - 1.0;
73
+
74
+ float xr = n.x * ratio;
75
+ float yn = n.y * (1.0 + arcK * xr * xr);
76
+ float theta = angleAt(yn * edgeY);
77
+
78
+ float thetaCorner = angleAt((1.0 + arcK * ratio * ratio) * edgeY);
79
+ float width = (DIST - 1.0) / (DIST - cos(theta));
80
+ float zoom = (DIST - cos(thetaCorner)) / (DIST - 1.0);
81
+ float x = 0.5 + 0.5 * n.x / (zoom * width);
82
+
83
+ float facing = (DIST * cos(theta) - 1.0)
84
+ / sqrt(1.0 + DIST * DIST - 2.0 * DIST * cos(theta)) ;
85
+ float light = mix(1.0, clamp(facing, 0.0, 1.0), shading);
86
+
87
+
88
+ float v = 0.5 * (theta / phi + 1.0) + ((downward != 0) ? roll : -roll);
89
+ float len = 0.5 * blur * peak;
90
+ float split = chroma * peak;
91
+ float jitter = hash(uv * 1000.0);
92
+ vec3 color = vec3(0.0);
93
+ vec3 weight = vec3(0.0);
94
+ float alpha = 0.0;
95
+ for (int i = 0; i < SAMPLES; i++) {
96
+ float t = (float(i) + jitter) / float(SAMPLES) - 0.5;
97
+ vec4 img = strip(x, v + t * len);
98
+
99
+ vec3 w = vec3(max(1.0 - 4.0 * split * t, 0.0), 1.0, max(1.0 + 4.0 * split * t, 0.0));
100
+ color += img.rgb * img.a * w;
101
+ weight += img.a * w;
102
+ alpha += img.a;
103
+ }
104
+ color = color / max(weight, vec3(1e-5));
105
+ return vec4(color * light, alpha / float(SAMPLES));
106
+ }
107
+
108
+ half4 main(float2 _coord) {
109
+ vec2 _uv = _coord / _resolution;
110
+ vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
111
+ return half4(_c.rgb * _c.a, _c.a);
112
+ }
@@ -0,0 +1,126 @@
1
+ // LightStreaks — 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
+
6
+ uniform shader _from;
7
+ uniform shader _to;
8
+ uniform float2 _resolution;
9
+ uniform float progress;
10
+ uniform float ratio;
11
+
12
+ vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
13
+ vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
14
+
15
+ uniform float reach;
16
+
17
+ uniform float threshold;
18
+
19
+ uniform float intensity;
20
+
21
+ uniform vec3 tint;
22
+
23
+ uniform float blur;
24
+
25
+ uniform int vertical;
26
+
27
+ const int BLUR_TAPS = 6;
28
+
29
+ const int STREAK_TAPS = 11;
30
+
31
+ float hash12(vec2 v) {
32
+ vec3 v3 = fract(vec3(v.xyx) * 0.1031);
33
+ v3 += dot(v3, v3.yzx + 33.33);
34
+ return fract((v3.x + v3.y) * v3.z);
35
+ }
36
+
37
+ vec2 mirror(vec2 v) {
38
+ return 1.0 - abs(1.0 - mod(v, 2.0));
39
+ }
40
+
41
+ vec4 frame(vec2 st, float m) {
42
+ if (m <= 0.0) return getFromColor(st);
43
+ if (m >= 1.0) return getToColor(st);
44
+ return mix(getFromColor(st), getToColor(st), m);
45
+ }
46
+
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
+ vec4 light(vec2 st, float m, bool incoming) {
53
+ if (m <= 0.0) return getFromColor(st);
54
+ if (m >= 1.0) return getToColor(st);
55
+ return incoming ? getToColor(st) : getFromColor(st);
56
+ }
57
+
58
+ float lightWeight(float m, bool incoming) {
59
+ if (m <= 0.0 || m >= 1.0) return 1.0;
60
+ return incoming ? 2.0 * m : 2.0 * (1.0 - m);
61
+ }
62
+
63
+ vec4 transition(vec2 uv) {
64
+ float p = progress;
65
+
66
+ float amount = p < 0.5 ? smoothstep(0.0, 0.5, p) : pow(2.0 - 2.0 * p, 3.0);
67
+ float peak = amount * amount * amount;
68
+ float m = smoothstep(0.44, 0.56, p);
69
+ vec2 axis = (vertical != 0) ? vec2(0.0, 1.0) : vec2(1.0, 0.0);
70
+
71
+
72
+ float jitter = hash12(floor(uv * vec2(ratio, 1.0) * 997.0)) - 0.5;
73
+
74
+
75
+ float smear = blur * amount;
76
+ vec3 base = vec3(0.0);
77
+ float alpha = 0.0;
78
+ float total = 0.0;
79
+ for (int i = 0; i < BLUR_TAPS; i++) {
80
+ float t = (float(i) + 0.5 + jitter) / float(BLUR_TAPS) - 0.5;
81
+ float w = 1.0 - abs(t);
82
+ total += w;
83
+ bool incoming = mod(float(i), 2.0) > 0.5;
84
+ w *= lightWeight(m, incoming);
85
+ vec4 c = light(mirror(uv + axis * t * smear), m, incoming);
86
+ base += w * c.rgb * c.a;
87
+ alpha += w * c.a;
88
+ }
89
+ base /= total;
90
+ alpha /= total;
91
+
92
+
93
+ float falloff = 0.25 * reach * amount;
94
+ float knee = mix(threshold, 0.8 * threshold, peak);
95
+ vec3 streak = glow(frame(uv, m), knee);
96
+ float weights = 1.0;
97
+ for (int k = 1; k <= STREAK_TAPS; k++) {
98
+
99
+ float d = exp(0.14 * (float(k) + 0.8 * jitter)) - 1.0;
100
+ float span = 0.14 * (d + 1.0);
101
+
102
+ vec3 hue = mix(vec3(1.0), tint, smoothstep(0.0, 0.8, d));
103
+ hue *= exp(-d * vec3(0.6, 0.2, -0.15));
104
+ float w = exp(-d) * span * 4.0;
105
+ bool incoming = mod(float(k), 2.0) > 0.5;
106
+ vec4 ahead = light(mirror(uv + axis * d * falloff), m, incoming);
107
+ vec4 behind = light(mirror(uv - axis * d * falloff), m, !incoming);
108
+ streak += w * hue * (glow(ahead, knee) * lightWeight(m, incoming) + glow(behind, knee) * lightWeight(m, !incoming));
109
+ weights += 2.0 * w;
110
+ }
111
+ streak *= intensity * amount * (0.6 + 2.4 * peak) * 2.0 / weights;
112
+
113
+ streak = 0.85 * (1.0 - exp(-streak));
114
+
115
+
116
+ base = min(base * (1.0 + 0.2 * peak), vec3(alpha));
117
+ vec3 color = base + streak - base * streak;
118
+ float a = alpha + max(streak.r, max(streak.g, streak.b)) * (1.0 - alpha);
119
+ return vec4(clamp(color / max(a, 1e-5), 0.0, 1.0), a);
120
+ }
121
+
122
+ half4 main(float2 _coord) {
123
+ vec2 _uv = _coord / _resolution;
124
+ vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
125
+ return half4(_c.rgb * _c.a, _c.a);
126
+ }
@@ -0,0 +1,84 @@
1
+ // PixelStretch — 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
+
6
+ uniform shader _from;
7
+ uniform shader _to;
8
+ uniform float2 _resolution;
9
+ uniform float progress;
10
+ uniform float ratio;
11
+
12
+ vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
13
+ vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
14
+
15
+ uniform vec2 direction;
16
+
17
+ uniform float stretch;
18
+
19
+ uniform float chroma;
20
+
21
+ uniform float softness;
22
+
23
+ uniform float jitter;
24
+
25
+ float hash(float n) {
26
+ n = fract(n * 0.1031);
27
+ n *= n + 33.33;
28
+ n *= n + n;
29
+ return fract(n);
30
+ }
31
+
32
+ float smax(float x, float y, float k) {
33
+ float h = max(k - abs(x - y), 0.0) / k;
34
+ return max(x, y) + h * h * k * 0.25;
35
+ }
36
+
37
+ vec2 at(vec2 uv, float s0, float s, vec2 d, float ext) {
38
+ return clamp(uv + d * (s - s0) * ext, 0.0, 1.0);
39
+ }
40
+
41
+ vec4 transition(vec2 uv) {
42
+ vec2 d = normalize(direction + vec2(1e-6, 0.0));
43
+
44
+ float ext = abs(d.x) + abs(d.y);
45
+ float s = 0.5 + dot(uv - 0.5, d) / ext;
46
+
47
+ vec2 n = vec2(-d.y, d.x);
48
+ float t = dot((uv - 0.5) * vec2(ratio, 1.0), n);
49
+ float row = floor(t * 540.0);
50
+ float clump = floor(t * 60.0);
51
+ float rnd = 0.6 * hash(row + 17.0) + 0.4 * hash(clump + 311.0);
52
+
53
+ float p = progress;
54
+ float k = softness + 1e-4;
55
+
56
+
57
+ float margin = k + 0.002;
58
+ float a = mix(-margin, 1.0 + margin, mix(p, p * p * (3.0 - 2.0 * p), 0.5));
59
+
60
+
61
+
62
+ float h = clamp(4.0 * a * (1.0 - a), 0.0, 1.0);
63
+ float len = stretch * h * (1.0 - 0.6 * jitter * rnd);
64
+ float split = 0.02 * chroma * h;
65
+
66
+
67
+ vec4 fr = getFromColor(at(uv, s, smax(s, a + split, k), d, ext));
68
+ vec4 fg = getFromColor(at(uv, s, smax(s, a, k), d, ext));
69
+ vec4 fb = getFromColor(at(uv, s, smax(s, a - split, k), d, ext));
70
+ vec4 streak = vec4(fr.r, fg.g, fb.b, fg.a);
71
+
72
+ float behind = step(s, a);
73
+ streak.rgb *= 1.0 + 0.06 * jitter * h * (hash(row * 3.0 + 5.0) - 0.5) * behind;
74
+
75
+
76
+ float w = smoothstep(len - k, len + k, a - s);
77
+ return mix(streak, getToColor(uv), w);
78
+ }
79
+
80
+ half4 main(float2 _coord) {
81
+ vec2 _uv = _coord / _resolution;
82
+ vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
83
+ return half4(_c.rgb * _c.a, _c.a);
84
+ }
@@ -0,0 +1,103 @@
1
+ // Refraction — 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
+
6
+ uniform shader _from;
7
+ uniform shader _to;
8
+ uniform float2 _resolution;
9
+ uniform float progress;
10
+ uniform float ratio;
11
+
12
+ vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
13
+ vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
14
+
15
+ uniform float strength;
16
+
17
+ uniform float scale;
18
+
19
+ uniform float dispersion;
20
+
21
+ uniform float brightness;
22
+
23
+ const int TAPS = 7;
24
+
25
+ float surface(vec2 q, float t) {
26
+ q += 0.45 * vec2(sin(1.3 * q.y + 0.9 * t), sin(1.1 * q.x - 1.2 * t));
27
+ float h = sin(q.x + 0.6 * t) * sin(1.2 * q.y - 0.8 * t);
28
+ h += 0.5 * sin(dot(q, vec2(1.6, -1.2)) + 1.4 * t);
29
+ h += 0.3 * sin(dot(q, vec2(-1.1, 2.9)) - 1.9 * t + 1.7 * sin(0.9 * q.x));
30
+ h += 0.15 * sin(dot(q, vec2(4.3, 3.1)) + 2.6 * t);
31
+ return h;
32
+ }
33
+
34
+ float hash12(vec2 v) {
35
+ vec3 v3 = fract(vec3(v.xyx) * 0.1031);
36
+ v3 += dot(v3, v3.yzx + 33.33);
37
+ return fract((v3.x + v3.y) * v3.z);
38
+ }
39
+
40
+ vec2 mirror(vec2 v) {
41
+ return 1.0 - abs(1.0 - mod(v, 2.0));
42
+ }
43
+
44
+ vec3 spectrum(float w) {
45
+ vec3 c = vec3(
46
+ 1.0 - smoothstep(0.0, 0.55, w) + 0.35 * smoothstep(0.75, 1.0, w),
47
+ 1.0 - abs(2.0 * w - 1.0) * 1.2,
48
+ smoothstep(0.45, 1.0, w)
49
+ );
50
+ return clamp(c, 0.0, 1.0);
51
+ }
52
+
53
+ vec4 transition(vec2 uv) {
54
+ float p = progress;
55
+
56
+ float h = 1.0 - abs(2.0 * p - 1.0);
57
+ float amount = h * h * (2.0 - h);
58
+
59
+
60
+ vec2 q = (uv - 0.5) * vec2(ratio, 1.0) * scale;
61
+ float t = 3.0 * p;
62
+ float e = 0.01;
63
+ vec2 slope = vec2(
64
+ surface(q + vec2(e, 0.0), t) - surface(q - vec2(e, 0.0), t),
65
+ surface(q + vec2(0.0, e), t) - surface(q - vec2(0.0, e), t)
66
+ ) / (2.0 * e);
67
+ vec2 offset = slope * strength * amount / scale;
68
+
69
+
70
+ float wave = clamp(0.5 * surface(q, t), -1.0, 1.0);
71
+ float m = smoothstep(-0.015, 0.015, p - 0.5 + 0.1 * wave);
72
+
73
+
74
+ vec3 color = vec3(0.0);
75
+ vec3 weights = vec3(0.0);
76
+ float alpha = 0.0;
77
+
78
+ float jitter = hash12(uv * vec2(ratio, 1.0) * 1000.0) - 0.5;
79
+ for (int i = 0; i < TAPS; i++) {
80
+ float w = float(i) / float(TAPS - 1);
81
+ float wj = (float(i) + jitter) / float(TAPS - 1);
82
+ vec2 st = mirror(uv + offset * (1.0 + dispersion * (wj - 0.5) * 1.6));
83
+ vec4 c = mix(getFromColor(st), getToColor(st), m);
84
+ vec3 s = spectrum(w);
85
+ color += s * c.rgb * c.a;
86
+ weights += s;
87
+ alpha += c.a;
88
+ }
89
+ alpha /= float(TAPS);
90
+ color = color / weights / max(alpha, 1e-5);
91
+
92
+
93
+ float flare = 2.0 * brightness * pow(h, 8.0);
94
+ color = color * (1.0 + flare) / (1.0 + flare * color);
95
+ color += 0.1 * flare * dot(color, vec3(0.3333));
96
+ return vec4(clamp(color, 0.0, 1.0), alpha);
97
+ }
98
+
99
+ half4 main(float2 _coord) {
100
+ vec2 _uv = _coord / _resolution;
101
+ vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
102
+ return half4(_c.rgb * _c.a, _c.a);
103
+ }
@@ -0,0 +1,79 @@
1
+ // WhipSpin — generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/WhipSpin.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The camera rolls faster and faster around the center of the frame, streaking the outgoing image in a spin blur, then the incoming one takes over mid-spin and slows to a stop
5
+
6
+ uniform shader _from;
7
+ uniform shader _to;
8
+ uniform float2 _resolution;
9
+ uniform float progress;
10
+ uniform float ratio;
11
+
12
+ vec4 getFromColor(vec2 uv) { return vec4(unpremul(_from.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
13
+ vec4 getToColor(vec2 uv) { return vec4(unpremul(_to.eval(vec2(uv.x, 1.0 - uv.y) * _resolution))); }
14
+
15
+ uniform float turns;
16
+
17
+ uniform float blur;
18
+
19
+ uniform float chroma;
20
+
21
+ uniform float zoom;
22
+
23
+ const float PI = 3.141592653589793;
24
+ const int SAMPLES = 24;
25
+
26
+ float hash(vec2 p) {
27
+ vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
28
+ p3 += dot(p3, p3.yzx + 33.33);
29
+ return fract((p3.x + p3.y) * p3.z);
30
+ }
31
+
32
+ vec2 mirror(vec2 v) {
33
+ vec2 m = mod(v, 2.0);
34
+ return mix(m, 2.0 - m, step(1.0, m));
35
+ }
36
+
37
+ float rollAngle(float t) {
38
+ float halfTurn = PI * turns;
39
+ if (t < 0.5) {
40
+ float x = 2.0 * t;
41
+ return halfTurn * x * x * x;
42
+ }
43
+ float x = 2.0 - 2.0 * t;
44
+ return -halfTurn * x * x * x;
45
+ }
46
+
47
+ vec4 transition(vec2 uv) {
48
+ float p = progress;
49
+ float h = 1.0 - abs(2.0 * p - 1.0);
50
+
51
+ float shutter = blur * 0.1 * h;
52
+ float scale = 1.0 + zoom * h * h * h;
53
+ vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
54
+ float jitter = hash(uv * vec2(ratio, 1.0) * 731.0);
55
+ vec3 color = vec3(0.0);
56
+ vec3 weight = vec3(0.0);
57
+ float alpha = 0.0;
58
+ for (int i = 0; i < SAMPLES; i++) {
59
+ float s = (float(i) + jitter) / float(SAMPLES) - 0.5;
60
+ float t = clamp(p + s * shutter, 0.0, 1.0);
61
+ float a = rollAngle(t);
62
+ float c = cos(a), sn = sin(a);
63
+ vec2 r = vec2(c * q.x + sn * q.y, -sn * q.x + c * q.y) / scale;
64
+ vec2 suv = mirror(r / vec2(ratio, 1.0) + 0.5);
65
+ vec4 col = t < 0.5 ? getFromColor(suv) : getToColor(suv);
66
+
67
+ vec3 w = max(vec3(1.0 - 4.0 * chroma * s, 1.0, 1.0 + 4.0 * chroma * s), 0.0);
68
+ color += col.rgb * col.a * w;
69
+ weight += col.a * w;
70
+ alpha += col.a;
71
+ }
72
+ return vec4(color / max(weight, vec3(1e-5)), alpha / float(SAMPLES));
73
+ }
74
+
75
+ half4 main(float2 _coord) {
76
+ vec2 _uv = _coord / _resolution;
77
+ vec4 _c = clamp(transition(vec2(_uv.x, 1.0 - _uv.y)), 0.0, 1.0);
78
+ return half4(_c.rgb * _c.a, _c.a);
79
+ }