#include "core/tween_curves.h"

namespace fn::tween {

float apply(Ease e, float t) {
    switch (e) {
        case Ease::Linear:       return linear(t);
        case Ease::InQuad:       return in_quad(t);
        case Ease::OutQuad:      return out_quad(t);
        case Ease::InOutQuad:    return in_out_quad(t);
        case Ease::InCubic:      return in_cubic(t);
        case Ease::OutCubic:     return out_cubic(t);
        case Ease::InOutCubic:   return in_out_cubic(t);
        case Ease::InExpo:       return in_expo(t);
        case Ease::OutExpo:      return out_expo(t);
        case Ease::InOutExpo:    return in_out_expo(t);
        case Ease::InElastic:    return in_elastic(t);
        case Ease::OutElastic:   return out_elastic(t);
        case Ease::InOutElastic: return in_out_elastic(t);
        case Ease::InBounce:     return in_bounce(t);
        case Ease::OutBounce:    return out_bounce(t);
        case Ease::InOutBounce:  return in_out_bounce(t);
    }
    return t;
}

const char* name(Ease e) {
    switch (e) {
        case Ease::Linear:       return "Linear";
        case Ease::InQuad:       return "InQuad";
        case Ease::OutQuad:      return "OutQuad";
        case Ease::InOutQuad:    return "InOutQuad";
        case Ease::InCubic:      return "InCubic";
        case Ease::OutCubic:     return "OutCubic";
        case Ease::InOutCubic:   return "InOutCubic";
        case Ease::InExpo:       return "InExpo";
        case Ease::OutExpo:      return "OutExpo";
        case Ease::InOutExpo:    return "InOutExpo";
        case Ease::InElastic:    return "InElastic";
        case Ease::OutElastic:   return "OutElastic";
        case Ease::InOutElastic: return "InOutElastic";
        case Ease::InBounce:     return "InBounce";
        case Ease::OutBounce:    return "OutBounce";
        case Ease::InOutBounce:  return "InOutBounce";
    }
    return "?";
}

} // namespace fn::tween
