Microsoft Small Basic

Program Listing:
Embed this in your website
GraphicsWindow.Title = "Analog"
GraphicsWindow.Width = 600
GraphicsWindow.Height = 600

byousinfutosa = 5
byousinnagasa = 250

hunsinfutosa = 8
hunsinnagasa = 280

jisinfutosa = 15
jisinnagasa = 200

tyusinX = 300
tyusinY = 300

GraphicsWindow.BrushColor = "LightCyan"
GraphicsWindow.FillEllipse(0, 0, 600, 600)
GraphicsWindow.BrushColor = "MintCream"
GraphicsWindow.FillEllipse(50, 50, 500, 500)

GraphicsWindow.BrushColor = "DarkSlateGray"
GraphicsWindow.FontSize = "25"
GraphicsWindow.DrawText(285, 7, "12")
GraphicsWindow.DrawText(430, 50, "1")
GraphicsWindow.DrawText(530, 150, "2")
GraphicsWindow.DrawText(565, 285, "3")
GraphicsWindow.DrawText(530, 420, "4")
GraphicsWindow.DrawText(430, 520, "5")
GraphicsWindow.DrawText(290, 560, "6")
GraphicsWindow.DrawText(147, 518, "7")
GraphicsWindow.DrawText(47, 415, "8")
GraphicsWindow.DrawText(15, 285, "9")
GraphicsWindow.DrawText(45, 150, "10")
GraphicsWindow.DrawText(140, 50, "11")

Timer.Interval = 1000
Timer.Tick = tokeimove

Sub tokeimove

  Shapes.HideShape(jisin)
  Shapes.HideShape(hunsin)
  Shapes.HideShape(byousin)

  byounow = Clock.Second
  hunnow = Clock.Minute
  jinow = Clock.Hour
  pai = Math.Pi

  GraphicsWindow.BrushColor = "LightSeaGreen"
  jisin = Shapes.AddRectangle(jisinfutosa, jisinnagasa)
  jikatamuki = jinow * 30 + hunnow * 30 / 60
  idouxj = jisinnagasa * 0.5 * Math.Sin(jikatamuki * pai / 180)
  idouyj = jisinnagasa * 0.5 * (1 - Math.Cos(jikatamuki * pai / 180) )
  Shapes.Rotate(jisin, jikatamuki)
  Shapes.Move(jisin, tyusinX - jisinfutosa + idouxj, tyusinY - jisinnagasa + idouyj)

  GraphicsWindow.BrushColor = "SeaGreen"
  hunsin = Shapes.AddRectangle(hunsinfutosa, hunsinnagasa)
  idouxh = hunsinnagasa * 0.5 * Math.Sin(hunnow * 6 * pai / 180)
  idouyh = hunsinnagasa * 0.5 * (1 - Math.Cos(hunnow * 6 * pai / 180) )
  Shapes.Rotate(hunsin, hunnow * 6)
  Shapes.Move(hunsin, tyusinX - hunsinfutosa + idouxh, tyusinY - hunsinnagasa + idouyh)

  GraphicsWindow.BrushColor = "LightCoral"
  byousin = Shapes.AddRectangle(byousinfutosa, byousinnagasa)
  idoux = byousinnagasa * 0.5 * Math.Sin(byounow * 6 * pai / 180)
  idouy = byousinnagasa * 0.5 * (1 - Math.Cos(byounow * 6 * pai / 180) )
  Shapes.Rotate(byousin, byounow * 6)
  Shapes.Move(byousin, tyusinX - byousinfutosa + idoux, tyusinY - byousinnagasa + idouy)
EndSub

Copyright (c) Microsoft Corporation. All rights reserved.