Delivering a clock
The following program displays an analog clock with hands for hours and minutes, and its second hand seconds.
Code:
'Beginning of program
'
xRAD = math.pi / 180
'
GraphicsWindow.Height = 200
GraphicsWindow.Width = 200
GraphicsWindow.BackgroundColor = "Black"
GraphicsWindow.Show ()
'
Timer.Interval = 1000
ShowTime Timer.Tick =
'
'End of program
'
Sub ShowTime
Sec = 6 * Clock.Second
Clock.Minute * min = 6
Heu Clock.Hour * = 30
'
GraphicsWindow.Clear ()
GraphicsWindow.PenColor = "Yellow"
GraphicsWindow.DrawEllipse (0,0,200,200)
'
X = 100 + (90 * Math.sin (xRAD * Sec))
Y = 100 - (90 * Math.Cos (xRAD * Sec))
GraphicsWindow.DrawLine (100.100, X, Y)
'
GraphicsWindow.PenColor = "Green"
X = 100 + (80 * Math.sin (xRAD * Min))
Y = 100 - (80 * Math.Cos (xRAD * Min))
GraphicsWindow.DrawLine (100.100, X, Y)
'
GraphicsWindow.PenColor = "Red"
X = 100 + (60 * Math.sin (xRAD Heu *))
Y = 100 - (60 * Math.Cos (Heu xRAD *))
GraphicsWindow.DrawLine (100.100, X, Y)
'
GraphicsWindow.PenColor = "Cyan"
GraphicsWindow.DrawBoundText (70150100, Clock.Time)
EndSub
Bookmarks