diff --git a/utilities/flong.glsl b/utilities/flong.glsl index c161bc2..fdb89b1 100644 --- a/utilities/flong.glsl +++ b/utilities/flong.glsl @@ -265,3 +265,53 @@ float cubic_bezier_through(float x, vec2 a, vec2 b) { return clamp(y, 0., 1.); } // cubic bezier through points end + +// Circular shaping + +float circ_ease_in (float x){ + return 1. - sqrt(1. - x*x); +} + +float circ_ease_out (float x){ + return sqrt(1. - pow(1. - x, 2.)); +} + +float double_circ_seat(float x, float a) { + a = clamp(a, 0., 1.); + + if (x<=a){ + return sqrt(pow(a, 2.) - pow(x-a, 2.)); + } + return 1. - sqrt(pow(1.-a, 2.) - pow(x-a, 2.)); +} + +float double_circ_sigmoid(float x, float a) { + a = clamp(a, 0., 1.); + + if (x<=a){ + return a - sqrt(pow(a, 2.) - pow(x, 2.)); + } + return a + sqrt(pow(1.-a, 2.) - pow(x-1., 2.)); +} + +float double_ellip_seat(float x, vec2 ab) { + float e = 0.00001; + float a = clamp(ab.x, 0.+e, 1.+e); + float b = clamp(ab.y, 0., 1.); + + if (x<=a){ + return (b/a) * sqrt(pow(a, 2.) - pow(x-a, 2.)); + } + return 1.-((1.-b)/(1.-a))*sqrt(pow(1.-a, 2.)-pow(x-a,2.)); +} + +float double_ellip_sigmoid(float x, vec2 ab) { + float e = 0.00001; + float a = clamp(ab.x, 0.+e, 1.+e); + float b = clamp(ab.y, 0., 1.); + + if (x<=a){ + return b * (1. - (sqrt(pow(a, 2.) - pow(x, 2.))/a)); + } + return b+((1.-b)/(1.-a))*sqrt(pow(1.-a,2.)-pow(x-1.,2.)); +}