Analogue clock
This seemingly simple clock actually requires a lot of programming to achieve. It serves no real purpose as almost all users have a clock on their screen anyway, but it serves a good tutorial purpose.
To download the script(s), see the script license, and check details like browser compatibility, use the links on the navigation panel at the top of this page.
Every 75ms, the browser window settings are taken, including height and width and scrolling amount. The offset of the clock from the top corner of the page is calculated according to user preference. The positions of the numbers and parts of the hands are calculated using some complicated sine and cosine functions.
The following aspects of the clock are configurable:
- colour of hour hand
- colour of minute hand
- colour of second hand
- colour of numbers
- diameter of clock
- position of clock relative to any corner of the browser window
- whether the clock should scroll with screen