2048.js
// Draw GUI when matrix move and merge occurd.
Draw GUI when matrix move and merge occurd.
Draw GUI when matrix move and merge occurd .
function drawGUI(matrix, list) {
        var i = 0, j = 0, len = matrix.length, color = null, item = null;
        for (i = 0; i < len; i++) {
            for (j = 0; j < len; j++) {
                color = generateColorByNumber(matrix[i][j]);
                item = list[i][j].children[0];
                item.textContent = matrix[i][j] === 0 ? ' ' : matrix[i][j];
                item.style.background = color.bgColor;
                item.style.color = color.color;
                item.style.fontSize = generateSizeByNumber(matrix[i][j]) + 'px';
            }
        }
    }
function drawGUI ( matrix , list ) { var i = 0 , j = 0 , len = matrix . length , color = null , item = null ; for ( i = 0 ; i < len ; i ++ ) { for ( j = 0 ; j < len ; j ++ ) { color = generateColorByNumber ( matrix [ i ] [ j ] ) ; item = list [ i ] [ j ] . children [ 0 ] ; item . textContent = matrix [ i ] [ j ] === 0 ? ' ' : matrix [ i ] [ j ] ; item . style . background = color . bgColor ; item . style . color = color . color ; item . style . fontSize = generateSizeByNumber ( matrix [ i ] [ j ] ) + 'px' ; } } }
Draw GUI when matrix move and merge occurd.
Draw GUI when matrix move and merge occurd .