summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzlings/tikzlings-coatis.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/pgf/contrib/tikzlings/tikzlings-coatis.sty
Initial commit
Diffstat (limited to 'graphics/pgf/contrib/tikzlings/tikzlings-coatis.sty')
-rw-r--r--graphics/pgf/contrib/tikzlings/tikzlings-coatis.sty176
1 files changed, 176 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/tikzlings/tikzlings-coatis.sty b/graphics/pgf/contrib/tikzlings/tikzlings-coatis.sty
new file mode 100644
index 0000000000..1a262ca947
--- /dev/null
+++ b/graphics/pgf/contrib/tikzlings/tikzlings-coatis.sty
@@ -0,0 +1,176 @@
+% !TeX root = ./examples/coati.tex
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% The tikzlings-coatis package (part of the tikzlings collection)
+% A package to bring little coatis into tikz
+% Maintained by samcarter
+%
+% Project repository and bug tracker:
+% https://github.com/samcarter/tikzlings
+%
+% Released under the LaTeX Project Public License v1.3c or later
+% See http://www.latex-project.org/lppl.txt
+%
+% Version 0.2
+% April 7, 2019
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ProvidesPackage{tikzlings-coatis}
+ [2019/04/07 v0.2 Drawing coatis in TikZ]
+
+\RequirePackage{tikz}
+\RequirePackage{tikzlings-addons}
+
+\newcommand*{\coati}[1][]{%
+ \begin{scope}%
+ \tikzset{/coati/.cd,#1}%
+ \coati@draw%
+ \end{scope}%
+ \thing[#1]%
+}
+
+\newif\ifcoati@threeD
+\newif\ifcoati@sideward
+
+\tikzset{
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % Pass unknown keys on to tikz
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ /coati/.search also={/tikz,/pgf,/thing},
+ /coati/.cd,
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % body
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ body/.code = \def\coati@body{#1},
+ body = brown!50!darkgray!97!yellow,
+ rotatehead/.code = \def\coati@rotatehead{#1},
+ rotate head/.forward to = /coati/rotatehead,
+ rotatehead = 0,
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % options
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ 3D/.code = \coati@threeDtrue,
+ sideward/.code = \coati@sidewardtrue,
+}
+
+\def\coati@draw{%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% minimal bounding box size
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\path (-0.84,0.1) rectangle (1.63,2.26);
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% store the current scale factor
+% from https://github.com/samcarter/tikzlings/issues/3#issuecomment-461373494
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\pgfgettransformentries{\tmpscaleA}{\tmpscaleB}{\tmpscaleC}{\tmpscaleD}{\tmp}{\tmp}%
+\pgfmathsetmacro{\scalingfactor}{sqrt(abs(\tmpscaleA*\tmpscaleD-\tmpscaleB*\tmpscaleC))}%
+\pgfmathsetmacro{\xscalefactor}{\tmpscaleA}
+\pgfmathsetmacro{\yscalefactor}{\tmpscaleD}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% switch between 2D and 3D, from
+% https://chat.stackexchange.com/transcript/message/45991801#45991801
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifcoati@threeD
+ \def\coati@part@draw[##1]{\shade[ball color=##1]}
+\else
+ \def\coati@part@draw[##1]{\fill[##1]}
+\fi
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Body parts (center: x=0)
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\coati@part@draw[\coati@body!80!white] (0.255,0.2) ellipse (0.23 and 0.09);
+\coati@part@draw[\coati@body!80!white] (-0.255,0.2) ellipse (0.23 and 0.09);
+%
+% Tail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\coati@part@draw[\coati@body!50!darkgray] (0.3, 0.5) .. controls (0.55, 0.87) and (0.73, 1.50) .. (1.05, 1.65) .. controls (1.32, 1.77) and (1.76, 1.34) .. (1.56,1.33) .. controls (0.92, 2.03) and (0.86, 0.60) .. (0.5, 0.37) -- cycle;
+\begin{scope}
+ \clip (0.3, 0.5) .. controls (0.55, 0.87) and (0.73, 1.50) .. (1.05, 1.65) .. controls (1.32, 1.77) and (1.76, 1.34) .. (1.56,1.33) .. controls (0.92, 2.03) and (0.86, 0.60) .. (0.5, 0.37) -- cycle;
+ \coati@part@draw[\coati@body!45!white!95!orange,rotate around={-30:(0.8,1.15)}] (0.6,1.1) rectangle ++(0.4,0.1);
+ \coati@part@draw[\coati@body!45!white!95!orange,rotate around={-30:(0.9,1.35)}] (0.7,1.3) rectangle ++(0.4,0.1);
+ \coati@part@draw[\coati@body!45!white!95!orange,rotate around={-50:(1.0,1.5)}] (0.8,1.45) rectangle ++(0.4,0.1);
+ \coati@part@draw[\coati@body!45!white!95!orange,rotate around={-80:(1.2,1.6)}] (1.0,1.55) rectangle ++(0.4,0.1);
+ \coati@part@draw[\coati@body!45!white!95!orange,rotate around={-130:(1.5,1.5)}] (1.3,1.45) rectangle ++(0.4,0.1);
+ \coati@part@draw[\coati@body!45!white!95!orange,rotate around={-30:(0.55,0.65)}] (0.35,0.6) rectangle ++(0.4,0.1);
+\end{scope}
+%
+% Arms %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\coati@part@draw[\coati@body!80!white,rotate around={70:(-0.625,1)}] (-0.625,1) ellipse (0.42 and 0.13);
+\coati@part@draw[\coati@body!80!white,rotate around={-70:(0.625,1)}] (0.625,1) ellipse (0.42 and 0.13);
+%
+% Body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\coati@part@draw[\coati@body!50!darkgray] (0.595, 0.92) .. controls (0.595, 0.26) and (0.355, 0.18) .. (0, 0.18) .. controls (-0.355, 0.18) and (-0.595, 0.26) .. (-0.595, 0.92) .. controls (-0.605, 1.58) and (-0.335, 2.11) .. (0, 2.11) .. controls (0.335, 2.11) and (0.605, 1.58) .. (0.595, 0.92) -- cycle;
+%
+% Head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{scope}[rotate around={\coati@rotatehead:(0,1.68)}]
+%
+% Sidewards head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifcoati@sideward
+ %
+ % Left Ear %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \coati@part@draw[\coati@body!45!white!95!orange,rotate around={-16:(-0.212, 2.135)}] (-0.212, 2.135) ellipse (0.09 and 0.12);
+ \coati@part@draw[\coati@body!80!white,rotate around={-16:(-0.212, 2.135)}] (-0.212, 2.135) ellipse (0.065 and 0.09);
+ %
+ % Head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \coati@part@draw[\coati@body!45!white!95!orange] (0.4808, 1.7911) .. controls (0.5682, 1.2837) and (-0.3468, 1.3575) .. (-0.6360, 1.3679) .. controls (-0.7582, 1.4729) and (-0.5198, 1.7911) .. (-0.5198, 1.7911) .. controls (-0.3597, 2.2914) and (0.3207, 2.2914) .. (0.4808, 1.7911) -- cycle;
+ %
+ % Cheek %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \coati@part@draw[\coati@body!80!white] (0.30, 1.4552) .. controls (0.30, 1.4552) and (0.1016, 1.7565) .. (-0.0005, 1.7581) -- (-0.6360, 1.3679) .. controls (-0.3083, 1.3437) and (0.0283, 1.332) .. (0.30, 1.4552) -- cycle;
+ \coati@part@draw[\coati@body!80!white] (-0.4166, 1.9824) .. controls (-0.4166, 1.9824) and (-0.2413, 1.9758) .. (-0.2226, 1.9112) -- (-0.6875, 1.4906) .. controls (-0.6875, 1.4906) and (-0.5712, 1.7549) .. (-0.4166, 1.9824) -- cycle;
+ % Nose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \coati@part@draw[\coati@body!50!black] (-0.605, 1.453) circle (0.09);
+ %
+ % Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \coati@part@draw[\coati@body!50!black] (0.007, 1.624) ellipse (0.04 and 0.06);
+ \coati@part@draw[\coati@body!50!black] (-0.38, 1.865) ellipse (0.035 and 0.055);
+ %
+ % Right Ear %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \coati@part@draw[\coati@body!45!white!95!orange,rotate around={-16:(0.417, 1.875)}] (0.417, 1.875) ellipse (0.1 and 0.14);
+ \coati@part@draw[\coati@body!80!white,rotate around={-16:(0.417, 1.875)}] (0.417, 1.875) ellipse (0.07 and 0.10);
+%
+% Normal Head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\else
+ %
+ % Head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \coati@part@draw[\coati@body!45!white!95!orange] (0.5, 1.8) .. controls (0.5, 1.58) and (0.2, 1.25) .. (0, 1.16) .. controls (-0.2, 1.25) and (-0.5, 1.58) .. (-0.5, 1.8) .. controls (-0.34, 2.3) and (0.34, 2.3) .. (0.5, 1.8) -- cycle;
+ %
+ % Cheeks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \coati@part@draw[\coati@body!80!white] (-0.4935, 1.7443) .. controls (-0.4935, 1.7443) and (-0.1917, 1.7798) .. (-0.1371, 1.7333) .. controls (-0.07, 1.2) and (-0.07, 1.2) .. (-0.07, 1.2) .. controls (-0.259, 1.3169) and (-0.46, 1.5665) .. (-0.4935, 1.7443) -- cycle;
+ \coati@part@draw[\coati@body!80!white] (0.4935, 1.7443) .. controls (0.4935, 1.7443) and (0.1917, 1.7798) .. (0.1371, 1.7333) .. controls (0.07, 1.2) and (0.07, 1.2) .. (0.07, 1.2) .. controls (0.259, 1.3169) and (0.46, 1.5665) .. (0.4935, 1.7443) -- cycle;
+ %
+ % Nose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \coati@part@draw[\coati@body!50!black] (0, 1.248) circle (0.09);
+ %
+ % Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \coati@part@draw[\coati@body!50!black] (0.23, 1.62) circle (0.05);
+ \coati@part@draw[\coati@body!50!black] (-0.23, 1.62) circle (0.05);
+ %
+ % Ears %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \coati@part@draw[\coati@body!45!white!95!orange] (0.44, 2.02) circle (0.12);
+ \coati@part@draw[\coati@body!80!white] (0.44, 2.02) circle (0.09);
+ \coati@part@draw[\coati@body!45!white!95!orange] (-0.44, 2.02) circle (0.12);
+ \coati@part@draw[\coati@body!80!white] (-0.44, 2.02) circle (0.09);
+ %
+\fi
+\end{scope}
+%
+}
+