summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzlings/tikzlings-moles.sty
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/tikzlings/tikzlings-moles.sty')
-rw-r--r--graphics/pgf/contrib/tikzlings/tikzlings-moles.sty73
1 files changed, 50 insertions, 23 deletions
diff --git a/graphics/pgf/contrib/tikzlings/tikzlings-moles.sty b/graphics/pgf/contrib/tikzlings/tikzlings-moles.sty
index b59e022fd5..392de7a763 100644
--- a/graphics/pgf/contrib/tikzlings/tikzlings-moles.sty
+++ b/graphics/pgf/contrib/tikzlings/tikzlings-moles.sty
@@ -1,8 +1,8 @@
% !TeX root = ./examples/mole.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% The tikzlings-moles package (part of the tikzlings collection)
-% A package to bring little moles into tikz
+% This package is part of the TikZlings package
+% A package to bring cute little animals and other beings into tikz
% Maintained by samcarter
%
% Project repository and bug tracker:
@@ -11,12 +11,8 @@
% 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-moles}
- [2019/04/07 v0.2 Drawing moles in TikZ]
+\ProvidesPackage{tikzlings-moles}[2020/04/22 version v0.3 Drawing moles in TikZ]
\RequirePackage{tikz}
\RequirePackage{tikzlings-addons}
@@ -27,9 +23,14 @@
\mole@draw%
\end{scope}%
\thing[#1]%
+ % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \csname moleshookforeground\endcsname
+ \csname tikzlinghookforeground\endcsname
+ %
}
\newif\ifmole@threeD
+\newif\ifmole@back
\tikzset{
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -57,7 +58,8 @@
% options
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- 3D/.code = \mole@threeDtrue,
+ 3D/.code = \mole@threeDtrue,
+ back/.code = \mole@backtrue,
}
\def\mole@draw{%
@@ -75,7 +77,7 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pgfgettransformentries{\tmpscaleA}{\tmpscaleB}{\tmpscaleC}{\tmpscaleD}{\tmp}{\tmp}%
-\pgfmathsetmacro{\scalingfactor}{sqrt(abs(\tmpscaleA*\tmpscaleD-\tmpscaleB*\tmpscaleC))}%
+\pgfmathsetmacro{\scalingfactor}{sqrt(abs(\tmpscaleA*\tmpscaleD-\tmpscaleB*\tmpscaleC))*sqrt(abs((\pgf@xx/1cm)*(\pgf@yy/1cm)-(\pgf@xy/1cm)*(\pgf@yx/1cm)))}%
\pgfmathsetmacro{\xscalefactor}{\tmpscaleA}
\pgfmathsetmacro{\yscalefactor}{\tmpscaleD}
%
@@ -97,12 +99,18 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname moleshookbackground\endcsname
+\csname tikzlinghookbackground\endcsname
+%
% Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\mole@part@draw[\mole@feet] (-0.255,0.2) ellipse (0.23 and 0.09);
-\mole@part@draw[\mole@feet] (0.255,0.2) ellipse (0.23 and 0.09);
+\mole@part@draw[\mole@feet] (-0.255,0.2) ellipse[x radius=0.23, y radius=0.09];
+\mole@part@draw[\mole@feet] (0.255,0.2) ellipse[x radius=0.23, y radius=0.09];
%
% Tail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\mole@part@draw[\mole@body] (0.885, 0.67) .. controls (0.865, 0.4) and (0.345, 0.24) .. (0.335, 0.44) .. controls (0.315, 0.56) and (0.445, 0.51) .. (0.575, 0.53) .. controls (0.695, 0.54) and (0.885, 0.72) .. (0.885, 0.67) -- cycle;
+\ifmole@back\else
+ \mole@part@draw[\mole@body] (0.8856, 0.6504) .. controls (0.8656, 0.3803) and (0.0267, 0.2202) .. (0.0167, 0.4203) .. controls (-0.0033, 0.5404) and (0.1104, 0.4397) .. (0.3951, 0.4803) .. controls (0.6557, 0.5175) and (0.8856, 0.7005) .. (0.8856, 0.6504);
+\fi
%
% Hair %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mole@part@draw[\mole@body] (-0.09, 2.06) .. controls (-0.09, 2.06) and (-0.13, 2.25) .. (-0.07, 2.27) .. controls (-0.09, 2.13) and (0.04, 2.08) .. (0.04, 2.08) .. controls (0.04, 2.08) and (0.02, 2.20) .. (0.06, 2.21) .. controls (0.06, 2.11) and (0.13, 2.08) .. (0.13, 2.08) -- cycle;
@@ -110,35 +118,54 @@
% Body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mole@part@draw[\mole@body] (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;
%
+% Tail if back %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifmole@back
+ \mole@part@draw[\mole@body] (0.8856, 0.6504) .. controls (0.8656, 0.3803) and (0.0267, 0.2202) .. (0.0167, 0.4203) .. controls (-0.0033, 0.5404) and (0.1104, 0.4397) .. (0.3951, 0.4803) .. controls (0.6557, 0.5175) and (0.8856, 0.7005) .. (0.8856, 0.6504) -- cycle;
+\fi
+%
% Belly %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\mole@part@draw[\mole@body!50!white] (0.425, 0.71) .. controls (0.425, 0.41) and (0.245, 0.37) .. (0, 0.37) .. controls (-0.245, 0.37) and (-0.425, 0.41) .. (-0.425, 0.71) .. controls (-0.425, 1.01) and (-0.225, 1.26) .. (0, 1.26) .. controls (0.225, 1.26) and (0.425, 1.01) .. (0.425, 0.71) -- cycle;
+\ifmole@back\else
+ \mole@part@draw[\mole@body!50!white] (0.425, 0.71) .. controls (0.425, 0.41) and (0.245, 0.37) .. (0, 0.37) .. controls (-0.245, 0.37) and (-0.425, 0.41) .. (-0.425, 0.71) .. controls (-0.425, 1.01) and (-0.225, 1.26) .. (0, 1.26) .. controls (0.225, 1.26) and (0.425, 1.01) .. (0.425, 0.71) -- cycle;
+\fi
+%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname moleshookbelly\endcsname
+\csname tikzlinghookbelly\endcsname
+%
+% Show details only from the front %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifmole@back\else
%
% Arms %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\mole@part@draw[\mole@body,rotate around={70:(0.37,0.86)}] (0.37,0.86) ellipse (0.27 and 0.13);
-\mole@part@draw[\mole@body,rotate around={-70:(-0.37,0.86)}] (-0.37,0.86) ellipse (0.27 and 0.13);
+\mole@part@draw[\mole@body] (0.37,0.86) ellipse[x radius=0.27, y radius=0.13, rotate=70];
+\mole@part@draw[\mole@body] (-0.37,0.86) ellipse[x radius=0.27, y radius=0.13, rotate=-70];
%
% Hands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fill[white] (-0.37,0.6) -- (-0.32,0.53) -- (-0.3,0.6) -- (-0.23,0.55) -- (-0.23,0.64) -- (-0.16,0.59) -- (-0.18,0.67) -- cycle;
\fill[white] (0.37,0.6) -- (0.32,0.53) -- (0.3,0.6) -- (0.23,0.55) -- (0.23,0.64) -- (0.16,0.59) -- (0.18,0.67) -- cycle;
-\mole@part@draw[\mole@hands,rotate around={70:(0.285,0.65)}] (0.285,0.65) ellipse (0.08 and 0.13);
-\mole@part@draw[\mole@hands,rotate around={-70:(-0.285,0.65)}] (-0.285,0.65) ellipse (0.08 and 0.13);
+\mole@part@draw[\mole@hands] (0.285,0.65) ellipse[x radius=0.08, y radius=0.13, rotate=70];
+\mole@part@draw[\mole@hands] (-0.285,0.65) ellipse[x radius=0.08, y radius=0.13, rotate=-70];
%
% Muzzle %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mole@part@draw[\mole@muzzle] ( 0.22, 1.46) .. controls ( 0.22, 1.50) and ( 0.22, 1.53) .. ( 0.17, 1.56) .. controls ( 0.11, 1.58) and ( 0.05, 1.66) .. ( 0.00, 1.66) .. controls (-0.05, 1.66) and (-0.11, 1.58) .. (-0.17, 1.56) .. controls (-0.22, 1.53) and (-0.22, 1.50) .. (-0.22, 1.46) .. controls (-0.22, 1.39) and (-0.14, 1.33) .. ( 0.00, 1.33) .. controls ( 0.14, 1.33) and ( 0.22, 1.39) .. ( 0.22, 1.46) -- cycle;
%
% Nose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\mole@part@draw[\mole@body!60!black] (0,1.67) circle (0.055);
+\mole@part@draw[\mole@body!60!black] (0,1.67) circle[radius=0.055];
%
% Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifmole@threeD
- \fill[\mole@body!60!black,rotate around={-15:(-0.165,1.79)}] (-0.165,1.79) ellipse (0.055 and 0.015);
- \fill[\mole@body!30!black,rotate around={15:(0.165,1.79)}] (0.165,1.79) ellipse (0.055 and 0.015);
+ \fill[\mole@body!60!black] (-0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=-15];
+ \fill[\mole@body!30!black] (0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=15];
\else
- \fill[\mole@body!60!black,rotate around={-15:(-0.165,1.79)}] (-0.165,1.79) ellipse (0.055 and 0.015);
- \fill[\mole@body!60!black,rotate around={15:(0.165,1.79)}] (0.165,1.79) ellipse (0.055 and 0.015);
+ \fill[\mole@body!60!black] (-0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=-15];
+ \fill[\mole@body!60!black] (0.165,1.79) ellipse[x radius=0.055, y radius=0.015, rotate=15];
\fi
%
% Mouth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw[\mole@body!60!black, line width=\scalingfactor*0.4pt] (0.145,1.51) arc [start angle=-20, end angle=-160, radius=0.16] ;
%
-} \ No newline at end of file
+\fi
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname moleshookbody\endcsname
+\csname tikzlinghookbody\endcsname
+%
+}