gl-transitions 3.0.0 → 3.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.
- package/CHANGELOG.md +80 -0
- package/compatibility.json +455 -11
- package/gl-transitions.js +1 -1
- package/gl-transitions.json +1 -1
- package/glsl3/BookFlip.glsl +124 -21
- package/glsl3/CircleBurst.glsl +77 -0
- package/glsl3/Clothesline.glsl +217 -0
- package/glsl3/CodeRain.glsl +114 -0
- package/glsl3/ComicPanels.glsl +174 -0
- package/glsl3/Cube.glsl +105 -52
- package/glsl3/CurtainRise.glsl +71 -0
- package/glsl3/DominoFall.glsl +114 -0
- package/glsl3/Doorway.glsl +74 -38
- package/glsl3/Drape.glsl +186 -0
- package/glsl3/DuotoneFade.glsl +58 -0
- package/glsl3/FacetedGlass.glsl +137 -0
- package/glsl3/FrostWipe.glsl +176 -0
- package/glsl3/Funnel.glsl +71 -0
- package/glsl3/GlitterDissolve.glsl +171 -0
- package/glsl3/GravityLens.glsl +66 -0
- package/glsl3/GridFlip.glsl +151 -56
- package/glsl3/HeartWipe.glsl +71 -11
- package/glsl3/InsideCube.glsl +114 -0
- package/glsl3/KeyholeWipe.glsl +104 -0
- package/glsl3/LedWall.glsl +127 -0
- package/glsl3/MoireWipe.glsl +75 -0
- package/glsl3/PaperFold.glsl +168 -0
- package/glsl3/PuzzleCube.glsl +205 -0
- package/glsl3/RibbonTwist.glsl +53 -0
- package/glsl3/RingSpin.glsl +112 -0
- package/glsl3/Shatter.glsl +231 -35
- package/glsl3/SketchDissolve.glsl +100 -0
- package/glsl3/SlotReels.glsl +118 -0
- package/glsl3/SplitFlap.glsl +124 -0
- package/glsl3/SpotlightWipe.glsl +63 -0
- package/glsl3/Swirl.glsl +52 -21
- package/glsl3/TruchetWipe.glsl +80 -0
- package/glsl3/Tumble.glsl +113 -0
- package/glsl3/WaterDrop.glsl +69 -13
- package/glsl3/WaveWipe.glsl +154 -0
- package/index.js +1 -1
- package/layouts.json +1232 -29
- package/llms-full.txt +890 -403
- package/llms.txt +225 -197
- package/msl/BookFlip.metal +575 -114
- package/msl/CircleBurst.metal +351 -0
- package/msl/Clothesline.metal +828 -0
- package/msl/CodeRain.metal +451 -0
- package/msl/ComicPanels.metal +959 -0
- package/msl/Cube.metal +466 -170
- package/msl/CurtainRise.metal +263 -0
- package/msl/DominoFall.metal +510 -0
- package/msl/Doorway.metal +350 -124
- package/msl/Drape.metal +767 -0
- package/msl/DuotoneFade.metal +218 -0
- package/msl/FacetedGlass.metal +529 -0
- package/msl/FrostWipe.metal +677 -0
- package/msl/Funnel.metal +276 -0
- package/msl/GlitterDissolve.metal +637 -0
- package/msl/GravityLens.metal +236 -0
- package/msl/GridFlip.metal +548 -191
- package/msl/HeartWipe.metal +230 -58
- package/msl/InsideCube.metal +537 -0
- package/msl/KeyholeWipe.metal +370 -0
- package/msl/LedWall.metal +437 -0
- package/msl/MoireWipe.metal +252 -0
- package/msl/PaperFold.metal +762 -0
- package/msl/PuzzleCube.metal +1179 -0
- package/msl/RibbonTwist.metal +235 -0
- package/msl/RingSpin.metal +474 -0
- package/msl/Shatter.metal +1136 -160
- package/msl/SketchDissolve.metal +446 -0
- package/msl/SlotReels.metal +436 -0
- package/msl/SplitFlap.metal +589 -0
- package/msl/SpotlightWipe.metal +217 -0
- package/msl/Swirl.metal +144 -77
- package/msl/TruchetWipe.metal +285 -0
- package/msl/Tumble.metal +466 -0
- package/msl/WaterDrop.metal +258 -49
- package/msl/WaveWipe.metal +618 -0
- package/package.json +1 -1
- package/skills/gl-transitions/references/catalog.md +115 -57
- package/sksl/BookFlip.sksl +117 -20
- package/sksl/CircleBurst.sksl +84 -0
- package/sksl/Clothesline.sksl +217 -0
- package/sksl/CodeRain.sksl +124 -0
- package/sksl/ComicPanels.sksl +176 -0
- package/sksl/Cube.sksl +99 -46
- package/sksl/CurtainRise.sksl +84 -0
- package/sksl/DominoFall.sksl +122 -0
- package/sksl/Doorway.sksl +65 -35
- package/sksl/Drape.sksl +192 -0
- package/sksl/DuotoneFade.sksl +71 -0
- package/sksl/FacetedGlass.sksl +148 -0
- package/sksl/FrostWipe.sksl +183 -0
- package/sksl/Funnel.sksl +83 -0
- package/sksl/GlitterDissolve.sksl +175 -0
- package/sksl/GravityLens.sksl +77 -0
- package/sksl/GridFlip.sksl +141 -52
- package/sksl/HeartWipe.sksl +60 -11
- package/sksl/InsideCube.sksl +123 -0
- package/sksl/KeyholeWipe.sksl +109 -0
- package/sksl/LedWall.sksl +137 -0
- package/sksl/MoireWipe.sksl +85 -0
- package/sksl/PaperFold.sksl +170 -0
- package/sksl/PuzzleCube.sksl +203 -0
- package/sksl/RibbonTwist.sksl +66 -0
- package/sksl/RingSpin.sksl +121 -0
- package/sksl/Shatter.sksl +218 -33
- package/sksl/SketchDissolve.sksl +111 -0
- package/sksl/SlotReels.sksl +127 -0
- package/sksl/SplitFlap.sksl +131 -0
- package/sksl/SpotlightWipe.sksl +74 -0
- package/sksl/Swirl.sksl +49 -20
- package/sksl/TruchetWipe.sksl +92 -0
- package/sksl/Tumble.sksl +122 -0
- package/sksl/WaterDrop.sksl +64 -10
- package/sksl/WaveWipe.sksl +165 -0
- package/sksl/index.js +1 -1
- package/transitions/BookFlip.glsl +124 -21
- package/transitions/CircleBurst.glsl +76 -0
- package/transitions/Clothesline.glsl +216 -0
- package/transitions/CodeRain.glsl +113 -0
- package/transitions/ComicPanels.glsl +173 -0
- package/transitions/Cube.glsl +105 -52
- package/transitions/CurtainRise.glsl +70 -0
- package/transitions/DominoFall.glsl +113 -0
- package/transitions/Doorway.glsl +74 -38
- package/transitions/Drape.glsl +185 -0
- package/transitions/DuotoneFade.glsl +57 -0
- package/transitions/FacetedGlass.glsl +136 -0
- package/transitions/FrostWipe.glsl +175 -0
- package/transitions/Funnel.glsl +70 -0
- package/transitions/GlitterDissolve.glsl +170 -0
- package/transitions/GravityLens.glsl +65 -0
- package/transitions/GridFlip.glsl +151 -56
- package/transitions/HeartWipe.glsl +71 -11
- package/transitions/InsideCube.glsl +113 -0
- package/transitions/KeyholeWipe.glsl +103 -0
- package/transitions/LedWall.glsl +126 -0
- package/transitions/MoireWipe.glsl +74 -0
- package/transitions/PaperFold.glsl +167 -0
- package/transitions/PuzzleCube.glsl +204 -0
- package/transitions/RibbonTwist.glsl +52 -0
- package/transitions/RingSpin.glsl +111 -0
- package/transitions/Shatter.glsl +231 -35
- package/transitions/SketchDissolve.glsl +99 -0
- package/transitions/SlotReels.glsl +117 -0
- package/transitions/SplitFlap.glsl +123 -0
- package/transitions/SpotlightWipe.glsl +62 -0
- package/transitions/Swirl.glsl +52 -21
- package/transitions/TruchetWipe.glsl +79 -0
- package/transitions/Tumble.glsl +112 -0
- package/transitions/WaterDrop.glsl +69 -13
- package/transitions/WaveWipe.glsl +153 -0
- package/wgsl/BookFlip.wgsl +552 -105
- package/wgsl/CircleBurst.wgsl +310 -0
- package/wgsl/Clothesline.wgsl +756 -0
- package/wgsl/CodeRain.wgsl +415 -0
- package/wgsl/ComicPanels.wgsl +886 -0
- package/wgsl/Cube.wgsl +461 -156
- package/wgsl/CurtainRise.wgsl +235 -0
- package/wgsl/DominoFall.wgsl +461 -0
- package/wgsl/Doorway.wgsl +333 -117
- package/wgsl/Drape.wgsl +715 -0
- package/wgsl/DuotoneFade.wgsl +185 -0
- package/wgsl/FacetedGlass.wgsl +476 -0
- package/wgsl/FrostWipe.wgsl +617 -0
- package/wgsl/Funnel.wgsl +248 -0
- package/wgsl/GlitterDissolve.wgsl +582 -0
- package/wgsl/GravityLens.wgsl +206 -0
- package/wgsl/GridFlip.wgsl +523 -188
- package/wgsl/HeartWipe.wgsl +225 -55
- package/wgsl/InsideCube.wgsl +496 -0
- package/wgsl/KeyholeWipe.wgsl +337 -0
- package/wgsl/LedWall.wgsl +397 -0
- package/wgsl/MoireWipe.wgsl +222 -0
- package/wgsl/PaperFold.wgsl +700 -0
- package/wgsl/PuzzleCube.wgsl +1087 -0
- package/wgsl/RibbonTwist.wgsl +206 -0
- package/wgsl/RingSpin.wgsl +426 -0
- package/wgsl/Shatter.wgsl +1091 -148
- package/wgsl/SketchDissolve.wgsl +409 -0
- package/wgsl/SlotReels.wgsl +391 -0
- package/wgsl/SplitFlap.wgsl +533 -0
- package/wgsl/SpotlightWipe.wgsl +186 -0
- package/wgsl/Swirl.wgsl +138 -77
- package/wgsl/TruchetWipe.wgsl +255 -0
- package/wgsl/Tumble.wgsl +424 -0
- package/wgsl/WaterDrop.wgsl +251 -49
- package/wgsl/WaveWipe.wgsl +581 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// FrostWipe — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/FrostWipe.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: Ice crystals grow in from the edges of the frame with feathery, branching fronts, frosting the outgoing image white and blurry until it is covered, then thaw back out to the edges on the incoming image
|
|
5
|
+
// Tags: frost, ice, crystal, blur, cover
|
|
6
|
+
|
|
7
|
+
// @range(0, 1) How far the crystal fingers reach ahead of the frost
|
|
8
|
+
uniform float spread; // = 0.5
|
|
9
|
+
// @range(2, 12) Size of the crystals: more, smaller ones with a larger value
|
|
10
|
+
uniform float scale; // = 5.0
|
|
11
|
+
// @range(0, 1) How much the frost blurs the image under it
|
|
12
|
+
uniform float blur; // = 0.5
|
|
13
|
+
// @color Color of the frost
|
|
14
|
+
uniform vec4 color; // = vec4(0.86, 0.93, 1.0, 1.0)
|
|
15
|
+
|
|
16
|
+
const int TAPS = 12;
|
|
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
|
+
// ridged noise: thin bright veins where the noise crosses its middle, like crystal ferns
|
|
36
|
+
float ridged(vec2 v) {
|
|
37
|
+
float sum = 0.0;
|
|
38
|
+
float amp = 0.5;
|
|
39
|
+
for (int i = 0; i < 4; i++) {
|
|
40
|
+
float n = 1.0 - abs(2.0 * vnoise(v) - 1.0);
|
|
41
|
+
sum += amp * n * n;
|
|
42
|
+
v = mat2(1.6, 1.2, -1.2, 1.6) * v + 4.7;
|
|
43
|
+
amp *= 0.5;
|
|
44
|
+
}
|
|
45
|
+
return sum / 0.9375;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// crystal grains, cells of size 1: x is how far from the boundary between two grains
|
|
49
|
+
// (0 on it, where the crystals start), y a random number for the grain, zw the position
|
|
50
|
+
// relative to the grain's seed
|
|
51
|
+
vec4 grains(vec2 v) {
|
|
52
|
+
vec2 i = floor(v);
|
|
53
|
+
vec2 f = fract(v);
|
|
54
|
+
float d1 = 8.0;
|
|
55
|
+
float d2 = 8.0;
|
|
56
|
+
vec3 seed = vec3(0.0);
|
|
57
|
+
for (int y = -1; y <= 1; y++) {
|
|
58
|
+
for (int x = -1; x <= 1; x++) {
|
|
59
|
+
vec2 c = vec2(float(x), float(y));
|
|
60
|
+
vec2 o = c + vec2(hash12(i + c), hash12(i + c + 17.3)) - f;
|
|
61
|
+
float d = dot(o, o);
|
|
62
|
+
if (d < d1) {
|
|
63
|
+
d2 = d1;
|
|
64
|
+
d1 = d;
|
|
65
|
+
seed = vec3(hash12(i + c + 41.9), -o);
|
|
66
|
+
} else if (d < d2) {
|
|
67
|
+
d2 = d;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return vec4(sqrt(d2) - sqrt(d1), seed);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// mirror the coordinates back into the frame
|
|
75
|
+
vec2 mirror(vec2 v) {
|
|
76
|
+
return 1.0 - abs(1.0 - mod(v, 2.0));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// the image under the frost: the outgoing one, then the incoming one, switched under full cover
|
|
80
|
+
vec4 image(vec2 uv, float m) {
|
|
81
|
+
if (m <= 0.0) return getFromColor(uv);
|
|
82
|
+
if (m >= 1.0) return getToColor(uv);
|
|
83
|
+
return mix(getFromColor(uv), getToColor(uv), m);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
vec4 transition(vec2 uv) {
|
|
87
|
+
float p = progress;
|
|
88
|
+
// 0 at both ends, 1 while the frost covers the whole frame (from 0.425 to 0.575)
|
|
89
|
+
float h = 1.0 - abs(2.0 * p - 1.0);
|
|
90
|
+
float a = clamp(h / 0.85, 0.0, 1.0);
|
|
91
|
+
a = a * (1.6 - 0.6 * a); // fast start, slowing down as the frost closes in
|
|
92
|
+
float m = smoothstep(0.47, 0.53, p);
|
|
93
|
+
if (a <= 0.0) return image(uv, m);
|
|
94
|
+
|
|
95
|
+
// how deep in the frame the pixel is: 0 on the edges, 1 at the center
|
|
96
|
+
vec2 q = uv * vec2(ratio, 1.0);
|
|
97
|
+
vec2 dEdge = min(uv, 1.0 - uv) * vec2(ratio, 1.0);
|
|
98
|
+
float depth = min(dEdge.x, dEdge.y) / (0.5 * min(ratio, 1.0));
|
|
99
|
+
depth = 1.0 - (1.0 - depth) * (1.0 - depth); // the covered area grows evenly
|
|
100
|
+
|
|
101
|
+
// the front, which moves from the edges past the deepest point; the crystals below only
|
|
102
|
+
// hold it back, so nothing is frosted (yet, or any more) deeper than it
|
|
103
|
+
float reach = 0.2 + 0.6 * clamp(spread, 0.0, 1.0);
|
|
104
|
+
float front = mix(-0.1, 1.0 + reach + 0.2, a);
|
|
105
|
+
if (depth > front + 0.08) return image(uv, m);
|
|
106
|
+
|
|
107
|
+
// crystals: ferns grow from the boundaries between grains, with parallel needles shooting
|
|
108
|
+
// off them at an angle that changes from grain to grain
|
|
109
|
+
vec2 gv = q * scale;
|
|
110
|
+
// the stems bend a little
|
|
111
|
+
vec4 gr = grains(gv + 0.35 * vec2(vnoise(gv * 1.7), vnoise(gv * 1.7 + 23.1)));
|
|
112
|
+
// the needles' direction, any angle (a rational point on the unit circle)
|
|
113
|
+
float u = 2.0 * gr.y - 1.0;
|
|
114
|
+
vec2 dir = vec2(1.0 - u * u, 2.0 * u) / (1.0 + u * u);
|
|
115
|
+
float t = dot(gr.zw, dir) * 7.0;
|
|
116
|
+
float needle = 1.0 - abs(2.0 * fract(t) - 1.0); // 1 along each needle, 0 between them
|
|
117
|
+
float nh = fract(gr.y + 0.618034 * floor(t));
|
|
118
|
+
float len = mix(0.15, 0.6, nh); // each needle has its own length
|
|
119
|
+
float r = ridged(gv * 1.3);
|
|
120
|
+
float rf = ridged(gv * 4.0 + 11.0);
|
|
121
|
+
// when the frost reaches the pixel, after the edges: the stems first, then the needles, then
|
|
122
|
+
// the gaps between them
|
|
123
|
+
float grow = min(gr.x * 3.5, gr.x / len * 0.5 + (1.0 - needle) * 1.2 + 0.2 * fract(nh * 13.7));
|
|
124
|
+
float field = depth + reach * (0.8 * min(grow, 1.0) + 0.2 * (1.0 - r)) + 0.1 * (1.0 - rf);
|
|
125
|
+
float inside = front - field; // > 0 under the frost
|
|
126
|
+
float f = smoothstep(0.0, 0.03, inside);
|
|
127
|
+
// a thin, faint haze of fine crystals just ahead of the front
|
|
128
|
+
float haze = 0.4 * smoothstep(0.9, 1.0, rf) * smoothstep(-0.08, 0.0, inside);
|
|
129
|
+
float frost = max(f, haze);
|
|
130
|
+
if (frost <= 0.0) return image(uv, m);
|
|
131
|
+
|
|
132
|
+
// thicker ice close to the edges, where it started growing
|
|
133
|
+
float thick = smoothstep(0.0, 0.5, inside);
|
|
134
|
+
float full = smoothstep(0.75, 0.95, h); // the frost turns opaque to hide the switch
|
|
135
|
+
|
|
136
|
+
// frosted glass: blur over a small jittered disc, scattered along the crystals
|
|
137
|
+
float radius = (0.004 + 0.03 * blur) * frost * (0.5 + 0.5 * thick);
|
|
138
|
+
float rot = 6.2831853 * hash12(floor(q * 90.0));
|
|
139
|
+
vec3 rgb = vec3(0.0);
|
|
140
|
+
float alpha = 0.0;
|
|
141
|
+
for (int i = 0; i < TAPS; i++) {
|
|
142
|
+
float k = (float(i) + 0.5) / float(TAPS);
|
|
143
|
+
float th = rot + float(i) * 2.3999632;
|
|
144
|
+
vec2 off = sqrt(k) * vec2(cos(th), sin(th)) * radius;
|
|
145
|
+
vec4 c = image(mirror(uv + off / vec2(ratio, 1.0)), m);
|
|
146
|
+
rgb += c.rgb * c.a;
|
|
147
|
+
alpha += c.a;
|
|
148
|
+
}
|
|
149
|
+
alpha /= float(TAPS);
|
|
150
|
+
rgb = alpha > 0.0 ? rgb / (alpha * float(TAPS)) : vec3(0.0);
|
|
151
|
+
|
|
152
|
+
// a cool white crystal tint, brighter on the stems, the needles (fading out toward their tips)
|
|
153
|
+
// and the growing front
|
|
154
|
+
float stem = 1.0 - smoothstep(0.0, 0.03, gr.x);
|
|
155
|
+
float needles = smoothstep(0.7, 1.0, needle) * (1.0 - smoothstep(0.0, len, gr.x));
|
|
156
|
+
float glint = 0.4 + 0.6 * rf;
|
|
157
|
+
float veins = clamp(glint * max(0.35 * stem, 0.55 * needles) + 0.3 * smoothstep(0.6, 0.95, r), 0.0, 1.0);
|
|
158
|
+
float rim = smoothstep(0.0, 0.02, inside) * (1.0 - smoothstep(0.02, 0.07, inside));
|
|
159
|
+
vec3 ice = clamp(color.rgb * (0.82 + 0.25 * veins), 0.0, 1.0);
|
|
160
|
+
float cover = frost * (0.35 + 0.3 * thick + 0.25 * veins);
|
|
161
|
+
cover = clamp(mix(cover, frost, full), 0.0, 1.0);
|
|
162
|
+
vec4 under = vec4(rgb * mix(vec3(1.0), color.rgb, 0.5 * frost), alpha);
|
|
163
|
+
// the frost color mixes as straight RGBA, like every fill color
|
|
164
|
+
vec4 res = mix(under, vec4(ice, color.a), cover);
|
|
165
|
+
|
|
166
|
+
// fine sparkles on the ice, twinkling as it grows
|
|
167
|
+
vec2 sq = q * 36.0;
|
|
168
|
+
vec2 cell = floor(sq);
|
|
169
|
+
vec2 d = abs(sq - cell - 0.25 - 0.5 * vec2(hash12(cell + 1.3), hash12(cell + 5.9)));
|
|
170
|
+
float star = max(0.0, 1.0 - 9.0 * length(d)) + max(0.0, 1.0 - 4.0 * (d.x + d.y) - 30.0 * min(d.x, d.y));
|
|
171
|
+
float tw = 0.5 + 0.5 * sin(6.2831853 * (hash12(cell + 9.1) + 2.0 * p));
|
|
172
|
+
float sparkle = step(0.82, hash12(cell + 3.7)) * min(star, 1.0) * tw * f * (0.4 + 0.6 * veins);
|
|
173
|
+
float light = clamp(0.4 * rim + 0.8 * sparkle, 0.0, 1.0);
|
|
174
|
+
res = mix(res, vec4(mix(color.rgb, vec3(1.0), 0.6), color.a), light);
|
|
175
|
+
return clamp(res, 0.0, 1.0);
|
|
176
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Funnel — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/Funnel.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image narrows into a curved funnel toward a point on the bottom edge and slides into it, its sides bending like a window minimized into a dock, revealing the incoming image behind it
|
|
5
|
+
// Tags: distort, slide, vertical, shadow
|
|
6
|
+
|
|
7
|
+
// @range(0, 1) Point of the bottom edge where the image disappears, from left (0) to right (1)
|
|
8
|
+
uniform float target; // = 0.7
|
|
9
|
+
// @range(0, 1) Shape of the funnel's sides: 0 straight, 1 bent into an S curve
|
|
10
|
+
uniform float curvature; // = 0.8
|
|
11
|
+
// @range(0, 1) Strength of the shading of the bent image and of the shadow it casts
|
|
12
|
+
uniform float shadow; // = 0.5
|
|
13
|
+
|
|
14
|
+
// width of the funnel's neck, as a part of the frame's height
|
|
15
|
+
const float NECK = 0.04;
|
|
16
|
+
// how far below the bottom edge the image's top ends, so it is gone at the end
|
|
17
|
+
const float OVERSHOOT = 0.03;
|
|
18
|
+
// width of the anti-aliased edges, as a part of the frame's height
|
|
19
|
+
const float EDGE = 0.0015;
|
|
20
|
+
// reach of the soft shadow, as a part of the frame's height
|
|
21
|
+
const float SOFT = 0.06;
|
|
22
|
+
|
|
23
|
+
vec4 transition(vec2 uv) {
|
|
24
|
+
float t = progress;
|
|
25
|
+
// one eased timing: the funnel forms from the very start while the slide accelerates into it
|
|
26
|
+
float f = smoothstep(0.0, 1.0, 1.0 - (1.0 - t) * (1.0 - t) * (1.0 - t));
|
|
27
|
+
float slide = (1.0 + OVERSHOOT) * t * t * (1.5 - 0.5 * t);
|
|
28
|
+
|
|
29
|
+
float r = max(ratio, 1e-4);
|
|
30
|
+
float nh = 0.5 * NECK / r;
|
|
31
|
+
// the whole neck stays in the frame
|
|
32
|
+
float tx = clamp(target, nh, 1.0 - nh);
|
|
33
|
+
float c = clamp(curvature, 0.0, 1.0);
|
|
34
|
+
|
|
35
|
+
// the funnel's profile, 0 at the neck on the bottom edge to 1 at the top of the frame
|
|
36
|
+
float q = clamp(uv.y, 0.0, 1.0);
|
|
37
|
+
float w = mix(q, q * q * (3.0 - 2.0 * q), c);
|
|
38
|
+
float dw = mix(1.0, 6.0 * q * (1.0 - q), c);
|
|
39
|
+
float L = f * mix(tx - nh, 0.0, w);
|
|
40
|
+
float R = 1.0 - f * (1.0 - mix(tx + nh, 1.0, w));
|
|
41
|
+
float dL = -f * (tx - nh) * dw;
|
|
42
|
+
float dR = f * (1.0 - tx - nh) * dw;
|
|
43
|
+
float v = uv.y + slide;
|
|
44
|
+
|
|
45
|
+
// anti-aliased coverage, measured across the slanted sides (a side on the frame's border is not an edge)
|
|
46
|
+
float e = EDGE * min(1.0, 10.0 * t) + 1e-6;
|
|
47
|
+
float left = L > 0.0 ? (uv.x - L) * r / sqrt(1.0 + dL * dL * r * r) : 1.0;
|
|
48
|
+
float right = R < 1.0 ? (R - uv.x) * r / sqrt(1.0 + dR * dR * r * r) : 1.0;
|
|
49
|
+
float cov = clamp(min(min(left, right), 1.0 - v) / e + 0.5, 0.0, 1.0);
|
|
50
|
+
|
|
51
|
+
vec4 img = vec4(0.0);
|
|
52
|
+
float s = clamp(shadow, 0.0, 1.0);
|
|
53
|
+
if (cov > 0.0) {
|
|
54
|
+
float width = R - L;
|
|
55
|
+
vec2 src = clamp(vec2((uv.x - L) / width, v), 0.0, 1.0);
|
|
56
|
+
img = getFromColor(src);
|
|
57
|
+
// the squeezed rows round like a bent sheet, darker on their sides and toward the neck
|
|
58
|
+
float across = 2.0 * src.x - 1.0;
|
|
59
|
+
img.rgb *= 1.0 - s * (1.0 - width) * (0.5 * across * across + 0.3 * (1.0 - w));
|
|
60
|
+
if (cov >= 1.0) return img;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
vec4 bg = getToColor(uv);
|
|
64
|
+
// soft shadow of the funnel cast on the incoming image
|
|
65
|
+
float ox = max(L - uv.x, uv.x - R) * r;
|
|
66
|
+
float oy = uv.y - (1.0 - slide);
|
|
67
|
+
float dist = length(max(vec2(ox, oy), 0.0));
|
|
68
|
+
bg.rgb *= 1.0 - s * 0.6 * f * (1.0 - t) * (1.0 - smoothstep(0.0, SOFT, dist));
|
|
69
|
+
|
|
70
|
+
return mix(bg, img, cov);
|
|
71
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// GlitterDissolve — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/GlitterDissolve.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The image becomes a shimmering field of tiny diamond sequins that flip over in 3D at random moments, each lifting and tilting on its own axis and flashing a glint of light, and land on the incoming image
|
|
5
|
+
// Tags: tiles, flip, 3d, sparkle, dissolve
|
|
6
|
+
|
|
7
|
+
// @range(6, 60) Number of tiles stacked across the height of the frame
|
|
8
|
+
uniform float tiles; // = 20.0
|
|
9
|
+
// @param Hexagonal tiles instead of diamonds
|
|
10
|
+
uniform bool hexagons; // = false
|
|
11
|
+
// @range(0, 2) Strength of the glints the tiles catch as they turn
|
|
12
|
+
uniform float sparkle; // = 1.0
|
|
13
|
+
// @color Color of the glints, added as light
|
|
14
|
+
uniform vec3 glint; // = vec3(1.0, 0.97, 0.9)
|
|
15
|
+
// @range(0, 100) Changes the order and the axes of the flips (whole numbers)
|
|
16
|
+
uniform float seed; // = 0.0
|
|
17
|
+
// @color Color seen behind a tile while it is edge-on
|
|
18
|
+
uniform vec4 backColor; // = vec4(0.04, 0.04, 0.05, 1.0)
|
|
19
|
+
|
|
20
|
+
// share of the transition each tile takes to flip over
|
|
21
|
+
const float FLIP = 0.28;
|
|
22
|
+
// how much a tile grows as it lifts toward the viewer, halfway through its flip
|
|
23
|
+
const float LIFT = 0.3;
|
|
24
|
+
// width of the soft edge of the tiles, in tiles
|
|
25
|
+
const float EDGE = 0.04;
|
|
26
|
+
// the grid is shifted off the pixel centers, so that no pixel sits right on the border of two tiles
|
|
27
|
+
const vec2 SHIFT = vec2(0.37, 0.21);
|
|
28
|
+
const float PI = 3.14159265;
|
|
29
|
+
|
|
30
|
+
float hash12(vec2 p) {
|
|
31
|
+
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
|
|
32
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
33
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// folds uv back into 0..1, so the tiles on the border of the frame stay filled
|
|
37
|
+
vec2 mirrored(vec2 v) {
|
|
38
|
+
vec2 m = mod(v, 2.0);
|
|
39
|
+
return mix(m, 2.0 - m, step(1.0, m));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// how far the tile has flipped, 0 before it starts and 1 once it has landed
|
|
43
|
+
float flipOf(vec2 id) {
|
|
44
|
+
float t = clamp((progress - hash12(id) * (1.0 - FLIP)) / FLIP, 0.0, 1.0);
|
|
45
|
+
return t * t * (3.0 - 2.0 * t);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// the direction perpendicular to the axis the tile turns around
|
|
49
|
+
vec2 axisOf(vec2 id) {
|
|
50
|
+
float a = 2.0 * PI * hash12(id + 41.7);
|
|
51
|
+
return vec2(cos(a), sin(a));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// the point of the flat tile seen at offset s from its center, through the foreshortening and the lift
|
|
55
|
+
vec2 unproject(vec2 s, vec2 n, float f) {
|
|
56
|
+
float c = abs(cos(PI * f));
|
|
57
|
+
float along = dot(s, n);
|
|
58
|
+
return (s + n * (along / max(c, 1e-4) - along)) / (1.0 + LIFT * sin(PI * f));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// 0.5 on the edges of a tile one unit tall: a diamond one unit wide, or a flat-top hexagon
|
|
62
|
+
float shape(vec2 v) {
|
|
63
|
+
v = abs(v);
|
|
64
|
+
return hexagons ? max(v.y, dot(v, vec2(0.8660254, 0.5))) : v.x + v.y;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// the id of the tile centered at center
|
|
68
|
+
vec2 idOf(vec2 center) {
|
|
69
|
+
// the centers sit on multiples of (0.866, 0.5) for hexagons, of (0.5, 0.5) for diamonds
|
|
70
|
+
vec2 grid = hexagons ? vec2(1.1547005, 2.0) : vec2(2.0);
|
|
71
|
+
return floor(center * grid + 0.5) + vec2(13.0, 7.0) * floor(seed) + 3.0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// how much of the flipping tile centered at center covers the point p, with an edge soft on screen
|
|
75
|
+
float coverOf(vec2 p, vec2 center) {
|
|
76
|
+
vec2 id = idOf(center);
|
|
77
|
+
float f = flipOf(id);
|
|
78
|
+
if (f <= 0.0 || f >= 1.0) return 0.0;
|
|
79
|
+
float z = sin(PI * f);
|
|
80
|
+
// the tile is foreshortened by |cos| along its axis and grown by the lift
|
|
81
|
+
float onScreen = (1.0 + LIFT * z) * max(abs(cos(PI * f)), 0.15);
|
|
82
|
+
// the edge softens in as the tile starts turning, so that nothing pops
|
|
83
|
+
float edge = EDGE * min(1.0, 4.0 * z) + 1e-4;
|
|
84
|
+
return clamp((0.5 - shape(unproject(p - center, axisOf(id), f))) * onScreen / edge, 0.0, 1.0);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// the flipping tile centered at center, seen at the point p: shaded, with its glint
|
|
88
|
+
vec4 tileColor(vec2 p, vec2 center) {
|
|
89
|
+
vec2 id = idOf(center);
|
|
90
|
+
float f = flipOf(id);
|
|
91
|
+
vec2 n = axisOf(id);
|
|
92
|
+
float c = cos(PI * f);
|
|
93
|
+
float z = sin(PI * f);
|
|
94
|
+
vec2 s0 = unproject(p - center, n, f);
|
|
95
|
+
vec2 suv = mirrored((center + s0 - SHIFT) / tiles / vec2(ratio, 1.0) + 0.5);
|
|
96
|
+
vec4 col = c > 0.0 ? getFromColor(suv) : getToColor(suv);
|
|
97
|
+
// the face turned to the viewer, slightly cupped like a sequin, lit from the top left
|
|
98
|
+
vec3 nrm = normalize(vec3(n * z * (c < 0.0 ? -1.0 : 1.0) + 0.5 * s0, abs(c)));
|
|
99
|
+
vec3 L = normalize(vec3(-0.3, 0.4, 1.0));
|
|
100
|
+
float shade = 0.45 + 0.55 * clamp(dot(nrm, L) / L.z, 0.0, 1.6);
|
|
101
|
+
// a glint where the face mirrors the light toward the viewer, and on the rim when edge-on
|
|
102
|
+
vec3 H = normalize(vec3(-0.45, 0.55, 1.0));
|
|
103
|
+
float spec = smoothstep(0.94, 0.995, dot(nrm, H)) * 2.0 + pow(1.0 - abs(c), 6.0) * 0.6;
|
|
104
|
+
vec3 light = clamp(glint * sparkle * spec * z, 0.0, 1.0);
|
|
105
|
+
vec3 base = clamp(col.rgb * mix(1.0, shade, z), 0.0, 1.0);
|
|
106
|
+
return vec4(base + light - base * light, col.a);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
vec4 transition(vec2 uv) {
|
|
110
|
+
if (progress <= 0.0) return getFromColor(uv);
|
|
111
|
+
if (progress >= 1.0) return getToColor(uv);
|
|
112
|
+
|
|
113
|
+
// in units where the tiles are one unit tall
|
|
114
|
+
vec2 p = (uv - 0.5) * vec2(ratio, 1.0) * tiles + SHIFT;
|
|
115
|
+
// the center of the tile of the pixel
|
|
116
|
+
vec2 home;
|
|
117
|
+
if (hexagons) {
|
|
118
|
+
vec2 s = vec2(1.7320508, 1.0);
|
|
119
|
+
vec2 a = mod(p, s) - 0.5 * s;
|
|
120
|
+
vec2 b = mod(p - 0.5 * s, s) - 0.5 * s;
|
|
121
|
+
home = dot(a, a) < dot(b, b) ? p - a : p - b;
|
|
122
|
+
} else {
|
|
123
|
+
// a square grid turned by 45 degrees
|
|
124
|
+
vec2 q = floor(vec2(p.x + p.y, p.y - p.x)) + 0.5;
|
|
125
|
+
home = vec2(q.x - q.y, q.x + q.y) * 0.5;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// what lies under the flipping tiles: the image while the own tile rests, else the backing
|
|
129
|
+
float fHome = flipOf(idOf(home));
|
|
130
|
+
vec4 under = fHome <= 0.0 ? getFromColor(uv) : fHome >= 1.0 ? getToColor(uv) : backColor;
|
|
131
|
+
|
|
132
|
+
// the two topmost flipping tiles at the pixel, among its own and the lifted neighbours
|
|
133
|
+
// reaching over it: the higher a tile is in its flip, the closer it is to the viewer
|
|
134
|
+
float z1 = -1.0;
|
|
135
|
+
float z2 = -1.0;
|
|
136
|
+
float cover1 = 0.0;
|
|
137
|
+
float cover2 = 0.0;
|
|
138
|
+
vec2 center1 = home;
|
|
139
|
+
vec2 center2 = home;
|
|
140
|
+
for (int k = 0; k < 9; k++) {
|
|
141
|
+
float fk = float(k);
|
|
142
|
+
vec2 off;
|
|
143
|
+
if (hexagons) {
|
|
144
|
+
if (k > 6) break;
|
|
145
|
+
off = k == 0 ? vec2(0.0) : k < 3 ? vec2(0.0, fk * 2.0 - 3.0) : vec2(mod(fk, 2.0) * 1.7320508 - 0.8660254, fk < 5.0 ? -0.5 : 0.5);
|
|
146
|
+
} else {
|
|
147
|
+
vec2 o = vec2(mod(fk, 3.0) - 1.0, floor(fk / 3.0) - 1.0);
|
|
148
|
+
off = vec2(o.x - o.y, o.x + o.y) * 0.5;
|
|
149
|
+
}
|
|
150
|
+
vec2 center = home + off;
|
|
151
|
+
float cover = coverOf(p, center);
|
|
152
|
+
if (cover <= 0.0) continue;
|
|
153
|
+
float z = sin(PI * flipOf(idOf(center)));
|
|
154
|
+
if (z > z1) {
|
|
155
|
+
z2 = z1;
|
|
156
|
+
cover2 = cover1;
|
|
157
|
+
center2 = center1;
|
|
158
|
+
z1 = z;
|
|
159
|
+
cover1 = cover;
|
|
160
|
+
center1 = center;
|
|
161
|
+
} else if (z > z2) {
|
|
162
|
+
z2 = z;
|
|
163
|
+
cover2 = cover;
|
|
164
|
+
center2 = center;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (z1 < 0.0) return under;
|
|
168
|
+
vec4 c = under;
|
|
169
|
+
if (z2 >= 0.0 && cover1 < 1.0) c = mix(c, tileColor(p, center2), cover2);
|
|
170
|
+
return mix(c, tileColor(p, center1), cover1);
|
|
171
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// GravityLens — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/GravityLens.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: A black disk appears and grows, bending the outgoing image around it like a heavy mass bends light: the image is stretched into a bright ring at the disk's edge and swallowed until the frame is black, then the disk shrinks back, unbending the incoming image
|
|
5
|
+
// Tags: distort, lens, space, circular, dark
|
|
6
|
+
|
|
7
|
+
// Center of the disk
|
|
8
|
+
uniform vec2 center; // = vec2(0.5, 0.5)
|
|
9
|
+
// @range(0, 1.5) How strongly the light bends: radius of the lensed ring beyond the disk's edge, in disk radii
|
|
10
|
+
uniform float strength; // = 0.6
|
|
11
|
+
// @range(0, 1) Brightness of the lensed ring and of the thin ring of light hugging the disk's edge
|
|
12
|
+
uniform float glow; // = 0.6
|
|
13
|
+
// @color Color of the disk
|
|
14
|
+
uniform vec4 hole; // = vec4(0.0, 0.0, 0.0, 1.0)
|
|
15
|
+
|
|
16
|
+
// how far past the farthest corner the disk grows, so the frame is fully covered for a brief moment
|
|
17
|
+
const float OVERSHOOT = 0.12;
|
|
18
|
+
// moment the frame is black: the swallow takes a little longer than the release
|
|
19
|
+
const float PEAK = 0.55;
|
|
20
|
+
// half width of the antialiased edge of the disk, in frame heights
|
|
21
|
+
const float AA = 0.002;
|
|
22
|
+
// tint of the light piled up around the disk
|
|
23
|
+
const vec3 WARM = vec3(1.0, 0.86, 0.68);
|
|
24
|
+
|
|
25
|
+
// fold the coordinates back into the frame, so the image stays filled without smearing its border
|
|
26
|
+
vec2 mirrored(vec2 v) {
|
|
27
|
+
vec2 m = mod(v, 2.0);
|
|
28
|
+
return mix(m, 2.0 - m, step(1.0, m));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
vec4 transition(vec2 uv) {
|
|
32
|
+
// the disk grows with an accelerating swallow, then shrinks back a little faster: exactly 0 at both ends
|
|
33
|
+
bool swallowing = progress < PEAK;
|
|
34
|
+
float u = swallowing ? progress / PEAK : (1.0 - progress) / (1.0 - PEAK);
|
|
35
|
+
float u2 = u * u;
|
|
36
|
+
float k = u2 * (0.6 + 0.4 * u2);
|
|
37
|
+
|
|
38
|
+
// measured in frame heights, so the disk is round
|
|
39
|
+
vec2 aspect = vec2(ratio, 1.0);
|
|
40
|
+
vec2 far = max(center, 1.0 - center) * aspect;
|
|
41
|
+
float rh = length(far) * (1.0 + OVERSHOOT) * k;
|
|
42
|
+
// radius where the light coming from right behind the disk shows up as a ring
|
|
43
|
+
float re = rh * (1.0 + max(strength, 0.0));
|
|
44
|
+
|
|
45
|
+
vec2 d = (uv - center) * aspect;
|
|
46
|
+
float r = max(length(d), 1e-5);
|
|
47
|
+
// a point mass deflects the light by an angle falling off as 1/r
|
|
48
|
+
vec2 q = mirrored(center + d * (1.0 - re * re / (r * r)) / aspect);
|
|
49
|
+
vec4 c = swallowing ? getFromColor(q) : getToColor(q);
|
|
50
|
+
// the shading fades in with the disk, so it is exactly 0 at both ends
|
|
51
|
+
float amount = smoothstep(0.0, 0.04, rh);
|
|
52
|
+
// the second, flipped image squeezed between the ring and the disk is dimmer
|
|
53
|
+
float inner = clamp((r - rh) / (re - rh + 1e-4), 0.0, 1.0);
|
|
54
|
+
c.rgb *= 1.0 - 0.7 * amount * (1.0 - inner * inner * (3.0 - 2.0 * inner));
|
|
55
|
+
|
|
56
|
+
// light piles up into a ring where the image is most stretched, and into a thin ring hugging the edge
|
|
57
|
+
float g = max(glow, 0.0) * amount;
|
|
58
|
+
float einstein = (r - re) / (0.3 * (re - rh) + 0.01);
|
|
59
|
+
float photon = max(r - rh, 0.0) / (0.006 + 0.012 * rh);
|
|
60
|
+
float light = g * (0.7 * exp(-einstein * einstein) + 1.6 * exp(-photon * photon));
|
|
61
|
+
c.rgb = min(c.rgb * (1.0 + light) + WARM * (0.35 * light * c.a), vec3(1.0));
|
|
62
|
+
|
|
63
|
+
// antialiased horizon, kept inside the disk so it vanishes with it
|
|
64
|
+
float cov = clamp((rh - r) / (2.0 * AA), 0.0, 1.0);
|
|
65
|
+
return mix(c, hole, cov);
|
|
66
|
+
}
|