From f14ff2edcbe9917d932e77545cb83e3113ef14db Mon Sep 17 00:00:00 2001 From: Akin Aguda Date: Sun, 19 Jul 2026 09:33:58 -0500 Subject: [PATCH 1/2] Made the smooth min constant consistent to prevent visual differences on different displays --- src/components/button/mod.rs | 2 +- src/components/button/shaders.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/button/mod.rs b/src/components/button/mod.rs index 346b3dc..24d0447 100644 --- a/src/components/button/mod.rs +++ b/src/components/button/mod.rs @@ -81,7 +81,7 @@ pub enum ButtonSizeVariants { Thin, #[tw( default, - class = "group/size-md py-4 px-6 xl:px-8 [&_>_.btn-icon]:size-6" + class = "group/size-md py-4 px-6 xl:px-8 [&_>_.btn-icon]:size-5" )] Md, #[tw(class = "group/size-lg py-6 px-10 text-lg 2xl:text-2xl [&_>_.btn-icon]:size-8")] diff --git a/src/components/button/shaders.rs b/src/components/button/shaders.rs index afec02c..f5a75ac 100644 --- a/src/components/button/shaders.rs +++ b/src/components/button/shaders.rs @@ -50,12 +50,12 @@ pub const FRAGMENT_SHADER: &str = r#" return desiredPosition - coord; } - // exponential + // quadratic polynomial float smin( float a, float b, float k ) { - k *= 1.0; - float r = exp2(-a/k) + exp2(-b/k); - return -k*log2(r); + k *= 4.0; + float h = max( k-abs(a-b), 0.0 )/k; + return min(a,b) - h*h*k*(1.0/4.0); } void main() { @@ -98,13 +98,13 @@ pub const FRAGMENT_SHADER: &str = r#" ); // Multiplying by some scaling constant to make it slightly smaller and look nicer (preference) - float circleRadius = ((extension - 5.0) * 0.5) * 0.6; + float circleRadius = ((extension - 5.0) * 0.5) * 0.7; - float circle = circleSdf(circlePosition, mix(circleRadius * 0.5, circleRadius, u_progression)); + float circle = circleSdf(circlePosition, circleRadius); // Draw Circle - float pillAndCircle = smin(pill, circle, 10.0); + float pillAndCircle = smin(pill, circle, extension * 0.05); // Leaving these comments here because they are useful for debugging // color += paintSdf(buttonColor, pill); From aa6af1ca678b935409fc1d30d8b6483c2452ac53 Mon Sep 17 00:00:00 2001 From: Akin Aguda Date: Sun, 19 Jul 2026 09:34:46 -0500 Subject: [PATCH 2/2] added reference for smin function for any future updates --- src/components/button/shaders.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/button/shaders.rs b/src/components/button/shaders.rs index f5a75ac..4bc5221 100644 --- a/src/components/button/shaders.rs +++ b/src/components/button/shaders.rs @@ -50,6 +50,7 @@ pub const FRAGMENT_SHADER: &str = r#" return desiredPosition - coord; } + // This was gotten from here: https://iquilezles.org/articles/smin // quadratic polynomial float smin( float a, float b, float k ) {