//
//  Animation.js
//  Written by Stefan Habel
//  Version 2.0
//  Last modified: 20.11.2007
//


window.Animation = {}

//!
//! Filters the given parameter value by the ease-in function.
//!
//! \param t    the parameter to filter
//!
window.Animation.EaseInFilter = function ( t )
{
    return 2 * t * t;
}


//!
//! Filters the given parameter value by the ease-out function.
//!
//! \param t    the parameter to filter
//!
window.Animation.EaseOutFilter = function ( t )
{
    return -2 * ((t - 1) * (t - 1)) + 1;
}


//!
//! Filters the given parameter value by the ease-in or ease-out function,
//! depending on the value.
//!
//! \param t    the parameter to filter
//!
window.Animation.EaseFilter = function ( t )
{
    if (t <= 0.5)
        return Animation.EaseInFilter(t);
    else
        return Animation.EaseOutFilter(t);
}


// style enumeration
window.Animation.Style = {
    NONE       : -1,
    VERTICAL   : 0,
    HORIZONTAL : 1,
    DIAGONAL   : 2,
    OPACITY    : 3
};


// state enumeration
window.Animation.State = {
    IDLE       :  0,
    FADING_IN  :  1,
    FADING_OUT : -1
};


// phase enumeration
window.Animation.Phase = {
    NONE         : -1,
    FADE_OUT     : 0,
    ADJUST_SPACE : 1,
    FADE_IN      : 2,
    CROSS_FADE   : 3
};


// additional constants
window.Animation.DELTA = 0.15;    /* per time step */
window.Animation.DELAY = 30;

