Session 2

Digital Clock

  • Start from s = s + 1 with s representing seconds.  Reset s = 0 when s = 60.
  • Add a minute variable m which is updated m = m + 1 every time s = 60. Reset m = 0 when m = 60.
  • Add an hour variable h which is updated h = h + 1 every time m = 60. Reset h = 0 every time h = 24.
  • Display h, m and on screen.

Analog Clock

  • Start from 2. Digital Clock.
  • Add an analog display as a rotating clock arms showing hour, minute and second.
  • Use rotate(angle) to rotate arm given angle, preceded by translate(200,200) and followed by translate(-200,-200).