Hi,
some modest fun has been made out of this blogClock
http://blog.wolfram.com/2007/07/09/always-the-right-time-for-\
mathematica/#more-247
Clear[makeHand, makeTicks, hB (* heartBeat *)]
makeHand[f1_, b1_, fw_, bw_] :=
Polygon[{{-bw, -b1}, {bw, -b1}, {fw, f1}, {0, f1 + 8 fw}, {-fw,
f1}}/9];
makeTicks[s_Integer] :=
Table[Line[{.9 {Cos[o], Sin[o]}, .95 {Cos[o], Sin[o]}}], {o, 0,
2 \[Pi], 2 \[Pi]/s}];
hB[s_?NumericQ] := Rule[UpdateInterval, s];
Clear[blogClock, hourHand, minuteHand, secondHand, minuteTicks, \
hourTicks, hourNumbers, p]
(* elements *)
hourHand = makeHand[5, 5/3, .1, .3];
minuteHand = makeHand[7, 7/3, .1, .3];
secondHand = {Red, EdgeForm[Black], makeHand[7, 7/3, .1/2, .3/2]};
minuteTicks = {Thickness[0.003], makeTicks[60]};
hourTicks = {Thickness[0.01], makeTicks[12]};
hourNumbers =
Style[Table[
Text[o, .77 {Cos[-o \[Pi]/6 + \[Pi]/2],
Sin[o \[Pi]/6 + \[Pi]/2]}], {o, 1, 12}],
FontFamily -> "Helvetica", FontSize -> 36];
p = {0, 0};
(* module *)
blogClock::nomode = "Clock operation mode `1` unknown.";
blogClock[mode_Integer: 0] :=
Module[{sH, q = (-1)^mode},
Which[
0 <= mode <= 1, (* 0: normal clock operation, 1:
secondHand turns back *)
Graphics[{
{Thickness[.03], Circle[]}, (* Rim *)
minuteTicks, hourTicks, hourNumbers,
Rotate[hourHand,
Dynamic[Refresh[-30 Mod[AbsoluteTime[]/3600, 60] \[Degree],
hB[60]]], p],
Rotate[minuteHand,
Dynamic[Refresh[-6 Mod[AbsoluteTime[]/60, 60] \[Degree],
hB[1]]], p],
Rotate[secondHand,
Dynamic[Refresh[-6 q Mod[AbsoluteTime[], 60] \[Degree],
hB[1/20]]], p]
}],
2 <= mode <= 3, (* secondHand fixed, all others 2: turn, 3:
turn back *)
sH = Rotate[secondHand, -6 Mod[AbsoluteTime[], 60] \[Degree], p];
Graphics[{
{Thickness[.03], Circle[]}, (* Rim *)
Sequence[Dynamic[Refresh[
{Rotate[
hourHand, -30 Mod[AbsoluteTime[]/3600, 60] \[Degree] +
6 q Mod[AbsoluteTime[], 60] \[Degree], p],
Rotate[
minuteHand, -6 Mod[AbsoluteTime[]/60, 60] \[Degree] +
6 q Mod[AbsoluteTime[], 60] \[Degree], p],
Rotate[minuteTicks, 6 q Mod[AbsoluteTime[], 60] \[Degree],
p],
Rotate[hourTicks, 6 q Mod[AbsoluteTime[], 60] \[Degree], p],
Rotate[hourNumbers, 6 q Mod[AbsoluteTime[], 60] \[Degree],
p], sH
}, hB[1]]]]}
],
True, Message[blogClock::nomode, mode]; Return[$Failed]
]
]
try blogClock[j] with j in {0, 1, 2, 3}. Please note that blogClock[2]
is still a correct performing clock :-)
Best regards
Udo.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/