这是绘制倒计时小球的代码。将小时改成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);
添加回答
举报
0/150
提交
取消