function showTime() {
    if (animInterval) return; // in animation - quit
    var d = new Date();
    var hours = d.getHours();
    if (is12Hour) hours = ((hours + 11) % 12) + 1;
    var t = (" " + hours).substr(-2) + ":" +
        ("0" + d.getMinutes()).substr(-2);
    var l = lastTime;
    // same - don't animate
    if (t == l || l == "-----") {
        drawDigits(l, t, 0);
        drawEverythingElse();
        lastTime = t;
        return;
    }
    var n = 0;
    animInterval = setInterval(function () {
        n += 1 / 10;
        if (n >= 1) {
            n = 1;
            clearInterval(animInterval);
            animInterval = undefined;
        }
        drawDigits(l, t, n);
    }, 20);
    lastTime = t;
}
/* Show the current time, and animate if needed */
Show the current time, and animate if needed
Show the current time and animate if needed
function showTime() {
    if (animInterval) return; 
    var d = new Date();
    var hours = d.getHours();
    if (is12Hour) hours = ((hours + 11) % 12) + 1;
    var t = (" " + hours).substr(-2) + ":" +
        ("0" + d.getMinutes()).substr(-2);
    var l = lastTime;
    if (t == l || l == "-----") {
        drawDigits(l, t, 0);
        drawEverythingElse();
        lastTime = t;
        return;
    }
    var n = 0;
    animInterval = setInterval(function () {
        n += 1 / 10;
        if (n >= 1) {
            n = 1;
            clearInterval(animInterval);
            animInterval = undefined;
        }
        drawDigits(l, t, n);
    }, 20);
    lastTime = t;
}
function showTime ( ) { if ( animInterval ) return ; var d = new Date ( ) ; var hours = d . getHours ( ) ; if ( is12Hour ) hours = ( ( hours + 11 ) % 12 ) + 1 ; var t = ( " " + hours ) . substr ( - 2 ) + ":" + ( "0" + d . getMinutes ( ) ) . substr ( - 2 ) ; var l = lastTime ; if ( t == l || l == "-----" ) { drawDigits ( l , t , 0 ) ; drawEverythingElse ( ) ; lastTime = t ; return ; } var n = 0 ; animInterval = setInterval ( function ( ) { n += 1 / 10 ; if ( n >= 1 ) { n = 1 ; clearInterval ( animInterval ) ; animInterval = undefined ; } drawDigits ( l , t , n ) ; } , 20 ) ; lastTime = t ; }
Show the current time, and animate if needed
Show the current time and animate if needed
// in animation - quit // same - don't animate