Microsoft Small Basic

Program Listing: QHZ156
GraphicsWindow.width=300
GraphicsWindow.Height=300
GraphicsWindow.Title="Emiel's klok"
While "true"
Program.Delay(1000)

h=Clock.Hour
m=clock.Minute
s=clock.Second

x1=150+ 50* Math.Sin(Math.GetRadians((h+m/60)*30))
y1=150-50*Math.Cos(Math.GetRadians((h+m/60)*30))


x2=150+ 80*Math.Sin(Math.GetRadians(m*6))
y2=150- 80*Math.Cos(Math.GetRadians(m*6))

x3=150+ 100*Math.Sin(Math.GetRadians(s*6))
y3=150- 100*Math.Cos(Math.GetRadians(s*6))

GraphicsWindow.Clear()
If (h>18) Or (h<6) Then
'NACHT
GraphicsWindow.BrushColor="black"
GraphicsWindow.FillRectangle(0,0,300,300)
GraphicsWindow.BrushColor="white"
GraphicsWindow.FillTriangle(x1,y1,x2,y2,x3,y3)
'Emiel's klok heeft geen wijzers...
GraphicsWindow.PenColor="lightgray"
GraphicsWindow.DrawLine(150,150,x1,y1)
GraphicsWindow.DrawLine(150,150,x2,y2)
GraphicsWindow.DrawLine(150,150,x3,y3)
Else
'DAG
GraphicsWindow.BrushColor="white"
GraphicsWindow.FillRectangle(0,0,300,300)
GraphicsWindow.BrushColor="black"
GraphicsWindow.FillTriangle(x1,y1,x2,y2,x3,y3)
'emiel's klok laat het draaipunt niet zien
GraphicsWindow.SetPixel(150,150,"black")

endif
endwhile