src/viewer.js
function updateControlsFade( viewer ) {
    var currentTime,
        deltaTime,
        opacity,
        i;
    if ( viewer.controlsShouldFade ) {
        currentTime = $.now();
        deltaTime = currentTime - viewer.controlsFadeBeginTime;
        opacity = 1.0 - deltaTime / viewer.controlsFadeLength;

        opacity = Math.min( 1.0, opacity );
        opacity = Math.max( 0.0, opacity );

        for ( i = viewer.controls.length - 1; i >= 0; i--) {
            if (viewer.controls[ i ].autoFade) {
                viewer.controls[ i ].setOpacity( opacity );
            }
        }

        if ( opacity > 0 ) {
            // fade again
            scheduleControlsFade( viewer );
        }
    }
}
function updateControlsFade( viewer ) {
    var currentTime,
        deltaTime,
        opacity,
        i;
    if ( viewer.controlsShouldFade ) {
        currentTime = $.now();
        deltaTime = currentTime - viewer.controlsFadeBeginTime;
        opacity = 1.0 - deltaTime / viewer.controlsFadeLength;

        opacity = Math.min( 1.0, opacity );
        opacity = Math.max( 0.0, opacity );

        for ( i = viewer.controls.length - 1; i >= 0; i--) {
            if (viewer.controls[ i ].autoFade) {
                viewer.controls[ i ].setOpacity( opacity );
            }
        }

        if ( opacity > 0 ) {
            // fade again
            scheduleControlsFade( viewer );
        }
    }
}
function updateControlsFade ( viewer ) { var currentTime , deltaTime , opacity , i ; if ( viewer . controlsShouldFade ) { currentTime = $ . now ( ) ; deltaTime = currentTime - viewer . controlsFadeBeginTime ; opacity = 1.0 - deltaTime / viewer . controlsFadeLength ; opacity = Math . min ( 1.0 , opacity ) ; opacity = Math . max ( 0.0 , opacity ) ; for ( i = viewer . controls . length - 1 ; i >= 0 ; i -- ) { if ( viewer . controls [ i ] . autoFade ) { viewer . controls [ i ] . setOpacity ( opacity ) ; } } if ( opacity > 0 ) { // fade again scheduleControlsFade ( viewer ) ; } } }
determines if fade animation is done or continues the animation
determines if fade animation is done or continues the animation