Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/Draw-a-clock/Liberty-BASIC/draw-a-clock.basic
Normal file
39
Task/Draw-a-clock/Liberty-BASIC/draw-a-clock.basic
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
WindowWidth =120
|
||||
WindowHeight =144
|
||||
nomainwin
|
||||
|
||||
open "Clock" for graphics_nsb_nf as #clock
|
||||
#clock "trapclose [exit]"
|
||||
#clock "fill white"
|
||||
for angle =0 to 330 step 30
|
||||
#clock "up ; home ; north ; turn "; angle
|
||||
#clock "go 40 ; down ; go 5"
|
||||
next angle
|
||||
|
||||
#clock "flush"
|
||||
|
||||
timer 1000, [display]
|
||||
wait
|
||||
|
||||
[display] ' called only when seconds have changed
|
||||
time$ =time$()
|
||||
seconds =val( right$( time$, 2))
|
||||
' delete the last drawn segment, if there is one
|
||||
if segId >2 then #clock "delsegment "; segId -1
|
||||
' center the turtle
|
||||
#clock "up ; home ; down ; north"
|
||||
' erase each hand if its position has changed
|
||||
if oldSeconds <>seconds then #clock, "size 1 ; color white ; turn "; oldSeconds *6 ; " ; go 38 ; home ; color black ; north" : oldSeconds =seconds
|
||||
' redraw all three hands, second hand first
|
||||
#clock "size 1 ; turn "; seconds * 6 ; " ; go 38"
|
||||
' flush to end segment, then get the next segment id #
|
||||
#clock "flush"
|
||||
#clock "segment"
|
||||
input #clock, segId
|
||||
|
||||
wait
|
||||
|
||||
[exit]
|
||||
close #clock
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue