"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** linear */
var linear = function (percent) { return percent; };
linear.reverse = function (easedPercent) { return easedPercent; };
/** quadratic functions */
var easeInQuad = function (percent) { return Math.pow(percent, 2); };
easeInQuad.reverse = function (easedPercent) { return Math.sqrt(easedPercent); };
var easeOutQuad = function (percent) {
    var tt = percent - 1;
    return 1 - Math.pow(tt, 2);
};
easeOutQuad.reverse = function (easedPercent) { return 1 - Math.sqrt(1 - easedPercent); };
var easeInOutQuad = function (percent) {
    var t = percent;
    if (t < 0.5) {
        return Math.pow(2 * t, 2) / 2;
    }
    else {
        var tt = 2 * (t - 1);
        return 1 - Math.pow(tt, 2) / 2;
    }
};
easeInOutQuad.reverse = function (easedPercent) {
    if (easedPercent < 0.5) {
        return Math.sqrt(easedPercent * 2) / 2;
    }
    else {
        var converted = (easedPercent - 1) * 2 + 1;
        return 1 - Math.sqrt(1 - converted) / 2;
    }
};
/** cubic functions */
var easeInCubic = function (percent) { return Math.pow(percent, 3); };
easeInCubic.reverse = function (easedPercent) { return Math.pow(easedPercent, 1 / 3); };
var easeOutCubic = function (percent) {
    var tt = percent - 1;
    return 1 + Math.pow(tt, 3);
};
easeOutCubic.reverse = function (easedPercent) {
    return 1 - Math.pow(1 - easedPercent, 1 / 3);
};
var easeInOutCubic = function (percent) {
    var t = percent;
    if (t < 0.5) {
        return Math.pow(2 * t, 3) / 2;
    }
    else {
        var tt = 2 * (t - 1);
        return 1 + Math.pow(tt, 3) / 2;
    }
};
easeInOutCubic.reverse = function (easedPercent) {
    if (easedPercent < 0.5) {
        return Math.pow(easedPercent * 2, 1 / 3) / 2;
    }
    else {
        var converted = (easedPercent - 1) * 2 + 1;
        return 1 - Math.pow(1 - converted, 1 / 3) / 2;
    }
};
/** quartic functions */
var easeInQuart = function (percent) { return Math.pow(percent, 4); };
easeInQuart.reverse = function (easedPercent) { return Math.pow(easedPercent, 1 / 4); };
var easeOutQuart = function (percent) {
    var tt = percent - 1;
    return 1 - Math.pow(tt, 4);
};
easeOutQuart.reverse = function (easedPercent) {
    return 1 - Math.pow(1 - easedPercent, 1 / 4);
};
var easeInOutQuart = function (percent) {
    var t = percent;
    if (t < 0.5) {
        return Math.pow(2 * t, 4) / 2;
    }
    else {
        var tt = 2 * (t - 1);
        return 1 - Math.pow(tt, 4) / 2;
    }
};
easeInOutQuart.reverse = function (easedPercent) {
    if (easedPercent < 0.5) {
        return Math.pow(easedPercent * 2, 1 / 4) / 2;
    }
    else {
        var converted = (easedPercent - 1) * 2 + 1;
        return 1 - Math.pow(1 - converted, 1 / 4) / 2;
    }
};
/** quintic functions */
var easeInQuint = function (percent) { return Math.pow(percent, 5); };
easeInQuint.reverse = function (easedPercent) { return Math.pow(easedPercent, 1 / 5); };
var easeOutQuint = function (percent) {
    var tt = percent - 1;
    return 1 + Math.pow(tt, 5);
};
easeOutQuint.reverse = function (easedPercent) {
    return 1 - Math.pow(1 - easedPercent, 1 / 5);
};
var easeInOutQuint = function (percent) {
    var t = percent;
    if (t < 0.5) {
        return Math.pow(2 * t, 5) / 2;
    }
    else {
        var tt = 2 * (t - 1);
        return 1 + Math.pow(tt, 5) / 2;
    }
};
easeInOutQuint.reverse = function (easedPercent) {
    if (easedPercent < 0.5) {
        return Math.pow(easedPercent * 2, 1 / 5) / 2;
    }
    else {
        var converted = (easedPercent - 1) * 2 + 1;
        return 1 - Math.pow(1 - converted, 1 / 5) / 2;
    }
};
exports.EasingFunctions = {
    // no easing, no acceleration
    linear: linear,
    // accelerating from zero velocity
    easeInQuad: easeInQuad,
    // decelerating to zero velocity
    easeOutQuad: easeOutQuad,
    // acceleration until halfway, then deceleration
    easeInOutQuad: easeInOutQuad,
    // accelerating from zero velocity
    easeInCubic: easeInCubic,
    // decelerating to zero velocity
    easeOutCubic: easeOutCubic,
    // acceleration until halfway, then deceleration
    easeInOutCubic: easeInOutCubic,
    // accelerating from zero velocity
    easeInQuart: easeInQuart,
    // decelerating to zero velocity
    easeOutQuart: easeOutQuart,
    // acceleration until halfway, then deceleration
    easeInOutQuart: easeInOutQuart,
    // accelerating from zero velocity
    easeInQuint: easeInQuint,
    // decelerating to zero velocity
    easeOutQuint: easeOutQuint,
    // acceleration until halfway, then deceleration
    easeInOutQuint: easeInOutQuint,
};
