Draw a clock: Difference between revisions

mNo edit summary
Line 1,945:
 
<syntaxhighlight lang="text">
funcproc draw hour min sec . .
# dial
color 333
move 50 50
circle 45
color 797
circle 44
color 333
for i range0 60
a = i * 6
move 50 + sin a * 40 50 + cos a * 40
circle 0.25
.
for i range0 12
a = i * 30
move 50 + sin a * 40 50 + cos a * 40
circle 1
.
# hour
linewidth 2
color 000
a = (hour * 60 + min) / 2
move 50 50
line 50 + sin a * 32 50 + cos a * 32
# min
linewidth 1.5
a = (sec + min * 60) / 10
move 50 50
line 50 + sin a * 40 50 + cos a * 40
# sec
linewidth 1
color 700
a = sec * 6
move 50 50
line 50 + sin a * 40 50 + cos a * 40
.
on timer
if t <> floor systime
t = floor systime
h$ = timestr t
sec = number substr h$ 18 2
min = number substr h$ 15 2
hour = number substr h$ 12 2
if hour > 12
hour -= 12
.
call draw hour min sec
.
timer 0.1
.
timer 0
2,023

edits