Clock with Javascript 3 ways
About anolog clock, there are may ways do in Javascript. The Math thorey is to calculate the degree depending on how many parts you want to divide. Because the circle is 360 degree. The basic is one minute equal to 60 seconds, one hour equal to 60 minutes. First, we need a clock on page,so there are several ways. 1.canvas Acording to W3C clock , it's clear that drawing a canvas is a good visial resolution. with getContext('2d'),and draw the clockface,number and time. The canvas drawing use the line ,stroke and fill a lot. such as the drawFace(), the circle with radius Math,because the circle is 2PI*radius,and fill with color inside. 2.svg there is a way to use svg in Html. Like the code, the width and height can be set in html with svg. Demo more details here 3.html it's straight to set everything in the html.maybe it's not very decent code,but easy to understand for beginner. DEMO Github 24 hours display clock below layout every number and hand in html. A...