floatEquals() public static method

public static floatEquals ( float a, float b ) : bool
a float
b float
return bool
Esempio n. 1
0
        private static float easeInOutElastic(float t, float b, float c, float d)
        {
            float s;
            float p;
            float a = c;

            if (MathUtils.floatEquals(t, 0))
            {
                return(b);
            }
            if (MathUtils.floatEquals(t /= d / 2, 2))
            {
                return(b + c);
            }

            p = d * (.3f * 1.5f);
            if (a < Math.Abs(c))
            {
                a = c;
                s = p / 4;
            }
            else
            {
                s = (float)(p / (2 * Math.PI) * Math.Asin(c / a));
            }

            if (t < 1)
            {
                return((float)(-.5f * (a * Math.Pow(2, 10 * (t -= 1)) * Math.Sin((t * d - s) * (2 * Math.PI) / p)) + b));
            }

            return((float)(a * Math.Pow(2, -10 * (t -= 1)) * Math.Sin((t * d - s) * (2 * Math.PI) / p) * .5f + c + b));
        }
Esempio n. 2
0
        private static float easeOutElastic(float t, float b, float c, float d)
        {
            float s;
            float p;
            float a = c;

            if (MathUtils.floatEquals(t, 0))
            {
                return(b);
            }
            if (MathUtils.floatEquals(t /= d, 1))
            {
                return(b + c);
            }

            p = d * .3f;
            if (a < Math.Abs(c))
            {
                a = c;
                s = p / 4;
            }
            else
            {
                s = (float)(p / (2 * Math.PI) * Math.Asin(c / a));
            }

            return((float)(a * Math.Pow(2, -10 * t) * Math.Sin((t * d - s) * (2 * Math.PI) / p) + c + b));
        }
Esempio n. 3
0
        private static float easeInOutExpo(float t, float b, float c, float d)
        {
            if (MathUtils.floatEquals(t, 0))
            {
                return(b);
            }
            if (MathUtils.floatEquals(t, d))
            {
                return(b + c);
            }
            if ((t /= d / 2) < 1)
            {
                return((float)(c / 2 * Math.Pow(2, 10 * (t - 1)) + b));
            }

            return((float)(c / 2 * (-Math.Pow(2, -10 * --t) + 2) + b));
        }
Esempio n. 4
0
 private static float easeOutExpo(float t, float b, float c, float d)
 {
     return(MathUtils.floatEquals(t, d) ? b + c : (float)(c * (-Math.Pow(2, -10 * t / d) + 1) + b));
 }
Esempio n. 5
0
 private static float easeInExpo(float t, float b, float c, float d)
 {
     return(MathUtils.floatEquals(t, 0) ? b : (float)(c * Math.Pow(2, 10 * (t / d - 1)) + b));
 }