Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Manipulate[Module[{
time = Time2Rotation[seconds],
origin = {0, 0},
minutenorm = 6, (* length of minute hand the long side of the matrix *)
hournorm = 4, (* the length of the hour hand the short side of the matrix *)
minutehand, hourhand,
xbasis, ybasis, pts
},
xbasis = {Cos[time["minutespin"]], Sin[time["minutespin"]]};
ybasis = {Cos[time["hourspin"]], Sin[time["hourspin"]]};
pts = Dot[
Flatten[Table[{x, y}, {x, 0, minutenorm - 1}, {y, 0,
hournorm - 1}], 1], {xbasis, ybasis}];
minutehand = {minutenorm, 0}.{xbasis, {0, 1}};
hourhand = {hournorm, 0}.{ybasis, {0, 1}};
Graphics[{
{PointSize[0.012], Point[pts]},
{Opacity[0.4], Circle[origin, #] & /@ Union[ Norm /@ pts]},
{White, EdgeForm[Black],
Disk[ minutehand, 0.65],
Disk[ hourhand, 0.65]
},
Style[{
Rotate[
Inset[time["hour"], hourhand, {0, 0}],
If[-Pi < time["hourspin"] < 0,
time["hourspin"] + Pi/2,
time["hourspin"] - Pi/2
]
],
Rotate[
Inset[time["minute"], minutehand, {0, 0}],
If[-Pi < time["minutespin"] < 0,
time["minutespin"] + Pi/2,
time["minutespin"] - Pi/2
]
]
}, 20, Bold, FontFamily -> "Century Schoolbook"]
}, PlotRange -> minutenorm + hournorm, ImageSize -> Large]
],
{seconds, 0, 43200 , 4}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment