<! DOCTYPE html>
<title> Clocks </title>
<style>
Body{background: #42426F;}
#c1 {background:white;}
Span{color:white;}
</style>
<script>
Window.onload = function () {
var OC = document.getElementById (' C1 ');
var OGC = Oc.getcontext (' 2d ');
function Todraw () {
var x = 200;
var y = 200;
var r = 150;
Ogc.clearrect (0,0,oc.width,oc.height);
Get time
var odate = new Date ();
var ohours = odate.gethours ();
var omin = Odate.getminutes ();
var oSen = Odate.getseconds ();
var Ohoursvalue = ( -90 + ohours*30 + omin/2) * MATH.PI/180;
var Ominvalue = ( -90 + omin*6) * MATH.PI/180;
var Osenvalue = ( -90 + osen*6) * MATH.PI/180;
var osen2value = Osenvalue+math.pi;
Ogc.beginpath ();
for (var i = 0; i <; i++) {
Ogc.moveto (x, y);
Ogc.arc (x,y,r,6*i*math.pi/180,6* (i+1) *math.pi/180,false);
}
Ogc.closepath ();
Ogc.stroke ();
Ogc.fillstyle = ' white ';
Ogc.beginpath ();
Ogc.moveto (x, y);
Ogc.arc (x,y,r*19/20,0,360* (i+1) *math.pi/180,false);
Ogc.closepath ();
Ogc.fill ();
ogc.linewidth=3;
Ogc.beginpath ();
for (var i = 0; i <; i++) {
Ogc.moveto (x, y);
Ogc.arc (x,y,r,30*i*math.pi/180,30* (i+1) *math.pi/180,false);
}
Ogc.closepath ();
Ogc.stroke ();
Ogc.fillstyle = ' white ';
Ogc.beginpath ();
Ogc.moveto (x, y);
Ogc.arc (x,y,r*18/20,0,360* (i+1) *math.pi/180,false);
Ogc.closepath ();
Ogc.fill ();
Clockwise
Ogc.linewidth = 5;
Ogc.beginpath ();
Ogc.moveto (x, y);
Ogc.arc (X,y,r*10/20,ohoursvalue,ohoursvalue,false);
Ogc.closepath ();
Ogc.stroke ();
Minute
Ogc.linewidth = 3;
Ogc.beginpath ();
Ogc.moveto (x, y);
Ogc.arc (X,y,r*15/20,ominvalue,ominvalue,false);
Ogc.closepath ();
Ogc.stroke ();
Seconds
Ogc.linewidth = 1;
Ogc.beginpath ();
Ogc.moveto (x, y);
Ogc.arc (X,y,r*17/20,osenvalue,osenvalue,false);
Ogc.closepath ();
Ogc.stroke ();
Ogc.linewidth = 1;
Ogc.beginpath ();
Ogc.moveto (x, y);
Ogc.arc (X,y,r*5/20,osen2value,osen2value,false);
Ogc.closepath ();
Ogc.stroke ();
Ogc.beginpath ();
Ogc.moveto (x, y);
Ogc.arc (X,y,r*1/20,0,2*math.pi,false);
Ogc.fillstyle= ' black ';
Ogc.closepath ();
Ogc.fill ();
}
SetInterval (todraw,1000);
Todraw ();
};
</script>
<body>
<canvas id= "C1" width= "height=" >
<span> does not support Canvas browser </span>
</canvas><!--Default width 300, high 150-->
</body>
Clock. html