From ec7099494b0609dfefa22448089bb7a6f9cd1cb1 Mon Sep 17 00:00:00 2001 From: andrew pliatsikas <109871885+okcomput3@users.noreply.github.com> Date: Wed, 17 Dec 2025 17:40:55 +0000 Subject: [PATCH 1/8] magic scroll effect --- src/extra-animations/carpet.hpp | 163 ++++++++++++++++++++++++++++++-- 1 file changed, 156 insertions(+), 7 deletions(-) diff --git a/src/extra-animations/carpet.hpp b/src/extra-animations/carpet.hpp index 9f5f790..1e9d9ab 100644 --- a/src/extra-animations/carpet.hpp +++ b/src/extra-animations/carpet.hpp @@ -60,7 +60,8 @@ uniform int direction; #define M_PI 3.1415926535897932384626433832795 -void main() +// Original single roll effect +vec4 single_roll(vec2 uvpos_var, float progress, int direction) { vec4 wfrag; vec2 uv; @@ -124,13 +125,13 @@ void main() if (direction == 1) { pfrag = get_pixel(vec2(1.0 - uv.x, uv.y)); - } else if (direction == 2) + } else if (direction == 2) { pfrag = get_pixel(vec2(uv.x, 1.0 - uv.y)); - } else + } else { pfrag = get_pixel(uv); - } + } } // store color for fragment mixing with current fragment if translucent wfrag = mix(pfrag, wfrag, wfrag.a); @@ -166,13 +167,13 @@ void main() if (direction == 1) { pfrag = get_pixel(vec2(1.0 - uv.x, uv.y)); - } else if (direction == 2) + } else if (direction == 2) { pfrag = get_pixel(vec2(uv.x, 1.0 - uv.y)); - } else + } else { pfrag = get_pixel(uv); - } + } } // compute lighting pfrag = vec4(clamp(pfrag.rgb + (angle / -M_PI), 0.0, 1.0), pfrag.a); @@ -180,8 +181,156 @@ void main() wfrag = mix(wfrag, pfrag, pfrag.a); } + return wfrag; +} + +// Dual scroll effect (both sides rolling toward/from middle) by Phodius +vec4 dual_scroll(vec2 uvpos_var, float progress, int dir) +{ + vec4 wfrag = vec4(0.0); + vec2 uv; + + float coord; + float other_coord; + + // dir 5 = vertical, dir 4 = horizontal + if (dir == 5) + { + coord = uvpos_var.y; + other_coord = uvpos_var.x; + } + else + { + coord = uvpos_var.x; + other_coord = uvpos_var.y; + } + + // Determine which half we're on + bool second_half = (coord > 0.5); + + // Map to local coordinate: 0 at middle, 1 at edge + float local_coord; + if (second_half) + { + local_coord = (coord - 0.5) * 2.0; + } + else + { + local_coord = (0.5 - coord) * 2.0; + } + + float offset = 0.1; + float p = progress * 1.2 - 0.2; + + // Get pixel from default position if before peel line + if (local_coord < p + offset + 0.05) + { + if (uvpos_var.x >= 0.0 && uvpos_var.x <= 1.0 && + uvpos_var.y >= 0.0 && uvpos_var.y <= 1.0) + { + wfrag = get_pixel(uvpos_var); + } + } + + // Back of roll + if (local_coord > p + offset + 0.05 && local_coord < p + offset + 0.1) + { + float tsin = (local_coord - (p + offset + 0.05)) * 20.0; + float angle = asin(tsin); + + float local_sample = (angle / M_PI) * 0.15 + p + offset + 0.05; + + float global_sample; + if (second_half) + { + global_sample = 0.5 + local_sample * 0.5; + } + else + { + global_sample = 0.5 - local_sample * 0.5; + } + + float perp_sample = (other_coord - 0.5) * pow(cos(angle), 0.02) + 0.5; + + if (dir == 5) + { + uv.y = global_sample; + uv.x = perp_sample; + } + else + { + uv.x = global_sample; + uv.y = perp_sample; + } + + vec4 pfrag = vec4(0.0); + if (uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0) + { + pfrag = get_pixel(uv); + } + wfrag = mix(pfrag, wfrag, wfrag.a); + } + + // Front of roll + if (local_coord > p + offset && local_coord < p + offset + 0.1) + { + float tsin = (local_coord - (p + offset + 0.1)) * 20.0 + 1.0; + float angle = asin(tsin); + + float local_sample = (angle / (-M_PI)) * 0.1 + p + offset + 0.2; + + float global_sample; + if (second_half) + { + global_sample = 0.5 + local_sample * 0.5; + } + else + { + global_sample = 0.5 - local_sample * 0.5; + } + + float perp_sample = (other_coord - 0.5) * 0.9 * pow(cos(angle), -0.04) + 0.5; + + if (dir == 5) + { + uv.y = global_sample; + uv.x = perp_sample; + } + else + { + uv.x = global_sample; + uv.y = perp_sample; + } + + vec4 pfrag = vec4(0.0); + if (uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0) + { + pfrag = get_pixel(uv); + } + pfrag = vec4(clamp(pfrag.rgb + (angle / -M_PI), 0.0, 1.0), pfrag.a); + wfrag = mix(wfrag, pfrag, pfrag.a); + } + + return wfrag; +} + +void main() +{ + vec4 wfrag; + + if (direction <= 3) + { + wfrag = single_roll(uvpos_var, progress, direction); + } + else + { + wfrag = dual_scroll(uvpos_var, progress, direction); + } + gl_FragColor = wfrag; } + + )"; namespace wf From ef390682c9bbdc94af71057ca7b73e9919bc63ed Mon Sep 17 00:00:00 2001 From: andrew pliatsikas <109871885+okcomput3@users.noreply.github.com> Date: Wed, 17 Dec 2025 17:44:20 +0000 Subject: [PATCH 2/8] magic scroll xml update --- metadata/extra-animations.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/metadata/extra-animations.xml b/metadata/extra-animations.xml index 5f435fd..06a8682 100644 --- a/metadata/extra-animations.xml +++ b/metadata/extra-animations.xml @@ -153,6 +153,14 @@ 3 <_name>Bottom + + 4 + <_name>Scroll X + + + 5 + <_name>Scroll Y + From 1dcecd6e7c6ed8be949c6981255cdbcf4794b062 Mon Sep 17 00:00:00 2001 From: andrew pliatsikas <109871885+okcomput3@users.noreply.github.com> Date: Wed, 17 Dec 2025 21:22:23 +0000 Subject: [PATCH 3/8] option names updated --- metadata/extra-animations.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata/extra-animations.xml b/metadata/extra-animations.xml index 06a8682..f96b595 100644 --- a/metadata/extra-animations.xml +++ b/metadata/extra-animations.xml @@ -155,11 +155,11 @@ 4 - <_name>Scroll X + <_name>Horizontal Scroll 5 - <_name>Scroll Y + <_name>Vertical Scroll From 0e0b430fadd29e24c5f9eeffaf1c67af2353ad5a Mon Sep 17 00:00:00 2001 From: andrew pliatsikas <109871885+okcomput3@users.noreply.github.com> Date: Wed, 17 Dec 2025 22:08:41 +0000 Subject: [PATCH 4/8] Update carpet.hpp --- src/extra-animations/carpet.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/extra-animations/carpet.hpp b/src/extra-animations/carpet.hpp index 1e9d9ab..4ea26b9 100644 --- a/src/extra-animations/carpet.hpp +++ b/src/extra-animations/carpet.hpp @@ -125,13 +125,13 @@ vec4 single_roll(vec2 uvpos_var, float progress, int direction) if (direction == 1) { pfrag = get_pixel(vec2(1.0 - uv.x, uv.y)); - } else if (direction == 2) + } else if (direction == 2) { pfrag = get_pixel(vec2(uv.x, 1.0 - uv.y)); - } else + } else { pfrag = get_pixel(uv); - } + } } // store color for fragment mixing with current fragment if translucent wfrag = mix(pfrag, wfrag, wfrag.a); @@ -167,13 +167,13 @@ vec4 single_roll(vec2 uvpos_var, float progress, int direction) if (direction == 1) { pfrag = get_pixel(vec2(1.0 - uv.x, uv.y)); - } else if (direction == 2) + } else if (direction == 2) { pfrag = get_pixel(vec2(uv.x, 1.0 - uv.y)); - } else + } else { pfrag = get_pixel(uv); - } + } } // compute lighting pfrag = vec4(clamp(pfrag.rgb + (angle / -M_PI), 0.0, 1.0), pfrag.a); From ad9d7255a2ecd5979453c71940a450215d0b120a Mon Sep 17 00:00:00 2001 From: andrew pliatsikas <109871885+okcomput3@users.noreply.github.com> Date: Wed, 17 Dec 2025 22:38:42 +0000 Subject: [PATCH 5/8] updated long description xml --- metadata/extra-animations.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata/extra-animations.xml b/metadata/extra-animations.xml index f96b595..6872d23 100644 --- a/metadata/extra-animations.xml +++ b/metadata/extra-animations.xml @@ -135,7 +135,7 @@