Created basic movement.

This commit is contained in:
2024-09-11 09:21:56 -05:00
parent 01c56477aa
commit e5349cc093
13 changed files with 364 additions and 48 deletions

View File

@ -45,4 +45,55 @@ float_t Easing::easeOutQuart(float_t t) {
float_t Easing::easeInOutQuart(float_t t) {
return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t;
}
float_t Easing::easeInQuint(float_t t) {
return t * t * t * t * t;
}
float_t Easing::easeOutQuint(float_t t) {
return 1 + (--t) * t * t * t * t;
}
float_t Easing::easeInOutQuint(float_t t) {
return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t;
}
float_t Easing::easeInSine(float_t t) {
return 1 - cos(t * M_PI_2);
}
float_t Easing::easeOutSine(float_t t) {
return sin(t * M_PI_2);
}
float_t Easing::easeInOutSine(float_t t) {
return 0.5 * (1 - cos(M_PI * t));
}
float_t Easing::easeInExpo(float_t t) {
return t == 0 ? 0 : pow(2, 10 * (t - 1));
}
float_t Easing::easeOutExpo(float_t t) {
return t == 1 ? 1 : 1 - pow(2, -10 * t);
}
float_t Easing::easeInOutExpo(float_t t) {
if(t == 0) return 0;
if(t == 1) return 1;
if(t < 0.5) return 0.5 * pow(2, 20 * t - 10);
return 1 - 0.5 * pow(2, -20 * t + 10);
}
float_t Easing::easeInCirc(float_t t) {
return 1 - sqrt(1 - t * t);
}
float_t Easing::easeOutCirc(float_t t) {
return sqrt(1 - (--t) * t);
}
float_t Easing::easeInOutCirc(float_t t) {
return t < 0.5 ? 0.5 * (1 - sqrt(1 - 4 * t * t)) : 0.5 * (sqrt(-((2 * t) - 3) * ((2 * t) - 1)) + 1);
}

View File

@ -88,5 +88,101 @@ namespace Dawn {
* @return Eased value.
*/
static float_t easeInOutQuart(float_t t);
/**
* Quintic easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeInQuint(float_t t);
/**
* Quintic easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeOutQuint(float_t t);
/**
* Quintic easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeInOutQuint(float_t t);
/**
* Sine easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeInSine(float_t t);
/**
* Sine easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeOutSine(float_t t);
/**
* Sine easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeInOutSine(float_t t);
/**
* Exponential easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeInExpo(float_t t);
/**
* Exponential easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeOutExpo(float_t t);
/**
* Exponential easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeInOutExpo(float_t t);
/**
* Circular easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeInCirc(float_t t);
/**
* Circular easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeOutCirc(float_t t);
/**
* Circular easing function.
*
* @param t Time value between 0 and 1.
* @return Eased value.
*/
static float_t easeInOutCirc(float_t t);
};
}