summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzlings/tikzlings-cats.sty
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/tikzlings/tikzlings-cats.sty')
-rw-r--r--graphics/pgf/contrib/tikzlings/tikzlings-cats.sty67
1 files changed, 51 insertions, 16 deletions
diff --git a/graphics/pgf/contrib/tikzlings/tikzlings-cats.sty b/graphics/pgf/contrib/tikzlings/tikzlings-cats.sty
index 40787eabe5..9ece08d4f2 100644
--- a/graphics/pgf/contrib/tikzlings/tikzlings-cats.sty
+++ b/graphics/pgf/contrib/tikzlings/tikzlings-cats.sty
@@ -1,8 +1,8 @@
% !TeX root = ./examples/cat.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% The tikzlings-cats package (part of the tikzlings collection)
-% A package to bring little cats 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-cats}
- [2019/04/07 v0.2 Drawing cats in TikZ]
+\ProvidesPackage{tikzlings-cats}[2020/04/22 version v0.3 Drawing cats in TikZ]
\RequirePackage{tikz}
\RequirePackage{tikzlings-addons}
@@ -41,19 +37,23 @@
\pgfmathparse{int(random(0,1))}
\let\cat@random=\pgfmathresult
\ifnum\cat@random=1
- \cat@tombstone%
+ \cat@tombstone%
\else
- \cat@draw%
+ \cat@draw%
\fi
\else
- \cat@draw%
+ \cat@draw%
\fi
\end{scope}%
\thing[#1]%
+ % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \csname cathookforeground\endcsname
+ \csname tikzlinghookforeground\endcsname
}
\newif\ifcat@threeD
\newif\ifcat@schroedinger
+\newif\ifcat@back
\tikzset{
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -94,6 +94,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3D/.code = \cat@threeDtrue,
schroedinger/.code = \cat@schroedingertrue,
+ back/.code = \cat@backtrue,
}
\def\cat@draw{%
@@ -112,7 +113,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}
%
@@ -134,14 +135,28 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname cathookbackground\endcsname
+\csname tikzlinghookbackground\endcsname
+%
% Tail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{pgfinterruptboundingbox}
\cat@part@draw[\cat@body] (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;
\end{pgfinterruptboundingbox}
%
+% Feet if back %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifcat@back
+ \cat@part@draw[\cat@paws] (-0.255,0.3) circle[radius=0.18];
+ \cat@part@draw[\cat@paws] (0.255,0.3) circle[radius=0.18];
+\fi
+%
% Body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cat@part@draw[\cat@body] (0.5462, 0.7155) .. controls (0.5462, 0.1823) and (0.3259, 0.17) .. (0, 0.17) .. controls (-0.3259, 0.17) and (-0.5462, 0.1823) .. (-0.5462, 0.7155) .. controls (-0.5554, 1.2487) and (-0.3075, 1.6768) .. (0, 1.6768) .. controls (0.3075, 1.6768) and (0.5554, 1.2487) .. (0.5462, 0.7155) -- cycle;
%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname cathookbelly\endcsname
+\csname tikzlinghookbelly\endcsname
+%
% Ears %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cat@part@draw[\cat@body]
(0.12, 2.0392) .. controls (0.16, 2.1584) and (0.37, 2.22) .. (0.37, 2.20) .. controls (0.37, 2.2) and (0.39, 1.9) .. (0.2721, 1.9) .. controls (0.1891, 1.88) and (0.12, 1.88) .. (0.12, 2.0392) -- cycle;
@@ -149,7 +164,10 @@
(-0.12, 2.0392) .. controls (-0.16, 2.1584) and (-0.37, 2.22) .. (-0.37, 2.20) .. controls (-0.37, 2.2) and (-0.39, 1.9) .. (-0.2721, 1.9) .. controls (-0.1891, 1.88) and (-0.12, 1.88) .. (-0.12, 2.0392) -- cycle;
%
% Head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\cat@part@draw[\cat@body] (0,1.64) circle (0.44);
+\cat@part@draw[\cat@body] (0,1.64) circle[radius=0.44];
+%
+% Show details only from the front %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifcat@back\else
%
% Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cat@part@draw[\cat@eyes] (-0.1014, 1.7491) .. controls (-0.1014, 1.7491) and (-0.1451, 1.7171) .. (-0.1841, 1.7284) .. controls (-0.2231, 1.7397) and (-0.2427, 1.79) .. (-0.2427, 1.79) .. controls (-0.2427, 1.79) and (-0.1992, 1.8221) .. (-0.1602, 1.8108) .. controls (-0.1212, 1.7995) and (-0.1014, 1.7491) .. (-0.1014, 1.7491) -- cycle;
@@ -182,9 +200,14 @@
\fill[\cat@whiskers] (-0.0671, 1.6243) .. controls (-0.1414, 1.6725) and (-0.2182, 1.6964) .. (-0.2925, 1.6482) -- (-0.2925, 1.6582) .. controls (-0.2179, 1.7066) and (-0.1417, 1.6727) .. (-0.0671, 1.6243) -- cycle;
%
% Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\cat@part@draw[\cat@paws] (-0.255,0.3) circle (0.18);
-\cat@part@draw[\cat@paws] (0.255,0.3) circle (0.18);
+\cat@part@draw[\cat@paws] (-0.255,0.3) circle[radius=0.18];
+\cat@part@draw[\cat@paws] (0.255,0.3) circle[radius=0.18];
%
+\fi
+%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname cathookbody\endcsname
+\csname tikzlinghookbody\endcsname
}
\def\cat@tombstone{%
@@ -213,11 +236,19 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname cathookbackground\endcsname
+\csname tikzlinghookbackground\endcsname
+%
% Stone %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fill[gray] (-0.55,0.4) rectangle (0.55,1.5);
-\fill[gray] (0,1.5) circle (0.55);
+\fill[gray] (0,1.5) circle[radius=0.55];
\node[scale=\scalingfactor] at (0,1.3) {R.I.P.};
%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname cathookbelly\endcsname
+\csname tikzlinghookbelly\endcsname
+%
% soil %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fill[brown!65!black] (1,0.15) arc [start angle=50, end angle=130, radius=1.56] -- cycle;
%
@@ -226,7 +257,11 @@
\fill[green!50!brown] (-0.1377, 0.7384) .. controls (-0.1775, 0.5828) and (-0.1479, 0.4649) .. (0.0072, 0.4246) .. controls (0.0570, 0.5636) and (-0.1529, 0.6447) .. (-0.1377, 0.7384) -- cycle;
\fill[green!50!brown] (0.1527, 0.7334) .. controls (0.1925, 0.5778) and (0.1629, 0.4599) .. (0.0178, 0.4196) .. controls (-0.0420, 0.5586) and (0.1679, 0.6397) .. (0.1527, 0.7334) -- cycle;
\foreach \i in {0,51.42857,...,359}{
- \fill[yellow!50!white,rotate around={\i:(-0.0865, 0.8219)}] (-0.087, 0.822) .. controls (-0.087, 0.822) and (-0.1635, 0.6638) .. (-0.0818, 0.6653) .. controls (-0.0066, 0.6646) and (-0.087, 0.822) .. (-0.087, 0.822) -- cycle;
+ \fill[yellow!50!white,rotate around={\i:(-0.0865, 0.8219)}] (-0.087, 0.822) .. controls (-0.087, 0.822) and (-0.1635, 0.6638) .. (-0.0818, 0.6653) .. controls (-0.0066, 0.6646) and (-0.087, 0.822) .. (-0.087, 0.822) -- cycle;
}
%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname cathookbody\endcsname
+\csname tikzlinghookbody\endcsname
+%
}