/**@module */

/**
 * @callback interpolator
 * @param {number} current the current value.
 * @param {number} dest the destination value.
 * @param {number} frameDelta the time elapsed since the last update.
 * @returns {number} the new current value.
 */

// TODO: Add some interpolation functions.

/**
 * 
 * @param {number} rate the number of frequency values to shift by per second.
 * @returns {module:support/easings~interpolator} the interpolation function with the given rate.
 */
export function createEaseLinear(rate) {
    return (current, dest, frameDelta) => {
        if (dest < current) {
            const res = current - (rate * frameDelta);
            return res < dest ? dest : res;
        } else {
            const res = current + (rate * frameDelta);
            return res > dest ? dest : res;
        }
    };
}

