mirror of
https://github.com/Show-maket/Tween.git
synced 2025-05-03 14:50:24 +00:00
static fix
This commit is contained in:
parent
2de931e9a6
commit
bca2439c15
64
Easing.h
64
Easing.h
@ -2,57 +2,57 @@
|
||||
namespace EasingFunc {
|
||||
typedef float(*eFunc)(float);
|
||||
|
||||
float easeLinear(float t) {
|
||||
static float easeLinear(float t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
float easeInSine(float t) {
|
||||
static float easeInSine(float t) {
|
||||
return sin(1.5707963 * t);
|
||||
}
|
||||
|
||||
float easeOutSine(float t) {
|
||||
static float easeOutSine(float t) {
|
||||
return 1 + sin(1.5707963 * (--t));
|
||||
}
|
||||
|
||||
float easeInOutSine(float t) {
|
||||
static float easeInOutSine(float t) {
|
||||
return 0.5 * (1 + sin(3.1415926 * (t - 0.5)));
|
||||
}
|
||||
|
||||
float easeInQuad(float t) {
|
||||
static float easeInQuad(float t) {
|
||||
return t * t;
|
||||
}
|
||||
|
||||
float easeOutQuad(float t) {
|
||||
static float easeOutQuad(float t) {
|
||||
return t * (2 - t);
|
||||
}
|
||||
|
||||
float easeInOutQuad(float t) {
|
||||
static float easeInOutQuad(float t) {
|
||||
return t < 0.5 ? 2 * t * t : t * (4 - 2 * t) - 1;
|
||||
}
|
||||
|
||||
float easeInCubic(float t) {
|
||||
static float easeInCubic(float t) {
|
||||
return t * t * t;
|
||||
}
|
||||
|
||||
float easeOutCubic(float t) {
|
||||
static float easeOutCubic(float t) {
|
||||
return 1 + (--t) * t * t;
|
||||
}
|
||||
|
||||
float easeInOutCubic(float t) {
|
||||
static float easeInOutCubic(float t) {
|
||||
return t < 0.5 ? 4 * t * t * t : 1 + (--t) * (2 * (--t)) * (2 * t);
|
||||
}
|
||||
|
||||
float easeInQuart(float t) {
|
||||
static float easeInQuart(float t) {
|
||||
t *= t;
|
||||
return t * t;
|
||||
}
|
||||
|
||||
float easeOutQuart(float t) {
|
||||
static float easeOutQuart(float t) {
|
||||
t = (--t) * t;
|
||||
return 1 - t * t;
|
||||
}
|
||||
|
||||
float easeInOutQuart(float t) {
|
||||
static float easeInOutQuart(float t) {
|
||||
if (t < 0.5) {
|
||||
t *= t;
|
||||
return 8 * t * t;
|
||||
@ -62,17 +62,17 @@ namespace EasingFunc {
|
||||
}
|
||||
}
|
||||
|
||||
float easeInQuint(float t) {
|
||||
static float easeInQuint(float t) {
|
||||
float t2 = t * t;
|
||||
return t * t2 * t2;
|
||||
}
|
||||
|
||||
float easeOutQuint(float t) {
|
||||
static float easeOutQuint(float t) {
|
||||
float t2 = (--t) * t;
|
||||
return 1 + t * t2 * t2;
|
||||
}
|
||||
|
||||
float easeInOutQuint(float t) {
|
||||
static float easeInOutQuint(float t) {
|
||||
float t2;
|
||||
if (t < 0.5) {
|
||||
t2 = t * t;
|
||||
@ -83,15 +83,15 @@ namespace EasingFunc {
|
||||
}
|
||||
}
|
||||
|
||||
float easeInExpo(float t) {
|
||||
static float easeInExpo(float t) {
|
||||
return (pow(2, 8 * t) - 1) / 255;
|
||||
}
|
||||
|
||||
float easeOutExpo(float t) {
|
||||
static float easeOutExpo(float t) {
|
||||
return 1 - pow(2, -8 * t);
|
||||
}
|
||||
|
||||
float easeInOutExpo(float t) {
|
||||
static float easeInOutExpo(float t) {
|
||||
if (t < 0.5) {
|
||||
return (pow(2, 16 * t) - 1) / 510;
|
||||
} else {
|
||||
@ -99,15 +99,15 @@ namespace EasingFunc {
|
||||
}
|
||||
}
|
||||
|
||||
float easeInCirc(float t) {
|
||||
static float easeInCirc(float t) {
|
||||
return 1 - sqrt(1 - t);
|
||||
}
|
||||
|
||||
float easeOutCirc(float t) {
|
||||
static float easeOutCirc(float t) {
|
||||
return sqrt(t);
|
||||
}
|
||||
|
||||
float easeInOutCirc(float t) {
|
||||
static float easeInOutCirc(float t) {
|
||||
if (t < 0.5) {
|
||||
return (1 - sqrt(1 - 2 * t)) * 0.5;
|
||||
} else {
|
||||
@ -115,15 +115,15 @@ namespace EasingFunc {
|
||||
}
|
||||
}
|
||||
|
||||
float easeInBack(float t) {
|
||||
static float easeInBack(float t) {
|
||||
return t * t * (2.70158 * t - 1.70158);
|
||||
}
|
||||
|
||||
float easeOutBack(float t) {
|
||||
static float easeOutBack(float t) {
|
||||
return 1 + (--t) * t * (2.70158 * t + 1.70158);
|
||||
}
|
||||
|
||||
float easeInOutBack(float t) {
|
||||
static float easeInOutBack(float t) {
|
||||
if (t < 0.5) {
|
||||
return t * t * (7 * t - 2.5) * 2;
|
||||
} else {
|
||||
@ -131,17 +131,17 @@ namespace EasingFunc {
|
||||
}
|
||||
}
|
||||
|
||||
float easeInElastic(float t) {
|
||||
static float easeInElastic(float t) {
|
||||
float t2 = t * t;
|
||||
return t2 * t2 * sin(t * PI * 4.5);
|
||||
}
|
||||
|
||||
float easeOutElastic(float t) {
|
||||
static float easeOutElastic(float t) {
|
||||
float t2 = (t - 1) * (t - 1);
|
||||
return 1 - t2 * t2 * cos(t * PI * 4.5);
|
||||
}
|
||||
|
||||
float easeInOutElastic(float t) {
|
||||
static float easeInOutElastic(float t) {
|
||||
float t2;
|
||||
if (t < 0.45) {
|
||||
t2 = t * t;
|
||||
@ -154,19 +154,19 @@ namespace EasingFunc {
|
||||
}
|
||||
}
|
||||
|
||||
float easeInBounce(float t) {
|
||||
static float easeInBounce(float t) {
|
||||
return pow(2, 6 * (t - 1)) * abs(sin(t * PI * 3.5));
|
||||
}
|
||||
|
||||
float easeOutBounce(float t) {
|
||||
static float easeOutBounce(float t) {
|
||||
return 1 - pow(2, -6 * t) * abs(cos(t * PI * 3.5));
|
||||
}
|
||||
|
||||
float easeInOutBounce(float t) {
|
||||
static float easeInOutBounce(float t) {
|
||||
if (t < 0.5) {
|
||||
return 8 * pow(2, 8 * (t - 1)) * abs(sin(t * PI * 7));
|
||||
} else {
|
||||
return 1 - 8 * pow(2, -8 * t) * abs(sin(t * PI * 7));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user