var WINDOW_WIDTH=1024;var WINDOW_HEIGHT=768;var RADIUS=8;var MARGIN_TOP=60;var MARGIN_LEFT=30;window.onload=function(){ var canvas=document.getElementById('Canvas'); var context=canvas.getContext("2d"); canvas.width=WINDOW_WIDTH; canvas.height=WINDOW_HEIGHT; rendet(context)}function rendet(ctx){ var hours=12; var minutes=34; var seconds=56; rendetDigit(MARGIN_LEFT,MARGIN_TOP,parseInt(hours/10),ctx); rendetDigit(MARGIN_LEFT+15*(RADIUS+1),MARGIN_TOP,parseInt(hours%10),ctx);}function rendetDigit(x,y,num,ctx){ ctx.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) { ctx.beginPath(); ctx.arc(x+j*2*(RADIUS+1)+(RADIUS+1),x+i*2*(RADIUS+1)+(RADIUS+1),RADIUS,0,2*Math.PI); ctx.closePath(); ctx.fill(); }}
- 1 回答
- 0 关注
- 1230 浏览
添加回答
举报
0/150
提交
取消