gl-transitions 2.4.0 → 3.0.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 +67 -0
- package/README.md +16 -1
- package/compatibility.json +251 -121
- package/gl-transitions.js +1 -1
- package/gl-transitions.json +1 -1
- package/glsl3/ArrowWipe.glsl +100 -0
- package/glsl3/BandWipe.glsl +67 -0
- package/glsl3/BlockSlide.glsl +87 -0
- package/glsl3/BowTie.glsl +1 -1
- package/glsl3/CellDissolve.glsl +91 -0
- package/glsl3/Crumple.glsl +173 -0
- package/glsl3/DirectionalWipe.glsl +1 -1
- package/glsl3/GlintDissolve.glsl +125 -0
- package/glsl3/HeatHaze.glsl +79 -0
- package/glsl3/Hologram.glsl +97 -0
- package/glsl3/InsetWipe.glsl +58 -0
- package/glsl3/LightningFlash.glsl +200 -0
- package/glsl3/LiquidFill.glsl +102 -0
- package/glsl3/PlasmaDissolve.glsl +51 -0
- package/glsl3/RingsWipe.glsl +106 -0
- package/glsl3/SawtoothWipe.glsl +73 -0
- package/glsl3/SnakeBlockWipe.glsl +40 -0
- package/glsl3/Snapshot.glsl +86 -0
- package/glsl3/Sphere.glsl +95 -0
- package/glsl3/SpiralBlockWipe.glsl +65 -0
- package/glsl3/Vortex.glsl +106 -0
- package/glsl3/WarpSpeed.glsl +120 -0
- package/index.js +1 -1
- package/layouts.json +846 -253
- package/llms-full.txt +665 -476
- package/llms.txt +197 -189
- package/msl/ArrowWipe.metal +391 -0
- package/msl/BandWipe.metal +353 -0
- package/msl/BlockSlide.metal +418 -0
- package/msl/BowTie.metal +1 -1
- package/msl/CellDissolve.metal +374 -0
- package/msl/Crumple.metal +766 -0
- package/msl/DirectionalWipe.metal +1 -1
- package/msl/GlintDissolve.metal +558 -0
- package/msl/HeatHaze.metal +320 -0
- package/msl/Hologram.metal +380 -0
- package/msl/InsetWipe.metal +232 -0
- package/msl/LightningFlash.metal +1038 -0
- package/msl/LiquidFill.metal +373 -0
- package/msl/PlasmaDissolve.metal +178 -0
- package/msl/RingsWipe.metal +437 -0
- package/msl/SawtoothWipe.metal +310 -0
- package/msl/SnakeBlockWipe.metal +216 -0
- package/msl/Snapshot.metal +321 -0
- package/msl/Sphere.metal +345 -0
- package/msl/SpiralBlockWipe.metal +281 -0
- package/msl/Vortex.metal +522 -0
- package/msl/WarpSpeed.metal +549 -0
- package/package.json +1 -1
- package/skills/gl-transitions/references/catalog.md +92 -59
- package/sksl/ArrowWipe.sksl +111 -0
- package/sksl/BandWipe.sksl +77 -0
- package/sksl/BlockSlide.sksl +99 -0
- package/sksl/BowTie.sksl +1 -1
- package/sksl/CellDissolve.sksl +103 -0
- package/sksl/Crumple.sksl +179 -0
- package/sksl/DirectionalWipe.sksl +1 -1
- package/sksl/GlintDissolve.sksl +136 -0
- package/sksl/HeatHaze.sksl +90 -0
- package/sksl/Hologram.sksl +108 -0
- package/sksl/InsetWipe.sksl +70 -0
- package/sksl/LightningFlash.sksl +202 -0
- package/sksl/LiquidFill.sksl +113 -0
- package/sksl/PlasmaDissolve.sksl +64 -0
- package/sksl/RingsWipe.sksl +115 -0
- package/sksl/SawtoothWipe.sksl +83 -0
- package/sksl/SnakeBlockWipe.sksl +53 -0
- package/sksl/Snapshot.sksl +98 -0
- package/sksl/Sphere.sksl +108 -0
- package/sksl/SpiralBlockWipe.sksl +76 -0
- package/sksl/Vortex.sksl +116 -0
- package/sksl/WarpSpeed.sksl +131 -0
- package/sksl/index.js +1 -1
- package/transitions/ArrowWipe.glsl +99 -0
- package/transitions/BandWipe.glsl +66 -0
- package/transitions/BlockSlide.glsl +86 -0
- package/transitions/BowTie.glsl +1 -1
- package/transitions/CellDissolve.glsl +90 -0
- package/transitions/Crumple.glsl +172 -0
- package/transitions/DirectionalWipe.glsl +1 -1
- package/transitions/GlintDissolve.glsl +124 -0
- package/transitions/HeatHaze.glsl +78 -0
- package/transitions/Hologram.glsl +96 -0
- package/transitions/InsetWipe.glsl +57 -0
- package/transitions/LightningFlash.glsl +199 -0
- package/transitions/LiquidFill.glsl +101 -0
- package/transitions/PlasmaDissolve.glsl +50 -0
- package/transitions/RingsWipe.glsl +105 -0
- package/transitions/SawtoothWipe.glsl +72 -0
- package/transitions/SnakeBlockWipe.glsl +39 -0
- package/transitions/Snapshot.glsl +85 -0
- package/transitions/Sphere.glsl +94 -0
- package/transitions/SpiralBlockWipe.glsl +64 -0
- package/transitions/Vortex.glsl +105 -0
- package/transitions/WarpSpeed.glsl +119 -0
- package/wgsl/ArrowWipe.wgsl +352 -0
- package/wgsl/BandWipe.wgsl +319 -0
- package/wgsl/BlockSlide.wgsl +384 -0
- package/wgsl/BowTie.wgsl +1 -1
- package/wgsl/CellDissolve.wgsl +323 -0
- package/wgsl/Crumple.wgsl +709 -0
- package/wgsl/DirectionalWipe.wgsl +1 -1
- package/wgsl/GlintDissolve.wgsl +519 -0
- package/wgsl/HeatHaze.wgsl +282 -0
- package/wgsl/Hologram.wgsl +339 -0
- package/wgsl/InsetWipe.wgsl +200 -0
- package/wgsl/LightningFlash.wgsl +964 -0
- package/wgsl/LiquidFill.wgsl +339 -0
- package/wgsl/PlasmaDissolve.wgsl +149 -0
- package/wgsl/RingsWipe.wgsl +394 -0
- package/wgsl/SawtoothWipe.wgsl +279 -0
- package/wgsl/SnakeBlockWipe.wgsl +188 -0
- package/wgsl/Snapshot.wgsl +287 -0
- package/wgsl/Sphere.wgsl +316 -0
- package/wgsl/SpiralBlockWipe.wgsl +250 -0
- package/wgsl/Vortex.wgsl +463 -0
- package/wgsl/WarpSpeed.wgsl +497 -0
- package/glsl3/BlockDissolve.glsl +0 -16
- package/glsl3/BowTieVertical.glsl +0 -117
- package/glsl3/Box.glsl +0 -33
- package/glsl3/LinearBlur.glsl +0 -30
- package/glsl3/MosaicBlend.glsl +0 -21
- package/glsl3/MosaicFade.glsl +0 -20
- package/glsl3/RotateFade.glsl +0 -22
- package/glsl3/ScaleIn.glsl +0 -18
- package/glsl3/WipeDown.glsl +0 -12
- package/glsl3/WipeLeft.glsl +0 -12
- package/glsl3/WipeRight.glsl +0 -12
- package/glsl3/WipeUp.glsl +0 -12
- package/msl/BlockDissolve.metal +0 -108
- package/msl/BowTieVertical.metal +0 -375
- package/msl/Box.metal +0 -204
- package/msl/LinearBlur.metal +0 -169
- package/msl/MosaicBlend.metal +0 -136
- package/msl/MosaicFade.metal +0 -137
- package/msl/RotateFade.metal +0 -116
- package/msl/ScaleIn.metal +0 -111
- package/msl/WipeDown.metal +0 -105
- package/msl/WipeLeft.metal +0 -105
- package/msl/WipeRight.metal +0 -105
- package/msl/WipeUp.metal +0 -105
- package/sksl/BlockDissolve.sksl +0 -29
- package/sksl/BowTieVertical.sksl +0 -130
- package/sksl/Box.sksl +0 -47
- package/sksl/LinearBlur.sksl +0 -44
- package/sksl/MosaicBlend.sksl +0 -34
- package/sksl/MosaicFade.sksl +0 -33
- package/sksl/RotateFade.sksl +0 -34
- package/sksl/ScaleIn.sksl +0 -32
- package/sksl/WipeDown.sksl +0 -26
- package/sksl/WipeLeft.sksl +0 -26
- package/sksl/WipeRight.sksl +0 -26
- package/sksl/WipeUp.sksl +0 -26
- package/transitions/BlockDissolve.glsl +0 -15
- package/transitions/BowTieVertical.glsl +0 -116
- package/transitions/Box.glsl +0 -32
- package/transitions/LinearBlur.glsl +0 -29
- package/transitions/MosaicBlend.glsl +0 -20
- package/transitions/MosaicFade.glsl +0 -19
- package/transitions/RotateFade.glsl +0 -21
- package/transitions/ScaleIn.glsl +0 -17
- package/transitions/WipeDown.glsl +0 -11
- package/transitions/WipeLeft.glsl +0 -11
- package/transitions/WipeRight.glsl +0 -11
- package/transitions/WipeUp.glsl +0 -11
- package/wgsl/BlockDissolve.wgsl +0 -78
- package/wgsl/BowTieVertical.wgsl +0 -331
- package/wgsl/Box.wgsl +0 -176
- package/wgsl/LinearBlur.wgsl +0 -131
- package/wgsl/MosaicBlend.wgsl +0 -108
- package/wgsl/MosaicFade.wgsl +0 -107
- package/wgsl/RotateFade.wgsl +0 -85
- package/wgsl/ScaleIn.wgsl +0 -79
- package/wgsl/WipeDown.wgsl +0 -77
- package/wgsl/WipeLeft.wgsl +0 -77
- package/wgsl/WipeRight.wgsl +0 -77
- package/wgsl/WipeUp.wgsl +0 -77
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// WarpSpeed — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/WarpSpeed.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The camera jumps to light speed: star streaks shoot out from the center and stretch longer and longer while the outgoing image is pulled into a radial smear, then after a flash the incoming image emerges from the center as the streaks shrink back
|
|
5
|
+
// Tags: zoom, radial, light, motion-blur, space
|
|
6
|
+
|
|
7
|
+
// @param Point the camera flies toward, from (0, 0) at the bottom left to (1, 1) at the top right
|
|
8
|
+
uniform vec2 center; // = vec2(0.5, 0.5)
|
|
9
|
+
// @range(20, 400) Number of star streaks around the center
|
|
10
|
+
uniform float streaks; // = 160.0
|
|
11
|
+
// @color Color of the streaks and of the flash, added as light
|
|
12
|
+
uniform vec4 streakColor; // = vec4(0.78, 0.88, 1.0, 1.0)
|
|
13
|
+
// @range(0, 1) Length of the streaks and of the radial smear
|
|
14
|
+
uniform float strength; // = 0.6
|
|
15
|
+
// @range(0, 1) Brightness of the flash at the peak of the jump
|
|
16
|
+
uniform float flash; // = 0.5
|
|
17
|
+
|
|
18
|
+
const float PI = 3.141592653589793;
|
|
19
|
+
const int TAPS = 12;
|
|
20
|
+
|
|
21
|
+
float hash(vec2 p) {
|
|
22
|
+
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
|
|
23
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
24
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// one layer of stars: one per angular cell, flying outward and stretched along its ray
|
|
28
|
+
float stars(float a, float r, float n, float layer, float travel, float speed, float reach) {
|
|
29
|
+
float cell = floor(a * n);
|
|
30
|
+
float h1 = hash(vec2(cell, layer));
|
|
31
|
+
float h2 = hash(vec2(cell, layer + 17.0));
|
|
32
|
+
float h3 = hash(vec2(cell, layer + 31.0));
|
|
33
|
+
// where the star is in its flight, from near the center to past the corners,
|
|
34
|
+
// speeding up as it comes closer
|
|
35
|
+
float life = fract(h1 + travel * (0.6 + 0.8 * h2));
|
|
36
|
+
float head = reach * (0.05 + 1.05 * pow(life, 1.4));
|
|
37
|
+
// the streak is the path of the star during the exposure: longer when the camera is faster
|
|
38
|
+
float tail = head * (1.0 - min(0.9, speed * (0.15 + 0.5 * h3)));
|
|
39
|
+
float along = clamp((r - tail) / max(head - tail, 1e-4), 0.0, 1.0);
|
|
40
|
+
float inside = step(tail, r) * (1.0 - smoothstep(head - 0.006, head, r));
|
|
41
|
+
// brightest at the head, fading toward the tail
|
|
42
|
+
float profile = inside * along * along;
|
|
43
|
+
// thin across the ray, a bit wider away from the center, with a faint halo,
|
|
44
|
+
// faded out before the edges of the cell so that no seam shows between cells
|
|
45
|
+
float f = fract(a * n);
|
|
46
|
+
float cellWidth = 2.0 * PI * r / n;
|
|
47
|
+
float offset = 0.3 + 0.4 * h3;
|
|
48
|
+
float across = (f - offset) * cellWidth;
|
|
49
|
+
float width = min(0.0014 + 0.002 * r / reach, 0.15 * cellWidth);
|
|
50
|
+
float x = across * across / (width * width);
|
|
51
|
+
float line = (exp(-x) + 0.25 * exp(-x / 9.0)) * smoothstep(0.0, 0.2, min(f, 1.0 - f));
|
|
52
|
+
// fade in from far away, out past the frame, and only some cells hold a star
|
|
53
|
+
float fade = smoothstep(0.0, 0.2, life) * (1.0 - smoothstep(0.9, 1.0, life));
|
|
54
|
+
return profile * line * fade * (0.4 + 0.6 * h2) * step(0.25, hash(vec2(cell, layer + 43.0)));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// an image pulled into a radial smear toward the center: scaled by k, blurred over a fraction b
|
|
58
|
+
vec4 smear(vec2 uv, float k, float b, float jitter, bool incoming) {
|
|
59
|
+
if (b <= 0.0 && k >= 1.0) {
|
|
60
|
+
vec4 c = incoming ? getToColor(uv) : getFromColor(uv);
|
|
61
|
+
return vec4(c.rgb * c.a, c.a);
|
|
62
|
+
}
|
|
63
|
+
vec4 sum = vec4(0.0);
|
|
64
|
+
for (int i = 0; i < TAPS; i++) {
|
|
65
|
+
float s = k * (1.0 - b * (float(i) + jitter) / float(TAPS));
|
|
66
|
+
vec2 q = center + (uv - center) * s;
|
|
67
|
+
vec4 c = incoming ? getToColor(q) : getFromColor(q);
|
|
68
|
+
sum += vec4(c.rgb * c.a, c.a);
|
|
69
|
+
}
|
|
70
|
+
return sum / float(TAPS);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
vec4 transition(vec2 uv) {
|
|
74
|
+
float p = progress;
|
|
75
|
+
vec2 aspect = vec2(ratio, 1.0);
|
|
76
|
+
vec2 d = (uv - center) * aspect;
|
|
77
|
+
float r = length(d);
|
|
78
|
+
// (nudged off zero, where atan is undefined)
|
|
79
|
+
float a = atan(d.y, d.x + 1e-6) / (2.0 * PI) + 0.5;
|
|
80
|
+
// distance from the center to the farthest corner
|
|
81
|
+
vec2 far = max(center, 1.0 - center) * aspect;
|
|
82
|
+
float reach = length(far);
|
|
83
|
+
|
|
84
|
+
// the camera speeds up to the jump, at the middle, then slows down
|
|
85
|
+
float speed = sin(PI * p);
|
|
86
|
+
speed *= speed;
|
|
87
|
+
float travel = 3.0 * (p - sin(2.0 * PI * p) / (2.0 * PI));
|
|
88
|
+
float jitter = hash(floor(uv * aspect * 997.0));
|
|
89
|
+
|
|
90
|
+
// the outgoing image is pulled forward into the smear; the incoming one arrives
|
|
91
|
+
// magnified and smeared, and settles
|
|
92
|
+
float goOut = smoothstep(0.0, 0.55, p);
|
|
93
|
+
float goIn = 1.0 - smoothstep(0.45, 1.0, p);
|
|
94
|
+
// the incoming image emerges from the center and spreads out to the corners
|
|
95
|
+
float soft = 0.35 * reach;
|
|
96
|
+
float edge = mix(-soft, reach + soft, smoothstep(0.42, 0.78, p));
|
|
97
|
+
float m = 1.0 - smoothstep(edge - soft, edge, r);
|
|
98
|
+
vec4 before = vec4(0.0);
|
|
99
|
+
vec4 after = vec4(0.0);
|
|
100
|
+
if (m < 1.0) before = smear(uv, 1.0 - 0.3 * strength * goOut * goOut, 0.6 * strength * goOut, jitter, false);
|
|
101
|
+
if (m > 0.0) after = smear(uv, 1.0 - 0.3 * strength * goIn * goIn, 0.6 * strength * goIn, jitter, true);
|
|
102
|
+
vec4 c = mix(before, after, m);
|
|
103
|
+
// darker while in the jump, so that the streaks stand out, and brighter soon after it
|
|
104
|
+
// so the incoming image comes out clear
|
|
105
|
+
float dark = p < 0.5 ? speed : speed * speed * speed;
|
|
106
|
+
c.rgb *= 1.0 - 0.65 * (0.5 + 0.5 * strength) * dark;
|
|
107
|
+
|
|
108
|
+
// the streaks: two layers of stars, their length growing with the speed
|
|
109
|
+
float n = max(floor(streaks), 1.0);
|
|
110
|
+
float len = speed * (0.5 + 1.5 * strength);
|
|
111
|
+
float s = stars(a, r, n, 1.0, travel, len, reach);
|
|
112
|
+
s += stars(fract(a + 0.37), r, max(floor(n * 0.71), 1.0), 2.0, travel * 1.3, len, reach);
|
|
113
|
+
// the flash, brightest at the center, where the incoming image emerges
|
|
114
|
+
float core = r / (0.35 * reach);
|
|
115
|
+
float peak = (p - 0.5) * 9.0;
|
|
116
|
+
float glow = flash * exp(-peak * peak) * speed * (0.35 + 0.9 * exp(-core * core));
|
|
117
|
+
vec3 light = streakColor.rgb * streakColor.a * (2.2 * s * speed + glow);
|
|
118
|
+
// light is added to the image, but adds no opacity
|
|
119
|
+
return c.a > 0.0 ? vec4(clamp(c.rgb / c.a + light, 0.0, 1.0), c.a) : vec4(0.0);
|
|
120
|
+
}
|