倒计时效果

这是绘制倒计时小球的代码。将小时改成3位。依照自己的逻辑改的代码。可运行结果堪忧。百思却不解,请大神指教。

function render( cxt ){


    cxt.clearRect(0,0,WINDOW_WIDTH, WINDOW_HEIGHT);


    var hours = parseInt( curShowTimeSeconds / 3600);

    var minutes = parseInt( (curShowTimeSeconds - hours * 3600)/60 )

    var seconds = curShowTimeSeconds % 60

var hours_r=parseInt(hours/10)

if(hours_r>=10)

{var hours_s=parseInt(hours_r/10)

renderDigit( MARGIN_LEFT , MARGIN_TOP , parseInt(hours_s/10) , cxt )

renderDigit( MARGIN_LEFT , MARGIN_TOP , parseInt(hours_s%10) , cxt )

renderDigit( MARGIN_LEFT + 15*(RADIUS+1) , MARGIN_TOP , parseInt(hours%10) , cxt )

}

else{

    renderDigit( MARGIN_LEFT , MARGIN_TOP , parseInt(hours/10) , cxt )

    renderDigit( MARGIN_LEFT + 15*(RADIUS+1) , MARGIN_TOP , parseInt(hours%10) , cxt )

}

    renderDigit( MARGIN_LEFT + 30*(RADIUS + 1) , MARGIN_TOP , 10 , cxt )

    renderDigit( MARGIN_LEFT + 39*(RADIUS+1) , MARGIN_TOP , parseInt(minutes/10) , cxt);

    renderDigit( MARGIN_LEFT + 54*(RADIUS+1) , MARGIN_TOP , parseInt(minutes%10) , cxt);

    renderDigit( MARGIN_LEFT + 69*(RADIUS+1) , MARGIN_TOP , 10 , cxt);

    renderDigit( MARGIN_LEFT + 78*(RADIUS+1) , MARGIN_TOP , parseInt(seconds/10) , cxt);

    renderDigit( MARGIN_LEFT + 93*(RADIUS+1) , MARGIN_TOP , parseInt(seconds%10) , cxt);

http://img.mukewang.com/5661c11f0001c6d308960217.jpg




橙子lovesun
浏览 1294回答 1
1回答

哏誰倆呐

虽然看不懂你写的代码 但我觉得问题应该是在定位上面 百位的数字可能和十位的数字重合了  检查一下你显示位置的设置吧
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript