function drawDigits(lastText, thisText, n) {
    "ram"
    const p = CHARP; // padding around digits
    const s = CHARW; // character size
    var x = 80; // x offset
    g.reset();
    g.setColor(0, 0, 0);
    g.setBgColor(1, 1, 1);
    for (var i = 0; i < lastText.length; i++) {
        var lastCh = lastText[i];
        var thisCh = thisText[i];
        if (thisCh == ":") x -= 4;
        if (lastCh != thisCh) {
            var ch, chn = n;
            if ((thisCh - 1 == lastCh ||
                (thisCh == 0 && lastCh == 5) ||
                (thisCh == 0 && lastCh == 9)))
                ch = lastCh;
            else {
                ch = thisCh;
                chn = 0;
            }
            buf.clear();
            if (ch == "5") ch = (lastCh == 5 && thisCh == 0) ? "5to0" : "5to6";
            var l = DIGITS[ch](chn);
            l.forEach(c => {
                if (c[0] != c[2]) // horiz
                    buf.fillRect(p + c[0] * s, c[1] * s, p + c[2] * s, 2 * p + c[3] * s);
                else if (c[1] != c[3]) // vert
                    buf.fillRect(c[0] * s, p + c[1] * s, 2 * p + c[2] * s, p + c[3] * s);
            });
            g.drawImage(bufimg, x, Y);
        }
        if (thisCh == ":") x -= 4;
        x += s + p + 7;
    }
}
/* Draw a transition between lastText and thisText.
 'n' is the amount - 0..1 */
Draw a transition between lastText and thisText.
Draw a transition between lastText and thisText .
function drawDigits(lastText, thisText, n) {
    "ram"
    const p = CHARP; 
    const s = CHARW; 
    var x = 80; 
    g.reset();
    g.setColor(0, 0, 0);
    g.setBgColor(1, 1, 1);
    for (var i = 0; i < lastText.length; i++) {
        var lastCh = lastText[i];
        var thisCh = thisText[i];
        if (thisCh == ":") x -= 4;
        if (lastCh != thisCh) {
            var ch, chn = n;
            if ((thisCh - 1 == lastCh ||
                (thisCh == 0 && lastCh == 5) ||
                (thisCh == 0 && lastCh == 9)))
                ch = lastCh;
            else {
                ch = thisCh;
                chn = 0;
            }
            buf.clear();
            if (ch == "5") ch = (lastCh == 5 && thisCh == 0) ? "5to0" : "5to6";
            var l = DIGITS[ch](chn);
            l.forEach(c => {
                if (c[0] != c[2]) 
                    buf.fillRect(p + c[0] * s, c[1] * s, p + c[2] * s, 2 * p + c[3] * s);
                else if (c[1] != c[3]) 
                    buf.fillRect(c[0] * s, p + c[1] * s, 2 * p + c[2] * s, p + c[3] * s);
            });
            g.drawImage(bufimg, x, Y);
        }
        if (thisCh == ":") x -= 4;
        x += s + p + 7;
    }
}
function drawDigits ( lastText , thisText , n ) { "ram" const p = CHARP ; const s = CHARW ; var x = 80 ; g . reset ( ) ; g . setColor ( 0 , 0 , 0 ) ; g . setBgColor ( 1 , 1 , 1 ) ; for ( var i = 0 ; i < lastText . length ; i ++ ) { var lastCh = lastText [ i ] ; var thisCh = thisText [ i ] ; if ( thisCh == ":" ) x -= 4 ; if ( lastCh != thisCh ) { var ch , chn = n ; if ( ( thisCh - 1 == lastCh || ( thisCh == 0 && lastCh == 5 ) || ( thisCh == 0 && lastCh == 9 ) ) ) ch = lastCh ; else { ch = thisCh ; chn = 0 ; } buf . clear ( ) ; if ( ch == "5" ) ch = ( lastCh == 5 && thisCh == 0 ) ? "5to0" : "5to6" ; var l = DIGITS [ ch ] ( chn ) ; l . forEach ( c => { if ( c [ 0 ] != c [ 2 ] ) buf . fillRect ( p + c [ 0 ] * s , c [ 1 ] * s , p + c [ 2 ] * s , 2 * p + c [ 3 ] * s ) ; else if ( c [ 1 ] != c [ 3 ] ) buf . fillRect ( c [ 0 ] * s , p + c [ 1 ] * s , 2 * p + c [ 2 ] * s , p + c [ 3 ] * s ) ; } ) ; g . drawImage ( bufimg , x , Y ) ; } if ( thisCh == ":" ) x -= 4 ; x += s + p + 7 ; } }
Draw a transition between lastText and thisText.
Draw a transition between lastText and thisText .
// padding around digits // character size // x offset // horiz // vert