问答详情
源自:3-2 倒计时数字钟的具体绘制

郁闷到不知错哪里..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

</head>


<body>

<canvas id="canvas" style="display:block;margin:50px auto;"></canvas>

    

    <script src="canvas/源文件/digit.js"></script>

    <script src="canvas/js/countdown.js"></script>

  

</body>

</html>





// JavaScript Document

var WINDOW_WIDTH=1024;

var WINDOW_HEIGHT=768;//方便以后修改

var RADIUS=8;


window.onload = function(){


    var canvas = document.getElementById('canvas');

    var context = canvas.getContext("2d");


    canvas.width = WINDOW_WIDTH;

    canvas.height = WINDOW_HEIGHT;


    render( context )

}


function render(cxt){

var hours=12;

var minutes=34;

var second=56;

renderDigit(0,0,paseInt(hours/10),cxt)

}




function renderDigit( x , y , num , cxt ){


    cxt.fillStyle = "rgb(0,102,153)";


    for( var i = 0 ; i < digit[num].length ; i ++ ){

        for(var j = 0 ; j < digit[num][i].length ; j ++ ){

            if( digit[num][i][j] == 1 ){

                cxt.beginPath();

                cxt.arc(x+j*2*(RADIUS+1)+(RADIUS+1) , y+i*2*(RADIUS+1)+(RADIUS+1) , RADIUS , 0 , 2*Math.PI )

                cxt.closePath()


                cxt.fill()

            }

}

}

}


提问者:qq_在道上_0 2015-07-02 13:54

个回答

  • qq_在道上_0
    2015-07-02 14:10:50

    好了 我知道了,少了个r 在parseInt!!谁能告诉我找出BUG的简单方法!!!!