diff options
| author | Ray <[email protected]> | 2019-05-25 01:33:03 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2019-05-25 01:33:03 +0200 |
| commit | 241c4c8d14225bdf30c168802d4b16b59d5043e0 (patch) | |
| tree | 1eb6705f78563a73c77376b2ac5936e8accae9d7 /src | |
| parent | 163a6581aa1fddd37735126d27a4478eeb3281d6 (diff) | |
| download | raylib-241c4c8d14225bdf30c168802d4b16b59d5043e0.tar.gz raylib-241c4c8d14225bdf30c168802d4b16b59d5043e0.zip | |
Review easings PR
Diffstat (limited to 'src')
| -rw-r--r-- | src/easings.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/easings.h b/src/easings.h index c7ee5649..1b08af0a 100644 --- a/src/easings.h +++ b/src/easings.h @@ -90,7 +90,7 @@ #define EASEDEF extern #endif -#include <tgmath.h> // Required for: sin(), cos(), sqrt(), pow() +#include <math.h> // Required for: sinf(), cosf(), sqrt(), pow() #ifndef PI #define PI 3.14159265358979323846f //Required as PI is not always defined in math.h @@ -107,9 +107,9 @@ EASEDEF float EaseLinearOut(float t, float b, float c, float d) { return (c*t/d EASEDEF float EaseLinearInOut(float t,float b, float c, float d) { return (c*t/d + b); } // Sine Easing functions -EASEDEF float EaseSineIn(float t, float b, float c, float d) { return (-c*cos(t/d*(PI/2.0f)) + c + b); } -EASEDEF float EaseSineOut(float t, float b, float c, float d) { return (c*sin(t/d*(PI/2.0f)) + b); } -EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2.0f*(cos(PI*t/d) - 1.0f) + b); } +EASEDEF float EaseSineIn(float t, float b, float c, float d) { return (-c*cosf(t/d*(PI/2.0f)) + c + b); } +EASEDEF float EaseSineOut(float t, float b, float c, float d) { return (c*sinf(t/d*(PI/2.0f)) + b); } +EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2.0f*(cosf(PI*t/d) - 1.0f) + b); } // Circular Easing functions EASEDEF float EaseCircIn(float t, float b, float c, float d) { t /= d; return (-c*(sqrt(1.0f - t*t) - 1.0f) + b); } @@ -221,7 +221,7 @@ EASEDEF float EaseElasticIn(float t, float b, float c, float d) float s = p/4.0f; float postFix = a*pow(2.0f, 10.0f*(t-=1.0f)); - return (-(postFix*sin((t*d-s)*(2.0f*PI)/p )) + b); + return (-(postFix*sinf((t*d-s)*(2.0f*PI)/p )) + b); } EASEDEF float EaseElasticOut(float t, float b, float c, float d) @@ -233,7 +233,7 @@ EASEDEF float EaseElasticOut(float t, float b, float c, float d) float a = c; float s = p/4.0f; - return (a*pow(2.0f,-10.0f*t)*sin((t*d-s)*(2.0f*PI)/p) + c + b); + return (a*pow(2.0f,-10.0f*t)*sinf((t*d-s)*(2.0f*PI)/p) + c + b); } EASEDEF float EaseElasticInOut(float t, float b, float c, float d) @@ -248,12 +248,12 @@ EASEDEF float EaseElasticInOut(float t, float b, float c, float d) if (t < 1.0f) { float postFix = a*pow(2.0f, 10.0f*(t-=1.0f)); - return -0.5f*(postFix*sin((t*d-s)*(2.0f*PI)/p)) + b; + return -0.5f*(postFix*sinf((t*d-s)*(2.0f*PI)/p)) + b; } float postFix = a*pow(2.0f, -10.0f*(t-=1.0f)); - return (postFix*sin((t*d-s)*(2.0f*PI)/p)*0.5f + c + b); + return (postFix*sinf((t*d-s)*(2.0f*PI)/p)*0.5f + c + b); } #ifdef __cplusplus |
