gl-transitions 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/compatibility.json +496 -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/CurvedWipe.glsl +52 -0
- package/glsl3/CylinderRoll.glsl +102 -0
- package/glsl3/Disintegrate.glsl +112 -0
- package/glsl3/FilmDissolve.glsl +49 -0
- package/glsl3/FilmStrip.glsl +105 -0
- package/glsl3/FlameWipe.glsl +154 -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/LightStreaks.glsl +117 -0
- package/glsl3/LightWipe.glsl +89 -0
- package/glsl3/PhotoDevelop.glsl +59 -0
- package/glsl3/PixelStretch.glsl +73 -0
- package/glsl3/PlusWipe.glsl +38 -0
- package/glsl3/PopIn.glsl +57 -0
- package/glsl3/Refraction.glsl +95 -0
- package/glsl3/SmokeDissolve.glsl +102 -0
- package/glsl3/SplatterWipe.glsl +154 -0
- package/glsl3/StretchSlide.glsl +62 -0
- package/glsl3/WedgeWipe.glsl +35 -0
- package/glsl3/WhipSpin.glsl +69 -0
- package/glsl3/WhipTilt.glsl +79 -0
- package/index.js +1 -1
- package/layouts.json +1512 -371
- package/llms-full.txt +793 -292
- package/llms.txt +185 -154
- 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/CurvedWipe.metal +229 -0
- package/msl/CylinderRoll.metal +374 -0
- package/msl/Disintegrate.metal +468 -0
- package/msl/FilmDissolve.metal +199 -0
- package/msl/FilmStrip.metal +429 -0
- package/msl/FlameWipe.metal +575 -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/LightStreaks.metal +518 -0
- package/msl/LightWipe.metal +321 -0
- package/msl/PhotoDevelop.metal +245 -0
- package/msl/PixelStretch.metal +337 -0
- package/msl/PlusWipe.metal +199 -0
- package/msl/PopIn.metal +245 -0
- package/msl/Refraction.metal +333 -0
- package/msl/SmokeDissolve.metal +400 -0
- package/msl/SplatterWipe.metal +677 -0
- package/msl/StretchSlide.metal +243 -0
- package/msl/WedgeWipe.metal +154 -0
- package/msl/WhipSpin.metal +278 -0
- package/msl/WhipTilt.metal +327 -0
- package/package.json +1 -1
- package/skills/gl-transitions/references/catalog.md +113 -37
- 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/CurvedWipe.sksl +64 -0
- package/sksl/CylinderRoll.sksl +112 -0
- package/sksl/Disintegrate.sksl +117 -0
- package/sksl/FilmDissolve.sksl +60 -0
- package/sksl/FilmStrip.sksl +114 -0
- package/sksl/FlameWipe.sksl +162 -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/LightStreaks.sksl +126 -0
- package/sksl/LightWipe.sksl +97 -0
- package/sksl/PhotoDevelop.sksl +72 -0
- package/sksl/PixelStretch.sksl +84 -0
- package/sksl/PlusWipe.sksl +50 -0
- package/sksl/PopIn.sksl +69 -0
- package/sksl/Refraction.sksl +103 -0
- package/sksl/SmokeDissolve.sksl +115 -0
- package/sksl/SplatterWipe.sksl +161 -0
- package/sksl/StretchSlide.sksl +74 -0
- package/sksl/WedgeWipe.sksl +46 -0
- package/sksl/WhipSpin.sksl +79 -0
- package/sksl/WhipTilt.sksl +90 -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/CurvedWipe.glsl +51 -0
- package/transitions/CylinderRoll.glsl +101 -0
- package/transitions/Disintegrate.glsl +111 -0
- package/transitions/FilmDissolve.glsl +48 -0
- package/transitions/FilmStrip.glsl +104 -0
- package/transitions/FlameWipe.glsl +153 -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/LightStreaks.glsl +116 -0
- package/transitions/LightWipe.glsl +88 -0
- package/transitions/PhotoDevelop.glsl +58 -0
- package/transitions/PixelStretch.glsl +72 -0
- package/transitions/PlusWipe.glsl +37 -0
- package/transitions/PopIn.glsl +56 -0
- package/transitions/Refraction.glsl +94 -0
- package/transitions/SmokeDissolve.glsl +101 -0
- package/transitions/SplatterWipe.glsl +153 -0
- package/transitions/StretchSlide.glsl +61 -0
- package/transitions/WedgeWipe.glsl +34 -0
- package/transitions/WhipSpin.glsl +68 -0
- package/transitions/WhipTilt.glsl +78 -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/CurvedWipe.wgsl +198 -0
- package/wgsl/CylinderRoll.wgsl +330 -0
- package/wgsl/Disintegrate.wgsl +426 -0
- package/wgsl/FilmDissolve.wgsl +169 -0
- package/wgsl/FilmStrip.wgsl +381 -0
- package/wgsl/FlameWipe.wgsl +531 -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/LightStreaks.wgsl +460 -0
- package/wgsl/LightWipe.wgsl +277 -0
- package/wgsl/PhotoDevelop.wgsl +213 -0
- package/wgsl/PixelStretch.wgsl +298 -0
- package/wgsl/PlusWipe.wgsl +165 -0
- package/wgsl/PopIn.wgsl +213 -0
- package/wgsl/Refraction.wgsl +294 -0
- package/wgsl/SmokeDissolve.wgsl +363 -0
- package/wgsl/SplatterWipe.wgsl +613 -0
- package/wgsl/StretchSlide.wgsl +213 -0
- package/wgsl/WedgeWipe.wgsl +126 -0
- package/wgsl/WhipSpin.wgsl +241 -0
- package/wgsl/WhipTilt.wgsl +291 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// Author: gre
|
|
2
|
+
// License: MIT
|
|
3
|
+
// 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
|
|
4
|
+
// Tags: paint, splash, organic, reveal
|
|
5
|
+
|
|
6
|
+
// @range(2, 10, 1) Number of splats across the frame
|
|
7
|
+
uniform float splats; // = 4.0
|
|
8
|
+
// @range(0, 1) How long the spikes around each splat are
|
|
9
|
+
uniform float spikiness; // = 0.6
|
|
10
|
+
// @range(0, 1) How many droplets are flung around each splat
|
|
11
|
+
uniform float droplets; // = 0.6
|
|
12
|
+
// @range(0, 1) How far the paint drips run down
|
|
13
|
+
uniform float drips; // = 0.5
|
|
14
|
+
// @range(0, 1) How dark and glossy the rim of the splats is
|
|
15
|
+
uniform float rim; // = 0.5
|
|
16
|
+
// @param Random seed for the splats
|
|
17
|
+
uniform float seed; // = 3.0
|
|
18
|
+
|
|
19
|
+
const float PI = 3.141592653589793;
|
|
20
|
+
// number of spikes around a splat
|
|
21
|
+
const float SPIKES = 14.0;
|
|
22
|
+
// furthest reach of the shapes of a splat from its center, in cells. Splats are looked for in the 3x3 cells
|
|
23
|
+
// around a pixel, and the center of a splat 2 cells away is more than 1.35 cells away; on top of REACH, the
|
|
24
|
+
// smooth unions add up to 0.02 and the antialiasing 0.025 (at 10 splats), which leaves a margin of 0.055
|
|
25
|
+
// so that no splat is ever cut by the search
|
|
26
|
+
const float REACH = 1.25;
|
|
27
|
+
|
|
28
|
+
float hash12(vec2 v) {
|
|
29
|
+
vec3 v3 = fract(vec3(v.xyx) * 0.1031);
|
|
30
|
+
v3 += dot(v3, v3.yzx + 33.33);
|
|
31
|
+
return fract((v3.x + v3.y) * v3.z);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// smooth noise around a splat, wrapping over a full turn (t in 0..1)
|
|
35
|
+
float turnNoise(float t, float n, vec2 key) {
|
|
36
|
+
float x = t * n;
|
|
37
|
+
float i = floor(x);
|
|
38
|
+
float f = x - i;
|
|
39
|
+
float a = hash12(key + vec2(mod(i, n), 61.0));
|
|
40
|
+
float b = hash12(key + vec2(mod(i + 1.0, n), 61.0));
|
|
41
|
+
return mix(a, b, f * f * (3.0 - 2.0 * f));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// smooth union of two signed distances (> 0 inside)
|
|
45
|
+
float smax(float a, float b, float k) {
|
|
46
|
+
float h = max(k - abs(a - b), 0.0) / k;
|
|
47
|
+
return max(a, b) + h * h * k * 0.25;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// signed distance (approximately, in cells, > 0 inside) to the splat of a grid cell
|
|
51
|
+
float splat(vec2 q, vec2 cell, vec2 key) {
|
|
52
|
+
float t0 = 0.01 + 0.6 * hash12(key + vec2(3.0, 0.0)); // when it lands
|
|
53
|
+
if (progress <= t0) return -1.0;
|
|
54
|
+
vec2 c = cell + 0.5 + 0.3 * (vec2(hash12(key + vec2(5.0, 1.0)), hash12(key + vec2(9.0, 2.0))) - 0.5);
|
|
55
|
+
vec2 d = q - c;
|
|
56
|
+
float l = length(d);
|
|
57
|
+
// nothing of the splat reaches this far (its distance there would be below -0.08 anyway)
|
|
58
|
+
if (l > REACH + 0.1) return -1.0;
|
|
59
|
+
// a fast pop-in, then the paint slowly spreads until it covers its whole cell
|
|
60
|
+
float pop = clamp((progress - t0) / 0.08, 0.0, 1.0);
|
|
61
|
+
pop = 1.0 - (1.0 - pop) * (1.0 - pop) * (1.0 - pop);
|
|
62
|
+
float x = clamp((progress - t0) / (0.96 - t0), 0.0, 1.0);
|
|
63
|
+
float grow = x * x * x;
|
|
64
|
+
float r0 = 0.42 + 0.2 * hash12(key + vec2(11.0, 3.0));
|
|
65
|
+
// 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
|
|
66
|
+
float rc = mix(r0 * pop, 1.03, grow);
|
|
67
|
+
|
|
68
|
+
float a = l > 1e-5 ? atan(d.y, d.x) / (2.0 * PI) + 0.5 : 0.0;
|
|
69
|
+
// an irregular body
|
|
70
|
+
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);
|
|
71
|
+
float f = rc * (1.0 + lumps) - l;
|
|
72
|
+
|
|
73
|
+
// a spike in each slice of the turn: a ray that tapers from a wide base, the long ones ending in a bead;
|
|
74
|
+
// the slices on both sides are looked at too, as their spikes can lean over the boundary
|
|
75
|
+
float s = floor(a * SPIKES);
|
|
76
|
+
float spike = -1.0;
|
|
77
|
+
for (int k = -1; k <= 1; k++) {
|
|
78
|
+
float sl = s + float(k);
|
|
79
|
+
vec2 sk = key + vec2(mod(sl, SPIKES), 17.0);
|
|
80
|
+
float h = hash12(sk);
|
|
81
|
+
float w0 = (0.022 + 0.03 * hash12(sk + 1.5)) * pop;
|
|
82
|
+
float len = max(min(spikiness * (0.06 + 0.6 * h * h) * pop, REACH - 1.2 * w0 - rc), 0.0);
|
|
83
|
+
if (len > 0.0) {
|
|
84
|
+
// short spikes are thin too, so that no spikiness leaves a clean body
|
|
85
|
+
float w = w0 * min(len / 0.06, 1.0);
|
|
86
|
+
float ang = (sl + 0.5 + 0.4 * (hash12(sk + 0.5) - 0.5)) / SPIKES * 2.0 * PI - PI;
|
|
87
|
+
vec2 dir = vec2(cos(ang), sin(ang));
|
|
88
|
+
float along = dot(d, dir);
|
|
89
|
+
float across = abs(d.x * dir.y - d.y * dir.x);
|
|
90
|
+
float u = clamp((along - rc) / len, 0.0, 1.0);
|
|
91
|
+
float ray = min(w * (1.0 - 0.7 * u) - across, rc + len - along);
|
|
92
|
+
if (h > 0.5) ray = max(ray, w * 1.2 - length(d - dir * (rc + len)));
|
|
93
|
+
spike = max(spike, ray);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
f = smax(f, spike, 0.08);
|
|
97
|
+
|
|
98
|
+
// droplets flung out around the splat
|
|
99
|
+
for (int j = 0; j < 5; j++) {
|
|
100
|
+
vec2 dk = key + vec2(float(j), 29.0);
|
|
101
|
+
float hr = hash12(dk + 0.5);
|
|
102
|
+
float rad = (0.015 + 0.05 * hr * hr) * clamp(droplets * 5.0 - float(j), 0.0, 1.0) * pop;
|
|
103
|
+
if (rad > 0.0) {
|
|
104
|
+
float da = 2.0 * PI * hash12(dk);
|
|
105
|
+
float dist = min(r0 + 0.08 + 0.5 * hash12(dk + 1.5), REACH - rad) * mix(0.5, 1.0, pop);
|
|
106
|
+
f = max(f, rad - length(d - dist * vec2(cos(da), sin(da))));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// drips running down from the bottom of the splat
|
|
111
|
+
if (drips > 0.0) {
|
|
112
|
+
float run = clamp((progress - t0 - 0.03) / 0.45, 0.0, 1.0);
|
|
113
|
+
run = run * (2.0 - run);
|
|
114
|
+
for (int j = 0; j < 2; j++) {
|
|
115
|
+
vec2 dk = key + vec2(float(j), 43.0);
|
|
116
|
+
float xo = (hash12(dk) - 0.5) * r0;
|
|
117
|
+
float dw = (0.03 + 0.02 * hash12(dk + 0.5)) * pop;
|
|
118
|
+
float top = sqrt(r0 * r0 - xo * xo) * pop;
|
|
119
|
+
float bottom = min(top + drips * (0.25 + 0.75 * hash12(dk + 1.5)) * run, sqrt(REACH * REACH - xo * xo) - 1.6 * dw);
|
|
120
|
+
float dx = abs(d.x - xo);
|
|
121
|
+
float drip = min(dw - dx, min(d.y + bottom, -d.y));
|
|
122
|
+
float tip = dw * 1.4 - length(vec2(dx, d.y + bottom + 0.2 * dw));
|
|
123
|
+
f = smax(f, max(drip, tip), 0.05);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return f;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
vec4 transition(vec2 uv) {
|
|
130
|
+
float n = max(1.0, floor(splats + 0.5));
|
|
131
|
+
float cellSize = max(ratio, 1.0) / n;
|
|
132
|
+
vec2 q = vec2(uv.x * ratio, uv.y) / cellSize; // in cells
|
|
133
|
+
vec2 base = floor(q);
|
|
134
|
+
vec2 sd = seed * vec2(7.0, 13.0);
|
|
135
|
+
float f = -1.0;
|
|
136
|
+
for (int j = -1; j <= 1; j++) {
|
|
137
|
+
for (int i = -1; i <= 1; i++) {
|
|
138
|
+
vec2 cell = base + vec2(float(i), float(j));
|
|
139
|
+
f = max(f, splat(q, cell, cell + sd));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
float aa = 0.0025 / cellSize; // about a pixel or two, in cells
|
|
143
|
+
float inside = smoothstep(-aa, aa, f);
|
|
144
|
+
vec4 from = getFromColor(uv);
|
|
145
|
+
vec4 to = getToColor(uv);
|
|
146
|
+
// thick paint: a darker rim with a thin glossy line just inside it, gone once the frame is covered
|
|
147
|
+
float e = clamp(f / 0.045, 0.0, 1.0);
|
|
148
|
+
float amount = rim * (1.0 - smoothstep(0.75, 1.0, progress));
|
|
149
|
+
float dark = (1.0 - e) * (1.0 - e) * 0.6;
|
|
150
|
+
float gloss = smoothstep(0.2, 0.4, e) * (1.0 - smoothstep(0.4, 0.7, e)) * 0.3;
|
|
151
|
+
to.rgb = mix(to.rgb * (1.0 - dark * amount), vec3(1.0), gloss * amount * to.a);
|
|
152
|
+
return mix(from, to, inside);
|
|
153
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Author: gre
|
|
2
|
+
// License: MIT
|
|
3
|
+
// 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
|
|
4
|
+
// Tags: slide, stretch, squash, elastic, bounce, directional
|
|
5
|
+
|
|
6
|
+
// @param Direction in which the images slide
|
|
7
|
+
uniform vec2 direction; // = vec2(-1.0, 0.0)
|
|
8
|
+
// @range(0, 1) How long the outgoing image stretches and how much the squashed incoming one bulges
|
|
9
|
+
uniform float stretch; // = 0.6
|
|
10
|
+
// @range(0, 1) How far the incoming image overshoots before it springs back to its shape
|
|
11
|
+
uniform float bounce; // = 0.6
|
|
12
|
+
|
|
13
|
+
const float PI = 3.14159265;
|
|
14
|
+
|
|
15
|
+
// mirror the coordinates back into the frame
|
|
16
|
+
vec2 mirror(vec2 v) {
|
|
17
|
+
return 1.0 - abs(1.0 - mod(v, 2.0));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
vec4 transition(vec2 uv) {
|
|
21
|
+
float dl = length(direction);
|
|
22
|
+
vec2 d = dl > 1e-6 ? direction / dl : vec2(-1.0, 0.0);
|
|
23
|
+
vec2 n = vec2(-d.y, d.x);
|
|
24
|
+
// s: position along the slide across the frame, from 0 (trailing side) to 1 (leading side)
|
|
25
|
+
float ext = abs(d.x) + abs(d.y);
|
|
26
|
+
vec2 q = uv - 0.5;
|
|
27
|
+
float s = 0.5 + dot(q, d) / ext;
|
|
28
|
+
float t = progress;
|
|
29
|
+
|
|
30
|
+
// the slide accelerates into the landing (a smoothstep when there is no bounce)
|
|
31
|
+
float land = mix(1.0, 0.5, bounce);
|
|
32
|
+
float m = 3.0 * bounce; // speed at the landing, relative to a linear slide
|
|
33
|
+
float x = clamp(t / land, 0.0, 1.0);
|
|
34
|
+
float e = x * x * (3.0 - 2.0 * x) + m * x * x * (x - 1.0);
|
|
35
|
+
// then a damped spring, starting at the landing speed, that comes to rest exactly at the end
|
|
36
|
+
float w = 2.5 * PI;
|
|
37
|
+
float u = clamp((t - land) / max(1.0 - land, 1e-4), 0.0, 1.0);
|
|
38
|
+
float osc = m * (1.0 - land) / (land * w) * exp(-u) * sin(w * u) * (1.0 - u) * (1.0 - u);
|
|
39
|
+
// past the landing the frame stays covered: the spring stretches the incoming image
|
|
40
|
+
// along the slide, and squashes it back into a sideways bulge
|
|
41
|
+
float len = e + max(osc, 0.0);
|
|
42
|
+
float bulge = 1.0 - e + 3.0 * max(-osc, 0.0);
|
|
43
|
+
|
|
44
|
+
// the incoming image is pinned at the trailing side and spans up to the seam
|
|
45
|
+
float g = 1.0 + 0.6 * stretch * bulge;
|
|
46
|
+
vec2 pt = q + d * (s / max(len, 1e-4) - s) * ext;
|
|
47
|
+
pt -= n * dot(pt, n) * (1.0 - 1.0 / g);
|
|
48
|
+
vec4 b = getToColor(mirror(pt + 0.5));
|
|
49
|
+
|
|
50
|
+
// the outgoing image hangs from the seam and stretches out long ahead of it,
|
|
51
|
+
// the most near the seam, where it is pulled
|
|
52
|
+
float l = 1.0 + 4.0 * stretch * e;
|
|
53
|
+
float k = clamp(1.6 * stretch * e, 0.0, 0.8);
|
|
54
|
+
float y = max(s - e, 0.0) / l;
|
|
55
|
+
// invert y = (1 + k) v - k v^2
|
|
56
|
+
float v = 2.0 * y / ((1.0 + k) + sqrt((1.0 + k) * (1.0 + k) - 4.0 * k * y));
|
|
57
|
+
vec4 a = getFromColor(mirror(q + d * (v - s) * ext + 0.5));
|
|
58
|
+
|
|
59
|
+
// past the landing, only the incoming image is left
|
|
60
|
+
return (s < len || t >= land) ? b : a;
|
|
61
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Author: gre
|
|
2
|
+
// License: MIT
|
|
3
|
+
// Description: Two hands sweep away from each other around the center, opening a widening wedge that reveals the incoming image
|
|
4
|
+
// Tags: wipe, radial, clock, wedge
|
|
5
|
+
|
|
6
|
+
#define PI 3.141592653589793
|
|
7
|
+
|
|
8
|
+
// @range(-180, 180) Direction the wedge opens from, in degrees clockwise from 12 o'clock
|
|
9
|
+
uniform float angle; // = 0.0
|
|
10
|
+
// @range(0, 0.2) Softness of the hands' edges
|
|
11
|
+
uniform float smoothness; // = 0.01
|
|
12
|
+
// @param Point the hands turn around
|
|
13
|
+
uniform vec2 center; // = vec2(0.5)
|
|
14
|
+
|
|
15
|
+
vec4 transition (vec2 uv) {
|
|
16
|
+
// At the end, float PI rounds above pi and sin(spread) can turn slightly negative
|
|
17
|
+
if (progress >= 1.0) return getToColor(uv);
|
|
18
|
+
// Measured in square pixels, so the angles are not stretched
|
|
19
|
+
vec2 q = (uv - center) * vec2(ratio, 1.0);
|
|
20
|
+
float a = radians(angle);
|
|
21
|
+
// Local frame: y along the starting direction, x across it (the wedge is symmetric)
|
|
22
|
+
vec2 p = vec2(abs(q.x * cos(a) - q.y * sin(a)), q.x * sin(a) + q.y * cos(a));
|
|
23
|
+
// Each hand has turned by half a turn at the end
|
|
24
|
+
float spread = PI * progress;
|
|
25
|
+
vec2 hand = vec2(sin(spread), cos(spread));
|
|
26
|
+
// Signed distance to the wedge: the nearest hand, negative inside
|
|
27
|
+
float l = length(p);
|
|
28
|
+
float d = length(p - hand * clamp(dot(p, hand), 0.0, l)) * sign(hand.y * p.x - hand.x * p.y);
|
|
29
|
+
// The soft edge keeps an even width and slides from outside to inside the hands,
|
|
30
|
+
// so nothing is revealed at the start and everything is at the end
|
|
31
|
+
float s = max(smoothness, 0.001);
|
|
32
|
+
float m = 1.0 - smoothstep(0.0, s, d + s * (1.0 - progress));
|
|
33
|
+
return mix(getFromColor(uv), getToColor(uv), m);
|
|
34
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Author: gre
|
|
2
|
+
// License: MIT
|
|
3
|
+
// 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
|
|
4
|
+
// Tags: rotate, motion-blur, spin
|
|
5
|
+
|
|
6
|
+
// @range(-3, 3) Total rotation, in turns, split between the two images (negative turns clockwise)
|
|
7
|
+
uniform float turns; // = 1.0
|
|
8
|
+
// @range(0, 1) Length of the motion blur along the spin
|
|
9
|
+
uniform float blur; // = 0.5
|
|
10
|
+
// @range(0, 1) How much the color channels split apart as the spin speeds up
|
|
11
|
+
uniform float chroma; // = 0.6
|
|
12
|
+
// @range(0, 1) How much the camera zooms in at the fastest point
|
|
13
|
+
uniform float zoom; // = 0.25
|
|
14
|
+
|
|
15
|
+
const float PI = 3.141592653589793;
|
|
16
|
+
const int SAMPLES = 24;
|
|
17
|
+
|
|
18
|
+
float hash(vec2 p) {
|
|
19
|
+
vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
|
|
20
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
21
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// fold the coordinates back into the image so that the rotated frame stays filled
|
|
25
|
+
vec2 mirror(vec2 v) {
|
|
26
|
+
vec2 m = mod(v, 2.0);
|
|
27
|
+
return mix(m, 2.0 - m, step(1.0, m));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// the camera's roll angle at time t: the outgoing image speeds up until the middle,
|
|
31
|
+
// then the incoming one, already turning, slows down to rest
|
|
32
|
+
float rollAngle(float t) {
|
|
33
|
+
float halfTurn = PI * turns;
|
|
34
|
+
if (t < 0.5) {
|
|
35
|
+
float x = 2.0 * t;
|
|
36
|
+
return halfTurn * x * x * x;
|
|
37
|
+
}
|
|
38
|
+
float x = 2.0 - 2.0 * t;
|
|
39
|
+
return -halfTurn * x * x * x;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
vec4 transition(vec2 uv) {
|
|
43
|
+
float p = progress;
|
|
44
|
+
float h = 1.0 - abs(2.0 * p - 1.0); // 0 at both ends, 1 at the cut
|
|
45
|
+
// the shutter is open longer as the spin speeds up, and closed at both ends
|
|
46
|
+
float shutter = blur * 0.1 * h;
|
|
47
|
+
float scale = 1.0 + zoom * h * h * h;
|
|
48
|
+
vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
|
|
49
|
+
float jitter = hash(uv * vec2(ratio, 1.0) * 731.0);
|
|
50
|
+
vec3 color = vec3(0.0);
|
|
51
|
+
vec3 weight = vec3(0.0);
|
|
52
|
+
float alpha = 0.0;
|
|
53
|
+
for (int i = 0; i < SAMPLES; i++) {
|
|
54
|
+
float s = (float(i) + jitter) / float(SAMPLES) - 0.5;
|
|
55
|
+
float t = clamp(p + s * shutter, 0.0, 1.0);
|
|
56
|
+
float a = rollAngle(t);
|
|
57
|
+
float c = cos(a), sn = sin(a);
|
|
58
|
+
vec2 r = vec2(c * q.x + sn * q.y, -sn * q.x + c * q.y) / scale;
|
|
59
|
+
vec2 suv = mirror(r / vec2(ratio, 1.0) + 0.5);
|
|
60
|
+
vec4 col = t < 0.5 ? getFromColor(suv) : getToColor(suv);
|
|
61
|
+
// red trails behind and blue leads along the arc: the channels split with the speed
|
|
62
|
+
vec3 w = max(vec3(1.0 - 4.0 * chroma * s, 1.0, 1.0 + 4.0 * chroma * s), 0.0);
|
|
63
|
+
color += col.rgb * col.a * w;
|
|
64
|
+
weight += col.a * w;
|
|
65
|
+
alpha += col.a;
|
|
66
|
+
}
|
|
67
|
+
return vec4(color / max(weight, vec3(1e-5)), alpha / float(SAMPLES));
|
|
68
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Author: gre
|
|
2
|
+
// License: MIT
|
|
3
|
+
// Description: 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
|
|
4
|
+
// Tags: 3d, rotate, motion-blur, vertical
|
|
5
|
+
|
|
6
|
+
// @param Tilt the camera down to an incoming image below instead of above
|
|
7
|
+
uniform bool down; // = false
|
|
8
|
+
// @range(0, 1) Length of the motion blur along the tilt
|
|
9
|
+
uniform float blur; // = 0.5
|
|
10
|
+
// @range(0, 1) How much the color channels split apart as the tilt speeds up
|
|
11
|
+
uniform float chroma; // = 0.5
|
|
12
|
+
// @range(0, 1) Strength of the perspective (field of view of the camera)
|
|
13
|
+
uniform float perspective; // = 0.7
|
|
14
|
+
|
|
15
|
+
const float PI = 3.141592653589793;
|
|
16
|
+
const int SAMPLES = 24;
|
|
17
|
+
|
|
18
|
+
float hash(vec2 p) {
|
|
19
|
+
vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
|
|
20
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
21
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// fold the coordinates back into the image, only a safety at the far edges
|
|
25
|
+
vec2 mirror(vec2 v) {
|
|
26
|
+
vec2 m = mod(v, 2.0);
|
|
27
|
+
return mix(m, 2.0 - m, step(1.0, m));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// how far the camera has tilted at time t, from 0 to 1: slow start, whip in the middle, slow landing
|
|
31
|
+
float tilt(float t) {
|
|
32
|
+
float h = 1.0 - abs(2.0 * t - 1.0);
|
|
33
|
+
float e = 0.5 * h * h * h * h;
|
|
34
|
+
return t < 0.5 ? e : 1.0 - e;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
vec4 transition(vec2 uv) {
|
|
38
|
+
float p = progress;
|
|
39
|
+
float h = 1.0 - abs(2.0 * p - 1.0); // 0 at both ends, 1 in the middle
|
|
40
|
+
// the shutter is open longer as the tilt speeds up, and closed at both ends
|
|
41
|
+
float shutter = blur * 0.25 * h * h;
|
|
42
|
+
// the images are two faces of a drum around the camera, each filling the frame from the
|
|
43
|
+
// middle: they meet edge to edge at the angle of the field of view, which the camera turns by
|
|
44
|
+
float halfFov = mix(15.0, 45.0, perspective) * PI / 180.0;
|
|
45
|
+
float dist = 0.5 / tan(halfFov);
|
|
46
|
+
vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
|
|
47
|
+
if (down) q.y = -q.y;
|
|
48
|
+
float jitter = hash(uv * vec2(ratio, 1.0) * 731.0);
|
|
49
|
+
vec3 color = vec3(0.0);
|
|
50
|
+
vec3 weight = vec3(0.0);
|
|
51
|
+
float alpha = 0.0;
|
|
52
|
+
for (int i = 0; i < SAMPLES; i++) {
|
|
53
|
+
float s = (float(i) + jitter) / float(SAMPLES) - 0.5;
|
|
54
|
+
float t = clamp(p + s * shutter, 0.0, 1.0);
|
|
55
|
+
float a = 2.0 * halfFov * tilt(t);
|
|
56
|
+
// zoom in just enough that the faces always cover the frame, wherever their edge is
|
|
57
|
+
vec2 r = q * cos(halfFov) / cos(halfFov - a);
|
|
58
|
+
// the ray in the frame of the outgoing face, then of the incoming one
|
|
59
|
+
float c0 = cos(a), s0 = sin(a);
|
|
60
|
+
vec2 d0 = vec2(r.y * c0 + dist * s0, dist * c0 - r.y * s0);
|
|
61
|
+
float b = a - 2.0 * halfFov;
|
|
62
|
+
float c1 = cos(b), s1 = sin(b);
|
|
63
|
+
vec2 d1 = vec2(r.y * c1 + dist * s1, dist * c1 - r.y * s1);
|
|
64
|
+
// the ray leaves the drum through the nearest face
|
|
65
|
+
bool incoming = d1.y > d0.y;
|
|
66
|
+
vec2 d = incoming ? d1 : d0;
|
|
67
|
+
vec2 hit = dist / d.y * vec2(r.x, d.x);
|
|
68
|
+
if (down) hit.y = -hit.y;
|
|
69
|
+
vec2 suv = mirror(hit / vec2(ratio, 1.0) + 0.5);
|
|
70
|
+
vec4 col = incoming ? getToColor(suv) : getFromColor(suv);
|
|
71
|
+
// red trails behind and blue leads along the motion: the channels split with the speed
|
|
72
|
+
vec3 w = max(vec3(1.0 - 4.0 * chroma * s, 1.0, 1.0 + 4.0 * chroma * s), 0.0);
|
|
73
|
+
color += col.rgb * col.a * w;
|
|
74
|
+
weight += col.a * w;
|
|
75
|
+
alpha += col.a;
|
|
76
|
+
}
|
|
77
|
+
return vec4(color / max(weight, vec3(1e-5)), alpha / float(SAMPLES));
|
|
78
|
+
}
|