Yet another homework-inspired addition to the API – a clock face image generator. My son brought home a worksheet from school with badly-drawn clock faces on it. On some clock faces the minute hand was pointing to the “6” (half-past) while the hour hand pointed directly at the 3, when it should have pointed either half way between 2-3 or half way between 3-4.
The clock-face image URL creates a random clock face if no arguments are present. Query arguments are ‘time’ to specify time in milliseconds since midnight. A ‘resolution’ argument controls the resolution of randomly-generated times and also to hide the seconds hand for anything greater than second. Values for ‘resolution’ are one of [second, minute, fives, quarter, half, hour]. The ‘width’ argument is a 3-digit size in pixels of the generated image.
A .json API URL returns some data useful for embedding the clock face as an interactive test:
What is the time?
Pingback: Clock face worksheet | Firtl.com