From fe7f15a5ef216a96a4c021e79ad4ece05d2e38ca Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sun, 12 Jul 2020 14:49:25 +0100 Subject: [PATCH] Adds a clock --- clock.tex | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 clock.tex diff --git a/clock.tex b/clock.tex new file mode 100644 index 0000000..2129695 --- /dev/null +++ b/clock.tex @@ -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}