Microsoft Small Basic

Program Listing:
Embed this in your website
'Program AnalogClock.sb
'Written by Glennium

GraphicsWindow.Show()
GraphicsWindow.Width=500
GraphicsWindow.Height=500

Iter = Program.Directory   'Iter is Latin for Route, PATH, Journey, or Way.

DrawTicks()
SecondHand = Shapes.AddImage(Iter + "\SH.png")
MinuteHand = Shapes.AddImage(Iter + "\MH.png")
HourHand = Shapes.AddImage(Iter + "\HH.png")

Shapes.Move(SecondHand, -45 , 245)
Shapes.Move(MinuteHand, -45 , 245)
Shapes.Move(HourHand, -45 , 245)

Start:

Time1 = Clock.Hour
Time2 = Clock.Minute
Time3 = Clock.Second

If Time1 >= 12 Then
Time1 = Time1 - 12
EndIf

Time1 = Time1 * 30 + Time2 * 6 / 12 ' 30 degrees for each hour
Time2 = Time2 * 6 ' 6 degrees for each minute
Time3 = Time3 * 6   ' and second

Shapes.Rotate(HourHand, Time1 - 90)
Shapes.Rotate(MinuteHand, Time2 - 90)
Shapes.Rotate(SecondHand, Time3 - 90)

Goto Start


'------------------------------------------------------------------
Sub  DrawTicks
  GraphicsWindow.DrawEllipse(0,0,500,500)

  GraphicsWindow.DrawLine(375,34,365,51)     '1
  GraphicsWindow.DrawLine(466,125,449,135) '2
  GraphicsWindow.DrawLine(250,500,250,470) '3
  GraphicsWindow.DrawLine(467,375,449,365) '4
  GraphicsWindow.DrawLine(375,467,365,449) '5
  GraphicsWindow.DrawLine(0,250,30,250)      '6
  GraphicsWindow.DrawLine(125,467,135,449) '7
  GraphicsWindow.DrawLine(33,375,51,365)    '8
  GraphicsWindow.DrawLine(470,250,500,250) '9
  GraphicsWindow.DrawLine(33,125,51,135)    '10
  GraphicsWindow.DrawLine(125,33,135,51)    '11
  GraphicsWindow.DrawLine(250,0,250,30)      '12
EndSub
Copyright (c) Microsoft Corporation. All rights reserved.