var canvas=document.getElementById("canvas");
var context=canvas.getContext("2d");
canvas.width=800;
canvas.height=600;
setInterval(render,10);
//console.log(digit);
var r=6;
var timer;
//console.log(x);
var oTime=new Date(2016,4,14,0,0,0);
var nTime=new Date();
var h1=parseInt((oTime-nTime)/(1000*60*60*10)),
h2=parseInt((oTime-nTime)/(1000*60*60)%10);
var m1=parseInt((oTime-nTime)/(1000*60)%60/10),
m2=parseInt((oTime-nTime)/(1000*60)%60%10);
var s1=parseInt((oTime-nTime)/(1000)%60/10),
s2=parseInt((oTime-nTime)/(1000)%60%10);
function render(){
context.clearRect(0,0,800,600);
draw(0,0,h1,context);
draw(15*(r+1),0,h2,context);
draw(30*(r+1),0,10,context);
draw(39*(r+1),0,m1,context);
draw(54*(r+1),0,m1,context);
draw(69*(r+1),0,10,context);
draw(78*(r+1),0,s1,context);
draw(93*(r+1),0,s2,context);
}
//console.log(s1);
function draw(x,y,num,cxt){
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*(r+1)*2+r+1,y+i*(r+1)*2+r+1,r,0,2*Math.PI);
cxt.fillStyle="blue";
cxt.fill();}
}
}
}//draw