gl-transitions 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/compatibility.json +386 -0
- package/gl-transitions.js +1 -1
- package/gl-transitions.json +1 -1
- package/glsl3/ApertureWipe.glsl +45 -0
- package/glsl3/Comb.glsl +26 -0
- package/glsl3/Curtains.glsl +47 -0
- package/glsl3/CylinderRoll.glsl +102 -0
- package/glsl3/DiamondWipe.glsl +21 -0
- package/glsl3/DitherDissolve.glsl +27 -0
- package/glsl3/FallOver.glsl +36 -0
- package/glsl3/Fisheye.glsl +23 -0
- package/glsl3/Halftone.glsl +49 -0
- package/glsl3/Honeycomb.glsl +55 -0
- package/glsl3/LightStreaks.glsl +117 -0
- package/glsl3/PaperTear.glsl +76 -0
- package/glsl3/PixelStretch.glsl +73 -0
- package/glsl3/Prisms.glsl +81 -0
- package/glsl3/Puzzle.glsl +124 -0
- package/glsl3/Refraction.glsl +95 -0
- package/glsl3/Shred.glsl +67 -0
- package/glsl3/SpiralWipe.glsl +41 -0
- package/glsl3/Tunnel.glsl +42 -0
- package/glsl3/TvRoll.glsl +43 -0
- package/glsl3/TvTurnOff.glsl +47 -0
- package/glsl3/WhipPan.glsl +50 -0
- package/glsl3/WhipSpin.glsl +69 -0
- package/glsl3/WhipTilt.glsl +79 -0
- package/index.js +1 -1
- package/layouts.json +764 -0
- package/llms-full.txt +620 -256
- package/llms.txt +160 -136
- package/msl/ApertureWipe.metal +193 -0
- package/msl/Comb.metal +167 -0
- package/msl/Curtains.metal +207 -0
- package/msl/CylinderRoll.metal +374 -0
- package/msl/DiamondWipe.metal +123 -0
- package/msl/DitherDissolve.metal +157 -0
- package/msl/FallOver.metal +192 -0
- package/msl/Fisheye.metal +121 -0
- package/msl/Halftone.metal +230 -0
- package/msl/Honeycomb.metal +263 -0
- package/msl/LightStreaks.metal +518 -0
- package/msl/PaperTear.metal +373 -0
- package/msl/PixelStretch.metal +337 -0
- package/msl/Prisms.metal +424 -0
- package/msl/Puzzle.metal +632 -0
- package/msl/Refraction.metal +333 -0
- package/msl/Shred.metal +294 -0
- package/msl/SpiralWipe.metal +196 -0
- package/msl/Tunnel.metal +207 -0
- package/msl/TvRoll.metal +205 -0
- package/msl/TvTurnOff.metal +238 -0
- package/msl/WhipPan.metal +218 -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 +69 -39
- package/sksl/ApertureWipe.sksl +56 -0
- package/sksl/Comb.sksl +39 -0
- package/sksl/Curtains.sksl +60 -0
- package/sksl/CylinderRoll.sksl +112 -0
- package/sksl/DiamondWipe.sksl +34 -0
- package/sksl/DitherDissolve.sksl +39 -0
- package/sksl/FallOver.sksl +49 -0
- package/sksl/Fisheye.sksl +36 -0
- package/sksl/Halftone.sksl +61 -0
- package/sksl/Honeycomb.sksl +64 -0
- package/sksl/LightStreaks.sksl +126 -0
- package/sksl/PaperTear.sksl +82 -0
- package/sksl/PixelStretch.sksl +84 -0
- package/sksl/Prisms.sksl +94 -0
- package/sksl/Puzzle.sksl +134 -0
- package/sksl/Refraction.sksl +103 -0
- package/sksl/Shred.sksl +79 -0
- package/sksl/SpiralWipe.sksl +51 -0
- package/sksl/Tunnel.sksl +55 -0
- package/sksl/TvRoll.sksl +55 -0
- package/sksl/TvTurnOff.sksl +59 -0
- package/sksl/WhipPan.sksl +62 -0
- package/sksl/WhipSpin.sksl +79 -0
- package/sksl/WhipTilt.sksl +90 -0
- package/sksl/index.js +1 -1
- package/transitions/ApertureWipe.glsl +44 -0
- package/transitions/Comb.glsl +25 -0
- package/transitions/Curtains.glsl +46 -0
- package/transitions/CylinderRoll.glsl +101 -0
- package/transitions/DiamondWipe.glsl +20 -0
- package/transitions/DitherDissolve.glsl +26 -0
- package/transitions/FallOver.glsl +35 -0
- package/transitions/Fisheye.glsl +22 -0
- package/transitions/Halftone.glsl +48 -0
- package/transitions/Honeycomb.glsl +54 -0
- package/transitions/LightStreaks.glsl +116 -0
- package/transitions/PaperTear.glsl +75 -0
- package/transitions/PixelStretch.glsl +72 -0
- package/transitions/Prisms.glsl +80 -0
- package/transitions/Puzzle.glsl +123 -0
- package/transitions/Refraction.glsl +94 -0
- package/transitions/Shred.glsl +66 -0
- package/transitions/SpiralWipe.glsl +40 -0
- package/transitions/Tunnel.glsl +41 -0
- package/transitions/TvRoll.glsl +42 -0
- package/transitions/TvTurnOff.glsl +46 -0
- package/transitions/WhipPan.glsl +49 -0
- package/transitions/WhipSpin.glsl +68 -0
- package/transitions/WhipTilt.glsl +78 -0
- package/wgsl/ApertureWipe.wgsl +160 -0
- package/wgsl/Comb.wgsl +139 -0
- package/wgsl/Curtains.wgsl +179 -0
- package/wgsl/CylinderRoll.wgsl +330 -0
- package/wgsl/DiamondWipe.wgsl +94 -0
- package/wgsl/DitherDissolve.wgsl +123 -0
- package/wgsl/FallOver.wgsl +164 -0
- package/wgsl/Fisheye.wgsl +93 -0
- package/wgsl/Halftone.wgsl +196 -0
- package/wgsl/Honeycomb.wgsl +222 -0
- package/wgsl/LightStreaks.wgsl +460 -0
- package/wgsl/PaperTear.wgsl +324 -0
- package/wgsl/PixelStretch.wgsl +298 -0
- package/wgsl/Prisms.wgsl +385 -0
- package/wgsl/Puzzle.wgsl +587 -0
- package/wgsl/Refraction.wgsl +294 -0
- package/wgsl/Shred.wgsl +259 -0
- package/wgsl/SpiralWipe.wgsl +165 -0
- package/wgsl/Tunnel.wgsl +177 -0
- package/wgsl/TvRoll.wgsl +165 -0
- package/wgsl/TvTurnOff.wgsl +196 -0
- package/wgsl/WhipPan.wgsl +177 -0
- package/wgsl/WhipSpin.wgsl +241 -0
- package/wgsl/WhipTilt.wgsl +291 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// WhipSpin — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/WhipSpin.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// Description: The camera rolls faster and faster around the center of the frame, streaking the outgoing image in a spin blur, then the incoming one takes over mid-spin and slows to a stop
|
|
5
|
+
// Tags: rotate, motion-blur, spin
|
|
6
|
+
|
|
7
|
+
// @range(-3, 3) Total rotation, in turns, split between the two images (negative turns clockwise)
|
|
8
|
+
uniform float turns; // = 1.0
|
|
9
|
+
// @range(0, 1) Length of the motion blur along the spin
|
|
10
|
+
uniform float blur; // = 0.5
|
|
11
|
+
// @range(0, 1) How much the color channels split apart as the spin speeds up
|
|
12
|
+
uniform float chroma; // = 0.6
|
|
13
|
+
// @range(0, 1) How much the camera zooms in at the fastest point
|
|
14
|
+
uniform float zoom; // = 0.25
|
|
15
|
+
|
|
16
|
+
const float PI = 3.141592653589793;
|
|
17
|
+
const int SAMPLES = 24;
|
|
18
|
+
|
|
19
|
+
float hash(vec2 p) {
|
|
20
|
+
vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
|
|
21
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
22
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// fold the coordinates back into the image so that the rotated frame stays filled
|
|
26
|
+
vec2 mirror(vec2 v) {
|
|
27
|
+
vec2 m = mod(v, 2.0);
|
|
28
|
+
return mix(m, 2.0 - m, step(1.0, m));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// the camera's roll angle at time t: the outgoing image speeds up until the middle,
|
|
32
|
+
// then the incoming one, already turning, slows down to rest
|
|
33
|
+
float rollAngle(float t) {
|
|
34
|
+
float halfTurn = PI * turns;
|
|
35
|
+
if (t < 0.5) {
|
|
36
|
+
float x = 2.0 * t;
|
|
37
|
+
return halfTurn * x * x * x;
|
|
38
|
+
}
|
|
39
|
+
float x = 2.0 - 2.0 * t;
|
|
40
|
+
return -halfTurn * x * x * x;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
vec4 transition(vec2 uv) {
|
|
44
|
+
float p = progress;
|
|
45
|
+
float h = 1.0 - abs(2.0 * p - 1.0); // 0 at both ends, 1 at the cut
|
|
46
|
+
// the shutter is open longer as the spin speeds up, and closed at both ends
|
|
47
|
+
float shutter = blur * 0.1 * h;
|
|
48
|
+
float scale = 1.0 + zoom * h * h * h;
|
|
49
|
+
vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
|
|
50
|
+
float jitter = hash(uv * vec2(ratio, 1.0) * 731.0);
|
|
51
|
+
vec3 color = vec3(0.0);
|
|
52
|
+
vec3 weight = vec3(0.0);
|
|
53
|
+
float alpha = 0.0;
|
|
54
|
+
for (int i = 0; i < SAMPLES; i++) {
|
|
55
|
+
float s = (float(i) + jitter) / float(SAMPLES) - 0.5;
|
|
56
|
+
float t = clamp(p + s * shutter, 0.0, 1.0);
|
|
57
|
+
float a = rollAngle(t);
|
|
58
|
+
float c = cos(a), sn = sin(a);
|
|
59
|
+
vec2 r = vec2(c * q.x + sn * q.y, -sn * q.x + c * q.y) / scale;
|
|
60
|
+
vec2 suv = mirror(r / vec2(ratio, 1.0) + 0.5);
|
|
61
|
+
vec4 col = t < 0.5 ? getFromColor(suv) : getToColor(suv);
|
|
62
|
+
// red trails behind and blue leads along the arc: the channels split with the speed
|
|
63
|
+
vec3 w = max(vec3(1.0 - 4.0 * chroma * s, 1.0, 1.0 + 4.0 * chroma * s), 0.0);
|
|
64
|
+
color += col.rgb * col.a * w;
|
|
65
|
+
weight += col.a * w;
|
|
66
|
+
alpha += col.a;
|
|
67
|
+
}
|
|
68
|
+
return vec4(color / max(weight, vec3(1e-5)), alpha / float(SAMPLES));
|
|
69
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// WhipTilt — GLSL ES 3.00, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/WhipTilt.glsl
|
|
2
|
+
// Author: gre
|
|
3
|
+
// License: MIT
|
|
4
|
+
// 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
|
|
5
|
+
// Tags: 3d, rotate, motion-blur, vertical
|
|
6
|
+
|
|
7
|
+
// @param Tilt the camera down to an incoming image below instead of above
|
|
8
|
+
uniform bool down; // = false
|
|
9
|
+
// @range(0, 1) Length of the motion blur along the tilt
|
|
10
|
+
uniform float blur; // = 0.5
|
|
11
|
+
// @range(0, 1) How much the color channels split apart as the tilt speeds up
|
|
12
|
+
uniform float chroma; // = 0.5
|
|
13
|
+
// @range(0, 1) Strength of the perspective (field of view of the camera)
|
|
14
|
+
uniform float perspective; // = 0.7
|
|
15
|
+
|
|
16
|
+
const float PI = 3.141592653589793;
|
|
17
|
+
const int SAMPLES = 24;
|
|
18
|
+
|
|
19
|
+
float hash(vec2 p) {
|
|
20
|
+
vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
|
|
21
|
+
p3 += dot(p3, p3.yzx + 33.33);
|
|
22
|
+
return fract((p3.x + p3.y) * p3.z);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// fold the coordinates back into the image, only a safety at the far edges
|
|
26
|
+
vec2 mirror(vec2 v) {
|
|
27
|
+
vec2 m = mod(v, 2.0);
|
|
28
|
+
return mix(m, 2.0 - m, step(1.0, m));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// how far the camera has tilted at time t, from 0 to 1: slow start, whip in the middle, slow landing
|
|
32
|
+
float tilt(float t) {
|
|
33
|
+
float h = 1.0 - abs(2.0 * t - 1.0);
|
|
34
|
+
float e = 0.5 * h * h * h * h;
|
|
35
|
+
return t < 0.5 ? e : 1.0 - e;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
vec4 transition(vec2 uv) {
|
|
39
|
+
float p = progress;
|
|
40
|
+
float h = 1.0 - abs(2.0 * p - 1.0); // 0 at both ends, 1 in the middle
|
|
41
|
+
// the shutter is open longer as the tilt speeds up, and closed at both ends
|
|
42
|
+
float shutter = blur * 0.25 * h * h;
|
|
43
|
+
// the images are two faces of a drum around the camera, each filling the frame from the
|
|
44
|
+
// middle: they meet edge to edge at the angle of the field of view, which the camera turns by
|
|
45
|
+
float halfFov = mix(15.0, 45.0, perspective) * PI / 180.0;
|
|
46
|
+
float dist = 0.5 / tan(halfFov);
|
|
47
|
+
vec2 q = (uv - 0.5) * vec2(ratio, 1.0);
|
|
48
|
+
if (down) q.y = -q.y;
|
|
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 = 2.0 * halfFov * tilt(t);
|
|
57
|
+
// zoom in just enough that the faces always cover the frame, wherever their edge is
|
|
58
|
+
vec2 r = q * cos(halfFov) / cos(halfFov - a);
|
|
59
|
+
// the ray in the frame of the outgoing face, then of the incoming one
|
|
60
|
+
float c0 = cos(a), s0 = sin(a);
|
|
61
|
+
vec2 d0 = vec2(r.y * c0 + dist * s0, dist * c0 - r.y * s0);
|
|
62
|
+
float b = a - 2.0 * halfFov;
|
|
63
|
+
float c1 = cos(b), s1 = sin(b);
|
|
64
|
+
vec2 d1 = vec2(r.y * c1 + dist * s1, dist * c1 - r.y * s1);
|
|
65
|
+
// the ray leaves the drum through the nearest face
|
|
66
|
+
bool incoming = d1.y > d0.y;
|
|
67
|
+
vec2 d = incoming ? d1 : d0;
|
|
68
|
+
vec2 hit = dist / d.y * vec2(r.x, d.x);
|
|
69
|
+
if (down) hit.y = -hit.y;
|
|
70
|
+
vec2 suv = mirror(hit / vec2(ratio, 1.0) + 0.5);
|
|
71
|
+
vec4 col = incoming ? getToColor(suv) : getFromColor(suv);
|
|
72
|
+
// red trails behind and blue leads along the motion: the channels split with the speed
|
|
73
|
+
vec3 w = max(vec3(1.0 - 4.0 * chroma * s, 1.0, 1.0 + 4.0 * chroma * s), 0.0);
|
|
74
|
+
color += col.rgb * col.a * w;
|
|
75
|
+
weight += col.a * w;
|
|
76
|
+
alpha += col.a;
|
|
77
|
+
}
|
|
78
|
+
return vec4(color / max(weight, vec3(1e-5)), alpha / float(SAMPLES));
|
|
79
|
+
}
|