Draw a clock: Difference between revisions

2,525 bytes added ,  5 years ago
m
No edit summary
Line 1,072:
}
}</lang>
 
=={{header|Easyprog.online}}==
[https://easyprog.online/ide/run.html?code=func%20draw%20hour%20min%20sec%20.%20.%0A%23%20dial%0Acolor%20333%0Alinewidth%2090%0Apoint%2050%2050%0Acolor%20797%0Alinewidth%2088%0Apoint%2050%2050%0Acolor%20333%0Alinewidth%202%0Apoint%2050%2050%0Alinewidth%200.5%0Afor%20i%20range%2060%0Aa%23%20%3D%20i%20%2A%206%0Apoint%2050%20%2B%20sin%20a%23%20%2A%2040%2050%20-%20cos%20a%23%20%2A%2040%0A.%0Alinewidth%202%0Afor%20i%20range%2012%0Aa%23%20%3D%20i%20%2A%2030%0Apoint%2050%20%2B%20sin%20a%23%20%2A%2040%2050%20-%20cos%20a%23%20%2A%2040%0A.%0A%23%20hour%0Alinewidth%202%0Acolor%20000%0Aa%23%20%3D%20%28hour%20%2A%2060%20%2B%20min%29%20/%202%0Amove%2050%2050%0Aline%2050%20%2B%20sin%20a%23%20%2A%2032%2050%20-%20cos%20a%23%20%2A%2032%0A%23%20min%0Alinewidth%201.5%0Aa%23%20%3D%20%28sec%20%2B%20min%20%2A%2060%29%20/%2010%0Amove%2050%2050%0Aline%2050%20%2B%20sin%20a%23%20%2A%2040%2050%20-%20cos%20a%23%20%2A%2040%0A%23%20sec%0Alinewidth%201%0Acolor%20700%0Aa%23%20%3D%20sec%20%2A%206%0Amove%2050%2050%0Aline%2050%20%2B%20sin%20a%23%20%2A%2040%2050%20-%20cos%20a%23%20%2A%2040%0A.%0Aon%20timer%0Aif%20t%24%20%3C%3E%20sys%20%22time%22%0At%24%20%3D%20sys%20%22time%22%0Ah%24%20%3D%20sys%20%22time%3A%22%20%26%20t%24%0Asec%20%3D%20number%20substr%20h%24%2017%202%0Amin%20%3D%20number%20substr%20h%24%2014%202%0Ahour%20%3D%20number%20substr%20h%24%2011%202%0Aif%20hour%20%3E%2012%0Ahour%20-%3D%2012%0A.%0Acall%20draw%20hour%20min%20sec%0Atimer%200.98%0Aelse%0Atimer%200.01%0A.%0A.%0Atimer%200 Run it]
 
<lang easyprog.online>func draw hour min sec . .
# dial
color 333
linewidth 90
point 50 50
color 797
linewidth 88
point 50 50
color 333
linewidth 2
point 50 50
linewidth 0.5
for i range 60
a# = i * 6
point 50 + sin a# * 40 50 - cos a# * 40
.
linewidth 2
for i range 12
a# = i * 30
point 50 + sin a# * 40 50 - cos a# * 40
.
# 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$ <> sys "time"
t$ = sys "time"
h$ = sys "time:" & t$
sec = number substr h$ 17 2
min = number substr h$ 14 2
hour = number substr h$ 11 2
if hour > 12
hour -= 12
.
call draw hour min sec
timer 0.98
else
timer 0.01
.
.
timer 0</lang>
 
=={{header|F_Sharp|F#}}==
2,083

edits