I had fun modifying this.
1) Clock continues to tick while playing sound.
2) Motion less like a electric clock (jump vs slide).
3) Markers at 5,10,15, etc. highlighted.
4) Printing of III, IV, and V offset.
5) PAINT used intead of lengthy subroutine.
6) Used _D2R function.
7) All hands different lengths.
8) Shorter code.
The colors SHOULD be _UNSIGNED LONG, but for short code like this that isn't doing comparisons, it doesn't matter.
If you wonder why I do VAL(string$) instead of just plunk in a number, it's because I like things to line up.
_TITLE "Mantel Clock - Press Space Bar to play hour chimes at anytime."
_DELAY .3 ' because the move may not work without it
cx
= _WIDTH \
2 ' clock center xbrown
= _RGB32(183, 139, 100) ' clock face and trimgreen
= _RGB32(0, 55, 0) ' clock bulkhcol = black ' hour hand color
mcol = black ' minute hand color
scol
= _RGB32(255) ' second hand color' D# B C# F# F# C# D# B D# C3 B F# F# C# D# B
s$ = "311.13 246.94 277.18 185 0 185 277.18 311.13 246.94 0 311.13 277.18 246.94 185 0 185 277.18 311.13 246.94 0"
note
= VAL(MID$(s$
, notes
* 7 + 1, 6)) ttt = 0
sample
= SIN(ttt
* note
* ATN(1) * 8) ' 340Hz sine wave (ttt * 440 * 2p) sample
= sample
* EXP(-ttt
* 3) ' fade out eliminates clicks after sound ttt
= ttt
+ 1 / _SNDRATE ' sound card sample frequency determines time
ttt = 0
sample
= SIN(ttt
* 240 * ATN(1) * 8) ' 340Hz sine wave (ttt * 440 * 2p) sample
= sample
* EXP(-ttt
* 3) ' fade out eliminates clicks after sound ttt
= ttt
+ 1 / _SNDRATE ' sound card sample frequency determines time
clock:
PAINT (cx
, cy
), green
, green
LINE (100, cy
)-(700, 600), green
, BF
LINE (140, cy
)-(150, 760), brown
, BF
LINE (650, cy
)-(660, 760), brown
, BF
ss = (60 - sc) * 6 + 180
z$
= MID$("I II III IV V VI VII VIIIIX X XI XII ", (sc \
5 - 1) * 4 + 1, 4) x3 = x3 - (sc = 30) * 3 + (sc = 40) * 10 - (sc = 50) * 8
h = h + (h > 12) * 12 + m / 60
IF hand
= 1 THEN t
= h
* VAL("30"): c
= hcol: handlen
= 80 IF hand
= 2 THEN t
= m
* VAL("06"): c
= mcol: handlen
= 100 IF hand
= 3 THEN t
= s
* VAL("06"): c
= scol: handlen
= 120 x
= cx
+ handlen
* COS(_D2R(t
- 90)) y
= cy
+ handlen
* SIN(_D2R(t
- 90)) LINE (cx
+ b
, cy
)-(x
, y
), c
LINE (cx
, cy
+ b
)-(x
, y
), c