Adds a clock
This commit is contained in:
parent
d60a66ef70
commit
fe7f15a5ef
1 changed files with 44 additions and 0 deletions
44
clock.tex
Normal file
44
clock.tex
Normal file
|
@ -0,0 +1,44 @@
|
|||
\documentclass[tikz]{standalone}
|
||||
\usepackage{datetime}
|
||||
\begin{document}
|
||||
|
||||
\def\hours{\number\currenthour}
|
||||
\def\minutes{\number\currentminute}
|
||||
\def\seconds{\number\currentsecond}
|
||||
|
||||
|
||||
\begin{tikzpicture}
|
||||
%\node {\Huge \number\currenthour};
|
||||
\draw[line width=0.2cm] (0,0) circle (5.1cm);
|
||||
% Minutes
|
||||
\foreach \i in {1,2,...,60}{
|
||||
\def\angle{\i*6}
|
||||
\draw[thin] (\angle:5cm) -- (\angle:4.9cm);
|
||||
}
|
||||
|
||||
% 5 minutes
|
||||
\foreach \i in {1,2,...,12}{
|
||||
\def\angle{\i*-30+90}
|
||||
\draw[thin] (\angle:5cm) -- (\angle:4.5cm);
|
||||
\node at (\angle:4cm) {\Huge\i};
|
||||
};
|
||||
|
||||
% Hour hand
|
||||
\def\angle{\hours*-30 + \minutes*-0.5 + \seconds*-0.008333 +90}
|
||||
\draw[line width=0.1cm] (0,0) -- (\angle:2.5cm);
|
||||
|
||||
% Minute hand
|
||||
\def\angle{\minutes*-6 + \seconds*-0.1 +90}
|
||||
\draw[line width=0.05cm] (0,0) -- (\angle:4cm);
|
||||
|
||||
% Second hand
|
||||
\def\angle{\seconds*-6+90}
|
||||
\draw[very thick,color=red] (\angle:-1cm) -- (\angle:4.5cm);
|
||||
\draw[line width=0.1cm,color=red] (\angle:-1cm) -- (\angle:-0.25cm);
|
||||
|
||||
|
||||
% Center dot
|
||||
\draw[fill=black] (0,0) circle (0.1cm);
|
||||
\end{tikzpicture}
|
||||
|
||||
\end{document}
|
Loading…
Add table
Add a link
Reference in a new issue