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.
- package/CHANGELOG.md +64 -0
- package/compatibility.json +464 -0
- package/gl-transitions.js +1 -1
- package/gl-transitions.json +1 -1
- package/glsl3/Accordion.glsl +85 -0
- package/glsl3/Ascii.glsl +124 -0
- package/glsl3/BlockCover.glsl +87 -0
- package/glsl3/BloomDissolve.glsl +110 -0
- package/glsl3/BokehDissolve.glsl +123 -0
- package/glsl3/BrushWipe.glsl +100 -0
- package/glsl3/CameraShake.glsl +98 -0
- package/glsl3/CardSwipe.glsl +81 -0
- package/glsl3/ColorPanelWipe.glsl +75 -0
- package/glsl3/CurvedWipe.glsl +52 -0
- package/glsl3/Disintegrate.glsl +112 -0
- package/glsl3/EyeBlink.glsl +83 -0
- package/glsl3/FilmDissolve.glsl +49 -0
- package/glsl3/FilmStrip.glsl +105 -0
- package/glsl3/FlameWipe.glsl +154 -0
- package/glsl3/Gallery.glsl +133 -0
- package/glsl3/GooeyWipe.glsl +97 -0
- package/glsl3/InkBleed.glsl +96 -0
- package/glsl3/LensFlare.glsl +125 -0
- package/glsl3/LightRays.glsl +106 -0
- package/glsl3/LightWipe.glsl +89 -0
- package/glsl3/PhotoDevelop.glsl +59 -0
- package/glsl3/PlusWipe.glsl +38 -0
- package/glsl3/PopIn.glsl +57 -0
- package/glsl3/SmokeDissolve.glsl +102 -0
- package/glsl3/SplatterWipe.glsl +154 -0
- package/glsl3/StretchSlide.glsl +62 -0
- package/glsl3/VhsTracking.glsl +127 -0
- package/glsl3/WedgeWipe.glsl +35 -0
- package/index.js +1 -1
- package/layouts.json +1091 -17
- package/llms-full.txt +774 -304
- package/llms.txt +189 -160
- package/msl/Accordion.metal +421 -0
- package/msl/Ascii.metal +567 -0
- package/msl/BlockCover.metal +403 -0
- package/msl/BloomDissolve.metal +416 -0
- package/msl/BokehDissolve.metal +447 -0
- package/msl/BrushWipe.metal +488 -0
- package/msl/CameraShake.metal +393 -0
- package/msl/CardSwipe.metal +342 -0
- package/msl/ColorPanelWipe.metal +314 -0
- package/msl/CurvedWipe.metal +229 -0
- package/msl/Disintegrate.metal +468 -0
- package/msl/EyeBlink.metal +355 -0
- package/msl/FilmDissolve.metal +199 -0
- package/msl/FilmStrip.metal +429 -0
- package/msl/FlameWipe.metal +575 -0
- package/msl/Gallery.metal +813 -0
- package/msl/GooeyWipe.metal +398 -0
- package/msl/InkBleed.metal +409 -0
- package/msl/LensFlare.metal +455 -0
- package/msl/LightRays.metal +427 -0
- package/msl/LightWipe.metal +321 -0
- package/msl/PhotoDevelop.metal +245 -0
- package/msl/PlusWipe.metal +199 -0
- package/msl/PopIn.metal +245 -0
- package/msl/SmokeDissolve.metal +400 -0
- package/msl/SplatterWipe.metal +677 -0
- package/msl/StretchSlide.metal +243 -0
- package/msl/VhsTracking.metal +514 -0
- package/msl/WedgeWipe.metal +154 -0
- package/package.json +1 -1
- package/skills/gl-transitions/references/catalog.md +115 -39
- package/sksl/Accordion.sksl +94 -0
- package/sksl/Ascii.sksl +131 -0
- package/sksl/BlockCover.sksl +96 -0
- package/sksl/BloomDissolve.sksl +119 -0
- package/sksl/BokehDissolve.sksl +132 -0
- package/sksl/BrushWipe.sksl +109 -0
- package/sksl/CameraShake.sksl +108 -0
- package/sksl/CardSwipe.sksl +93 -0
- package/sksl/ColorPanelWipe.sksl +85 -0
- package/sksl/CurvedWipe.sksl +64 -0
- package/sksl/Disintegrate.sksl +117 -0
- package/sksl/EyeBlink.sksl +94 -0
- package/sksl/FilmDissolve.sksl +60 -0
- package/sksl/FilmStrip.sksl +114 -0
- package/sksl/FlameWipe.sksl +162 -0
- package/sksl/Gallery.sksl +139 -0
- package/sksl/GooeyWipe.sksl +109 -0
- package/sksl/InkBleed.sksl +109 -0
- package/sksl/LensFlare.sksl +135 -0
- package/sksl/LightRays.sksl +115 -0
- package/sksl/LightWipe.sksl +97 -0
- package/sksl/PhotoDevelop.sksl +72 -0
- package/sksl/PlusWipe.sksl +50 -0
- package/sksl/PopIn.sksl +69 -0
- package/sksl/SmokeDissolve.sksl +115 -0
- package/sksl/SplatterWipe.sksl +161 -0
- package/sksl/StretchSlide.sksl +74 -0
- package/sksl/VhsTracking.sksl +138 -0
- package/sksl/WedgeWipe.sksl +46 -0
- package/sksl/index.js +1 -1
- package/transitions/Accordion.glsl +84 -0
- package/transitions/Ascii.glsl +123 -0
- package/transitions/BlockCover.glsl +86 -0
- package/transitions/BloomDissolve.glsl +109 -0
- package/transitions/BokehDissolve.glsl +122 -0
- package/transitions/BrushWipe.glsl +99 -0
- package/transitions/CameraShake.glsl +97 -0
- package/transitions/CardSwipe.glsl +80 -0
- package/transitions/ColorPanelWipe.glsl +74 -0
- package/transitions/CurvedWipe.glsl +51 -0
- package/transitions/Disintegrate.glsl +111 -0
- package/transitions/EyeBlink.glsl +82 -0
- package/transitions/FilmDissolve.glsl +48 -0
- package/transitions/FilmStrip.glsl +104 -0
- package/transitions/FlameWipe.glsl +153 -0
- package/transitions/Gallery.glsl +132 -0
- package/transitions/GooeyWipe.glsl +96 -0
- package/transitions/InkBleed.glsl +95 -0
- package/transitions/LensFlare.glsl +124 -0
- package/transitions/LightRays.glsl +105 -0
- package/transitions/LightWipe.glsl +88 -0
- package/transitions/PhotoDevelop.glsl +58 -0
- package/transitions/PlusWipe.glsl +37 -0
- package/transitions/PopIn.glsl +56 -0
- package/transitions/SmokeDissolve.glsl +101 -0
- package/transitions/SplatterWipe.glsl +153 -0
- package/transitions/StretchSlide.glsl +61 -0
- package/transitions/VhsTracking.glsl +126 -0
- package/transitions/WedgeWipe.glsl +34 -0
- package/wgsl/Accordion.wgsl +376 -0
- package/wgsl/Ascii.wgsl +519 -0
- package/wgsl/BlockCover.wgsl +352 -0
- package/wgsl/BloomDissolve.wgsl +372 -0
- package/wgsl/BokehDissolve.wgsl +409 -0
- package/wgsl/BrushWipe.wgsl +443 -0
- package/wgsl/CameraShake.wgsl +348 -0
- package/wgsl/CardSwipe.wgsl +308 -0
- package/wgsl/ColorPanelWipe.wgsl +274 -0
- package/wgsl/CurvedWipe.wgsl +198 -0
- package/wgsl/Disintegrate.wgsl +426 -0
- package/wgsl/EyeBlink.wgsl +308 -0
- package/wgsl/FilmDissolve.wgsl +169 -0
- package/wgsl/FilmStrip.wgsl +381 -0
- package/wgsl/FlameWipe.wgsl +531 -0
- package/wgsl/Gallery.wgsl +741 -0
- package/wgsl/GooeyWipe.wgsl +353 -0
- package/wgsl/InkBleed.wgsl +366 -0
- package/wgsl/LensFlare.wgsl +406 -0
- package/wgsl/LightRays.wgsl +380 -0
- package/wgsl/LightWipe.wgsl +277 -0
- package/wgsl/PhotoDevelop.wgsl +213 -0
- package/wgsl/PlusWipe.wgsl +165 -0
- package/wgsl/PopIn.wgsl +213 -0
- package/wgsl/SmokeDissolve.wgsl +363 -0
- package/wgsl/SplatterWipe.wgsl +613 -0
- package/wgsl/StretchSlide.wgsl +213 -0
- package/wgsl/VhsTracking.wgsl +462 -0
- package/wgsl/WedgeWipe.wgsl +126 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// LightRays — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/LightRays.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: Shafts of light burst from the highlights of the outgoing image and stream outward from a slowly drifting center; at their peak the incoming image takes over and its own rays shrink back into its highlights
|
|
5
|
+
// Tags: light, glow, rays, radial
|
|
6
|
+
|
|
7
|
+
// @param Point the rays stream away from, at the middle of the transition
|
|
8
|
+
uniform vec2 center; // = vec2(0.5, 0.6)
|
|
9
|
+
// @range(0, 0.5) How far the center drifts during the transition, from left to right
|
|
10
|
+
uniform float drift; // = 0.15
|
|
11
|
+
// @range(0, 1) Length of the rays at the peak, as a fraction of their distance to the center
|
|
12
|
+
uniform float reach; // = 0.6
|
|
13
|
+
// @range(0, 0.8) Brightness above which the image casts rays
|
|
14
|
+
uniform float threshold; // = 0.65
|
|
15
|
+
// @range(0, 4) Brightness of the rays
|
|
16
|
+
uniform float intensity; // = 1.5
|
|
17
|
+
// @color Tint of the rays, toward their ends
|
|
18
|
+
uniform vec3 tint; // = vec3(1.0, 0.82, 0.55)
|
|
19
|
+
|
|
20
|
+
const int TAPS = 20;
|
|
21
|
+
// number of shafts around the center
|
|
22
|
+
const float SHAFTS = 23.0;
|
|
23
|
+
const float PI = 3.141592653589793;
|
|
24
|
+
|
|
25
|
+
float hash12(vec2 v) {
|
|
26
|
+
vec3 v3 = fract(vec3(v.xyx) * 0.1031);
|
|
27
|
+
v3 += dot(v3, v3.yzx + 33.33);
|
|
28
|
+
return fract((v3.x + v3.y) * v3.z);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// smooth noise around the center, wrapping over a full turn (t in 0..1)
|
|
32
|
+
float shaftNoise(float t, float n, float seed) {
|
|
33
|
+
float x = t * n;
|
|
34
|
+
float i = floor(x);
|
|
35
|
+
float f = x - i;
|
|
36
|
+
float a = hash12(vec2(mod(i, n), seed));
|
|
37
|
+
float b = hash12(vec2(mod(i + 1.0, n), seed));
|
|
38
|
+
return mix(a, b, f * f * (3.0 - 2.0 * f));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// mirror the coordinates back into the frame
|
|
42
|
+
vec2 mirror(vec2 v) {
|
|
43
|
+
return 1.0 - abs(1.0 - mod(v, 2.0));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// the light of a pixel (premultiplied): its color above the threshold
|
|
47
|
+
vec3 glow(vec4 c, float knee) {
|
|
48
|
+
float lum = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722));
|
|
49
|
+
return c.rgb * c.a * smoothstep(knee, knee + 0.2, lum);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// the light at a ray tap: one image, or both during the short switch
|
|
53
|
+
vec3 light(vec2 st, float knee, float m) {
|
|
54
|
+
if (m <= 0.0) return glow(getFromColor(st), knee);
|
|
55
|
+
if (m >= 1.0) return glow(getToColor(st), knee);
|
|
56
|
+
return mix(glow(getFromColor(st), knee), glow(getToColor(st), knee), m);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
vec4 transition(vec2 uv) {
|
|
60
|
+
float p = progress;
|
|
61
|
+
// the rays grow on the outgoing image, and shrink back into the incoming one
|
|
62
|
+
float amount = p < 0.5 ? smoothstep(0.0, 0.5, p) : 1.0 - smoothstep(0.5, 1.0, p);
|
|
63
|
+
float peak = amount * amount * amount;
|
|
64
|
+
float m = smoothstep(0.46, 0.54, p);
|
|
65
|
+
vec4 fromColor = getFromColor(uv);
|
|
66
|
+
vec4 toColor = getToColor(uv);
|
|
67
|
+
if (amount <= 0.0) return m < 0.5 ? fromColor : toColor;
|
|
68
|
+
|
|
69
|
+
// the rays stream away from a center drifting slowly across the frame
|
|
70
|
+
vec2 origin = center + vec2(drift * (p - 0.5), 0.0);
|
|
71
|
+
float len = reach * amount;
|
|
72
|
+
// more and more of the image catches the light as the rays grow
|
|
73
|
+
float knee = mix(threshold, 0.75 * threshold, peak);
|
|
74
|
+
// a small shift of the taps, under their spacing, blends them into smooth shafts;
|
|
75
|
+
// hashed by integer cell so that every GPU computes the same shift
|
|
76
|
+
float jitter = hash12(floor(uv * vec2(ratio, 1.0) * 997.0));
|
|
77
|
+
|
|
78
|
+
// the light gathered on the way to the center, fading with the distance it travels
|
|
79
|
+
vec3 rays = vec3(0.0);
|
|
80
|
+
float total = 0.0;
|
|
81
|
+
for (int i = 0; i < TAPS; i++) {
|
|
82
|
+
float s = (float(i) + jitter) / float(TAPS);
|
|
83
|
+
float w = exp(-2.0 * s);
|
|
84
|
+
// warm white near the sources, tinted further along the rays
|
|
85
|
+
vec3 hue = mix(vec3(1.0), tint, smoothstep(0.0, 0.6, s));
|
|
86
|
+
rays += w * hue * light(mirror(mix(uv, origin, s * len)), knee, m);
|
|
87
|
+
total += w;
|
|
88
|
+
}
|
|
89
|
+
// the light breaks into shafts of different strengths, slowly turning
|
|
90
|
+
vec2 d = (uv - origin) * vec2(ratio, 1.0);
|
|
91
|
+
// atan is undefined at the center itself
|
|
92
|
+
float turn = length(d) > 1e-6 ? atan(d.y, d.x) / (2.0 * PI) + 0.5 : 0.0;
|
|
93
|
+
float shafts = 0.6 * shaftNoise(fract(turn + 0.03 * p), SHAFTS, 1.0) + 0.4 * shaftNoise(fract(turn - 0.05 * p), 2.0 * SHAFTS + 1.0, 7.0);
|
|
94
|
+
// merged back into a soft glow close to the center, where the shafts would meet in a point
|
|
95
|
+
rays *= mix(1.0, mix(0.2, 1.6, smoothstep(0.15, 0.85, shafts)), smoothstep(0.0, 0.3, length(d)));
|
|
96
|
+
rays *= intensity * amount * (1.0 + 3.0 * peak) / total;
|
|
97
|
+
// compressed, so that bright areas never flatten into white
|
|
98
|
+
rays = 0.9 * (1.0 - exp(-rays));
|
|
99
|
+
|
|
100
|
+
// the image stays sharp, with a slight lift of the exposure at the peak; the rays are screened
|
|
101
|
+
// on top of its colors and add nothing to its alpha
|
|
102
|
+
vec4 c = mix(vec4(fromColor.rgb * fromColor.a, fromColor.a), vec4(toColor.rgb * toColor.a, toColor.a), m);
|
|
103
|
+
if (c.a <= 0.0) return vec4(0.0);
|
|
104
|
+
vec3 base = min(c.rgb / c.a * (1.0 + 0.2 * peak), 1.0);
|
|
105
|
+
return vec4(base + rays - base * rays, c.a);
|
|
106
|
+
}
|
|
@@ -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,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
|
+
}
|
package/glsl3/PopIn.glsl
ADDED
|
@@ -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,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
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// SplatterWipe — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/SplatterWipe.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: Splats of paint land one after another, each popping in with a spiky outline, flung droplets and a few drips running down, revealing the incoming image until they cover the frame
|
|
5
|
+
// Tags: paint, splash, organic, reveal
|
|
6
|
+
|
|
7
|
+
// @range(2, 10, 1) Number of splats across the frame
|
|
8
|
+
uniform float splats; // = 4.0
|
|
9
|
+
// @range(0, 1) How long the spikes around each splat are
|
|
10
|
+
uniform float spikiness; // = 0.6
|
|
11
|
+
// @range(0, 1) How many droplets are flung around each splat
|
|
12
|
+
uniform float droplets; // = 0.6
|
|
13
|
+
// @range(0, 1) How far the paint drips run down
|
|
14
|
+
uniform float drips; // = 0.5
|
|
15
|
+
// @range(0, 1) How dark and glossy the rim of the splats is
|
|
16
|
+
uniform float rim; // = 0.5
|
|
17
|
+
// @param Random seed for the splats
|
|
18
|
+
uniform float seed; // = 3.0
|
|
19
|
+
|
|
20
|
+
const float PI = 3.141592653589793;
|
|
21
|
+
// number of spikes around a splat
|
|
22
|
+
const float SPIKES = 14.0;
|
|
23
|
+
// furthest reach of the shapes of a splat from its center, in cells. Splats are looked for in the 3x3 cells
|
|
24
|
+
// around a pixel, and the center of a splat 2 cells away is more than 1.35 cells away; on top of REACH, the
|
|
25
|
+
// smooth unions add up to 0.02 and the antialiasing 0.025 (at 10 splats), which leaves a margin of 0.055
|
|
26
|
+
// so that no splat is ever cut by the search
|
|
27
|
+
const float REACH = 1.25;
|
|
28
|
+
|
|
29
|
+
float hash12(vec2 v) {
|
|
30
|
+
vec3 v3 = fract(vec3(v.xyx) * 0.1031);
|
|
31
|
+
v3 += dot(v3, v3.yzx + 33.33);
|
|
32
|
+
return fract((v3.x + v3.y) * v3.z);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// smooth noise around a splat, wrapping over a full turn (t in 0..1)
|
|
36
|
+
float turnNoise(float t, float n, vec2 key) {
|
|
37
|
+
float x = t * n;
|
|
38
|
+
float i = floor(x);
|
|
39
|
+
float f = x - i;
|
|
40
|
+
float a = hash12(key + vec2(mod(i, n), 61.0));
|
|
41
|
+
float b = hash12(key + vec2(mod(i + 1.0, n), 61.0));
|
|
42
|
+
return mix(a, b, f * f * (3.0 - 2.0 * f));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// smooth union of two signed distances (> 0 inside)
|
|
46
|
+
float smax(float a, float b, float k) {
|
|
47
|
+
float h = max(k - abs(a - b), 0.0) / k;
|
|
48
|
+
return max(a, b) + h * h * k * 0.25;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// signed distance (approximately, in cells, > 0 inside) to the splat of a grid cell
|
|
52
|
+
float splat(vec2 q, vec2 cell, vec2 key) {
|
|
53
|
+
float t0 = 0.01 + 0.6 * hash12(key + vec2(3.0, 0.0)); // when it lands
|
|
54
|
+
if (progress <= t0) return -1.0;
|
|
55
|
+
vec2 c = cell + 0.5 + 0.3 * (vec2(hash12(key + vec2(5.0, 1.0)), hash12(key + vec2(9.0, 2.0))) - 0.5);
|
|
56
|
+
vec2 d = q - c;
|
|
57
|
+
float l = length(d);
|
|
58
|
+
// nothing of the splat reaches this far (its distance there would be below -0.08 anyway)
|
|
59
|
+
if (l > REACH + 0.1) return -1.0;
|
|
60
|
+
// a fast pop-in, then the paint slowly spreads until it covers its whole cell
|
|
61
|
+
float pop = clamp((progress - t0) / 0.08, 0.0, 1.0);
|
|
62
|
+
pop = 1.0 - (1.0 - pop) * (1.0 - pop) * (1.0 - pop);
|
|
63
|
+
float x = clamp((progress - t0) / (0.96 - t0), 0.0, 1.0);
|
|
64
|
+
float grow = x * x * x;
|
|
65
|
+
float r0 = 0.42 + 0.2 * hash12(key + vec2(11.0, 3.0));
|
|
66
|
+
// the farthest corner of the cell is at most 0.65 * sqrt(2) ~ 0.92 cells away, and the body dents by 6% at most in the end
|
|
67
|
+
float rc = mix(r0 * pop, 1.03, grow);
|
|
68
|
+
|
|
69
|
+
float a = l > 1e-5 ? atan(d.y, d.x) / (2.0 * PI) + 0.5 : 0.0;
|
|
70
|
+
// an irregular body
|
|
71
|
+
float lumps = mix(0.3, 0.06, grow) * (turnNoise(a, 5.0, key) - 0.5) + mix(0.18, 0.06, grow) * (turnNoise(a, 19.0, key + 3.0) - 0.5);
|
|
72
|
+
float f = rc * (1.0 + lumps) - l;
|
|
73
|
+
|
|
74
|
+
// a spike in each slice of the turn: a ray that tapers from a wide base, the long ones ending in a bead;
|
|
75
|
+
// the slices on both sides are looked at too, as their spikes can lean over the boundary
|
|
76
|
+
float s = floor(a * SPIKES);
|
|
77
|
+
float spike = -1.0;
|
|
78
|
+
for (int k = -1; k <= 1; k++) {
|
|
79
|
+
float sl = s + float(k);
|
|
80
|
+
vec2 sk = key + vec2(mod(sl, SPIKES), 17.0);
|
|
81
|
+
float h = hash12(sk);
|
|
82
|
+
float w0 = (0.022 + 0.03 * hash12(sk + 1.5)) * pop;
|
|
83
|
+
float len = max(min(spikiness * (0.06 + 0.6 * h * h) * pop, REACH - 1.2 * w0 - rc), 0.0);
|
|
84
|
+
if (len > 0.0) {
|
|
85
|
+
// short spikes are thin too, so that no spikiness leaves a clean body
|
|
86
|
+
float w = w0 * min(len / 0.06, 1.0);
|
|
87
|
+
float ang = (sl + 0.5 + 0.4 * (hash12(sk + 0.5) - 0.5)) / SPIKES * 2.0 * PI - PI;
|
|
88
|
+
vec2 dir = vec2(cos(ang), sin(ang));
|
|
89
|
+
float along = dot(d, dir);
|
|
90
|
+
float across = abs(d.x * dir.y - d.y * dir.x);
|
|
91
|
+
float u = clamp((along - rc) / len, 0.0, 1.0);
|
|
92
|
+
float ray = min(w * (1.0 - 0.7 * u) - across, rc + len - along);
|
|
93
|
+
if (h > 0.5) ray = max(ray, w * 1.2 - length(d - dir * (rc + len)));
|
|
94
|
+
spike = max(spike, ray);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
f = smax(f, spike, 0.08);
|
|
98
|
+
|
|
99
|
+
// droplets flung out around the splat
|
|
100
|
+
for (int j = 0; j < 5; j++) {
|
|
101
|
+
vec2 dk = key + vec2(float(j), 29.0);
|
|
102
|
+
float hr = hash12(dk + 0.5);
|
|
103
|
+
float rad = (0.015 + 0.05 * hr * hr) * clamp(droplets * 5.0 - float(j), 0.0, 1.0) * pop;
|
|
104
|
+
if (rad > 0.0) {
|
|
105
|
+
float da = 2.0 * PI * hash12(dk);
|
|
106
|
+
float dist = min(r0 + 0.08 + 0.5 * hash12(dk + 1.5), REACH - rad) * mix(0.5, 1.0, pop);
|
|
107
|
+
f = max(f, rad - length(d - dist * vec2(cos(da), sin(da))));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// drips running down from the bottom of the splat
|
|
112
|
+
if (drips > 0.0) {
|
|
113
|
+
float run = clamp((progress - t0 - 0.03) / 0.45, 0.0, 1.0);
|
|
114
|
+
run = run * (2.0 - run);
|
|
115
|
+
for (int j = 0; j < 2; j++) {
|
|
116
|
+
vec2 dk = key + vec2(float(j), 43.0);
|
|
117
|
+
float xo = (hash12(dk) - 0.5) * r0;
|
|
118
|
+
float dw = (0.03 + 0.02 * hash12(dk + 0.5)) * pop;
|
|
119
|
+
float top = sqrt(r0 * r0 - xo * xo) * pop;
|
|
120
|
+
float bottom = min(top + drips * (0.25 + 0.75 * hash12(dk + 1.5)) * run, sqrt(REACH * REACH - xo * xo) - 1.6 * dw);
|
|
121
|
+
float dx = abs(d.x - xo);
|
|
122
|
+
float drip = min(dw - dx, min(d.y + bottom, -d.y));
|
|
123
|
+
float tip = dw * 1.4 - length(vec2(dx, d.y + bottom + 0.2 * dw));
|
|
124
|
+
f = smax(f, max(drip, tip), 0.05);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return f;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
vec4 transition(vec2 uv) {
|
|
131
|
+
float n = max(1.0, floor(splats + 0.5));
|
|
132
|
+
float cellSize = max(ratio, 1.0) / n;
|
|
133
|
+
vec2 q = vec2(uv.x * ratio, uv.y) / cellSize; // in cells
|
|
134
|
+
vec2 base = floor(q);
|
|
135
|
+
vec2 sd = seed * vec2(7.0, 13.0);
|
|
136
|
+
float f = -1.0;
|
|
137
|
+
for (int j = -1; j <= 1; j++) {
|
|
138
|
+
for (int i = -1; i <= 1; i++) {
|
|
139
|
+
vec2 cell = base + vec2(float(i), float(j));
|
|
140
|
+
f = max(f, splat(q, cell, cell + sd));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
float aa = 0.0025 / cellSize; // about a pixel or two, in cells
|
|
144
|
+
float inside = smoothstep(-aa, aa, f);
|
|
145
|
+
vec4 from = getFromColor(uv);
|
|
146
|
+
vec4 to = getToColor(uv);
|
|
147
|
+
// thick paint: a darker rim with a thin glossy line just inside it, gone once the frame is covered
|
|
148
|
+
float e = clamp(f / 0.045, 0.0, 1.0);
|
|
149
|
+
float amount = rim * (1.0 - smoothstep(0.75, 1.0, progress));
|
|
150
|
+
float dark = (1.0 - e) * (1.0 - e) * 0.6;
|
|
151
|
+
float gloss = smoothstep(0.2, 0.4, e) * (1.0 - smoothstep(0.4, 0.7, e)) * 0.3;
|
|
152
|
+
to.rgb = mix(to.rgb * (1.0 - dark * amount), vec3(1.0), gloss * amount * to.a);
|
|
153
|
+
return mix(from, to, inside);
|
|
154
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// StretchSlide — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/StretchSlide.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The outgoing image stretches out long as it shoots away to one side, pulling in the incoming one squashed behind it, which overshoots and springs back to its shape
|
|
5
|
+
// Tags: slide, stretch, squash, elastic, bounce, directional
|
|
6
|
+
|
|
7
|
+
// @param Direction in which the images slide
|
|
8
|
+
uniform vec2 direction; // = vec2(-1.0, 0.0)
|
|
9
|
+
// @range(0, 1) How long the outgoing image stretches and how much the squashed incoming one bulges
|
|
10
|
+
uniform float stretch; // = 0.6
|
|
11
|
+
// @range(0, 1) How far the incoming image overshoots before it springs back to its shape
|
|
12
|
+
uniform float bounce; // = 0.6
|
|
13
|
+
|
|
14
|
+
const float PI = 3.14159265;
|
|
15
|
+
|
|
16
|
+
// mirror the coordinates back into the frame
|
|
17
|
+
vec2 mirror(vec2 v) {
|
|
18
|
+
return 1.0 - abs(1.0 - mod(v, 2.0));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
vec4 transition(vec2 uv) {
|
|
22
|
+
float dl = length(direction);
|
|
23
|
+
vec2 d = dl > 1e-6 ? direction / dl : vec2(-1.0, 0.0);
|
|
24
|
+
vec2 n = vec2(-d.y, d.x);
|
|
25
|
+
// s: position along the slide across the frame, from 0 (trailing side) to 1 (leading side)
|
|
26
|
+
float ext = abs(d.x) + abs(d.y);
|
|
27
|
+
vec2 q = uv - 0.5;
|
|
28
|
+
float s = 0.5 + dot(q, d) / ext;
|
|
29
|
+
float t = progress;
|
|
30
|
+
|
|
31
|
+
// the slide accelerates into the landing (a smoothstep when there is no bounce)
|
|
32
|
+
float land = mix(1.0, 0.5, bounce);
|
|
33
|
+
float m = 3.0 * bounce; // speed at the landing, relative to a linear slide
|
|
34
|
+
float x = clamp(t / land, 0.0, 1.0);
|
|
35
|
+
float e = x * x * (3.0 - 2.0 * x) + m * x * x * (x - 1.0);
|
|
36
|
+
// then a damped spring, starting at the landing speed, that comes to rest exactly at the end
|
|
37
|
+
float w = 2.5 * PI;
|
|
38
|
+
float u = clamp((t - land) / max(1.0 - land, 1e-4), 0.0, 1.0);
|
|
39
|
+
float osc = m * (1.0 - land) / (land * w) * exp(-u) * sin(w * u) * (1.0 - u) * (1.0 - u);
|
|
40
|
+
// past the landing the frame stays covered: the spring stretches the incoming image
|
|
41
|
+
// along the slide, and squashes it back into a sideways bulge
|
|
42
|
+
float len = e + max(osc, 0.0);
|
|
43
|
+
float bulge = 1.0 - e + 3.0 * max(-osc, 0.0);
|
|
44
|
+
|
|
45
|
+
// the incoming image is pinned at the trailing side and spans up to the seam
|
|
46
|
+
float g = 1.0 + 0.6 * stretch * bulge;
|
|
47
|
+
vec2 pt = q + d * (s / max(len, 1e-4) - s) * ext;
|
|
48
|
+
pt -= n * dot(pt, n) * (1.0 - 1.0 / g);
|
|
49
|
+
vec4 b = getToColor(mirror(pt + 0.5));
|
|
50
|
+
|
|
51
|
+
// the outgoing image hangs from the seam and stretches out long ahead of it,
|
|
52
|
+
// the most near the seam, where it is pulled
|
|
53
|
+
float l = 1.0 + 4.0 * stretch * e;
|
|
54
|
+
float k = clamp(1.6 * stretch * e, 0.0, 0.8);
|
|
55
|
+
float y = max(s - e, 0.0) / l;
|
|
56
|
+
// invert y = (1 + k) v - k v^2
|
|
57
|
+
float v = 2.0 * y / ((1.0 + k) + sqrt((1.0 + k) * (1.0 + k) - 4.0 * k * y));
|
|
58
|
+
vec4 a = getFromColor(mirror(q + d * (v - s) * ext + 0.5));
|
|
59
|
+
|
|
60
|
+
// past the landing, only the incoming image is left
|
|
61
|
+
return (s < len || t >= land) ? b : a;
|
|
62
|
+
}
|