Skip to content

Instantly share code, notes, and snippets.

@jazzyjackson
Last active August 19, 2020 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jazzyjackson/b718f67c3936be72cdc4b3dba938ef7d to your computer and use it in GitHub Desktop.
Save jazzyjackson/b718f67c3936be72cdc4b3dba938ef7d to your computer and use it in GitHub Desktop.
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