/**
 * Copyright (c) 2021 Dominic Masters
 * 
 * This software is released under the MIT License.
 * https://opensource.org/licenses/MIT
 */

#include "easing.h"

float easeLinear(float t) {
  return t;
}

float easeInQuad(float t) {
  return t * t;
}

float easeOutQuad(float t) {
  return t * (2 - t);
}

float easeInOutQuad(float t) {
  return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
}

float easeInCubic(float t) {
  return t * t * t;
}

float easeOutCubic(float t) {
  return (t - 1) * (t - 1) * (t - 1) + 1;
}

float easeInOutCubic(float t) {
  return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
}

float easeInQuart(float t) {
  return t * t * t * t;
}

float easeOutQuart(float t) {
  return 1 - (t-1)*(t-1)*(t-1)*(t-1);
}

float easeInOutQuart(float t) {
  return t < .5 ? 8*t*t*t*t : 1-8*(t-1)*(t-1)*(t-1)*(t-1);
}

float easeInQuint(float t) {
  return t*t*t*t*t;
}

float easeOutQuint(float t) {
  return 1 + (t-1)*(t-1)*(t-1)*(t-1)*(t-1);
}

float easeInOutQuint(float t) {
  return t<.5 ? 16*t*t*t*t*t : 1+16*(t-1)*(t-1)*(t-1)*(t-1)*(t-1);
}