summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzlings/tikzlings-sloths.sty
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/tikzlings/tikzlings-sloths.sty')
-rw-r--r--graphics/pgf/contrib/tikzlings/tikzlings-sloths.sty133
1 files changed, 86 insertions, 47 deletions
diff --git a/graphics/pgf/contrib/tikzlings/tikzlings-sloths.sty b/graphics/pgf/contrib/tikzlings/tikzlings-sloths.sty
index 7d774bec90..bdc62e573a 100644
--- a/graphics/pgf/contrib/tikzlings/tikzlings-sloths.sty
+++ b/graphics/pgf/contrib/tikzlings/tikzlings-sloths.sty
@@ -1,8 +1,8 @@
% !TeX root = ./examples/sloth.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% The tikzlings-sloths package (part of the tikzlings collection)
-% A package to bring little sloths 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-sloths}
- [2019/04/07 v0.2 Drawing sloths in TikZ]
+\ProvidesPackage{tikzlings-sloths}[2020/04/22 version v0.3 Drawing sloths in TikZ]
\RequirePackage{tikz}
\RequirePackage{tikzlings-addons}
@@ -29,10 +25,15 @@
\sloth@draw%
\end{scope}%
\thing[#1]%
+ % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \csname slothhookforeground\endcsname
+ \csname tikzlinghookforeground\endcsname
+ %
}
\newif\ifsloth@sleeping
\newif\ifsloth@threeD
+\newif\ifsloth@back
\tikzset{
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -56,6 +57,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
sleeping/.code = \sloth@sleepingtrue,
3D/.code = \sloth@threeDtrue,
+ back/.code = \sloth@backtrue,
}
\def\sloth@draw{%
@@ -73,7 +75,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}
%
@@ -95,16 +97,54 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname slothhookbackground\endcsname
+\csname tikzlinghookbackground\endcsname
+%
+% Arms if back %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifsloth@back
+ \sloth@part@draw[\sloth@body] (0.53,0.95) ellipse[x radius=0.1, y radius=0.27, rotate=10];
+ \sloth@part@draw[\sloth@body] (-0.53,0.95) ellipse[x radius=0.1, y radius=0.27, rotate=-10];
+\fi
+%
+% Feet if back%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifsloth@back
+ \fill[\sloth@body!50!black] (-0.125,0.265) ellipse[x radius=0.07, y radius=0.019,rotate=-10];
+ \fill[\sloth@body!50!black] (-0.14,0.21) ellipse[x radius=0.07, y radius=0.017, rotate=-16];
+ \fill[\sloth@body!50!black] (-0.16,0.165) ellipse[x radius=0.07, y radius=0.015, rotate=-22];
+ \fill[\sloth@body!50!black] (0.125,0.265) ellipse[x radius=0.07, y radius=0.019, rotate=10];
+ \fill[\sloth@body!50!black] (0.14,0.21) ellipse[x radius=0.07, y radius=0.017, rotate=16];
+ \fill[\sloth@body!50!black] (0.16,0.165) ellipse[x radius=0.07, y radius=0.015, rotate=22];
+ \sloth@part@draw[\sloth@body] (0.33,0.31) ellipse[x radius=0.25, y radius=0.13, rotate=25];
+ \sloth@part@draw[\sloth@body] (-0.33,0.31) ellipse[x radius=0.25, y radius=0.13, rotate=-25];
+\fi
+%
% Body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sloth@part@draw[\sloth@body!85!black] (0.53,0.85) .. controls (0.53,0.29) and (0.32,0.22) .. (0,0.22) .. controls (-0.32,0.22) and (-0.53,0.29) ..
(-0.53,0.85) .. controls (-0.53,1.41) and (-0.32,1.87) .. (0,1.87) .. controls (0.33,1.87) and (0.53,1.41) .. (0.53,0.85) -- cycle;
%
+% Belly %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifsloth@back\else
+ \sloth@part@draw[\sloth@body!70!white] (0.36, 0.74) .. controls (0.36, 0.49) and (0.22, 0.41) .. (0, 0.41) .. controls (-0.22, 0.41) and (-0.36, 0.49) .. (-0.36, 0.74) .. controls (-0.36, 1) and (-0.22, 1.16) .. (0, 1.16) .. controls (0.22, 1.16) and (0.36, 1) .. (0.36, 0.74) -- cycle;
+\fi
+%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname slothhookbelly\endcsname
+\csname tikzlinghookbelly\endcsname
+%
+% Hair %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\sloth@part@draw[\sloth@body] (-0.1128,2.0724) .. controls (-0.1128,2.0724) and (-0.1499,2.2329) .. (-0.0972,2.2525) .. controls (-0.1082,2.1318) and (-0.0047,2.0839) .. (-0.0047,2.0839) .. controls (-0.0047,2.0839) and (-0.0219,2.1866) .. (0.0145,2.1933) .. controls (0.0142,2.1159) and (0.0770,2.0884) .. (0.0770,2.0884) -- cycle;
+%
% Head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sloth@part@draw[\sloth@body]
( 0.50,1.67) .. controls ( 0.50,1.91) and ( 0.27,2.10) ..
( 0.00,2.10) .. controls (-0.27,2.10) and (-0.50,1.91) .. (-0.50,1.67) .. controls (-0.50,1.43) and (-0.33,1.28) ..
( 0.00,1.28) .. controls ( 0.33,1.28) and ( 0.50,1.43) ..
( 0.50,1.67) -- cycle;
+%
+% Show details only from the front %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifsloth@back\else
+%
\sloth@part@draw[\sloth@body!50!white] ( 0.40,1.67) .. controls ( 0.40,1.90) and ( 0.12,2.09) .. ( 0.00,1.93) .. controls (-0.12,2.09) and (-0.40,1.90) .. (-0.40,1.67) .. controls (-0.40,1.45) and (-0.25,1.38) .. ( 0.00,1.38) .. controls ( 0.25,1.38) and ( 0.40,1.45) .. ( 0.40,1.67) -- cycle;
%
% behind the eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -113,59 +153,58 @@
%
% Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifsloth@sleeping
- \fill[\sloth@body!50!white] (0.237, 1.743) .. controls (0.237, 1.712) and (0.157, 1.712) .. (0.157, 1.743) .. controls (0.157, 1.802) and (0.237, 1.802) .. (0.237, 1.743) -- cycle;
- \fill[\sloth@body!50!white] (-0.237, 1.743) .. controls (-0.237, 1.712) and (-0.157, 1.712) .. (-0.157, 1.743) .. controls (-0.157, 1.802) and (-0.237, 1.802) .. (-0.237, 1.743) -- cycle;
- %
- \fill[\sloth@body!50!white] (0.195, 1.705) rectangle ++(0.005, 0.02);
- \fill[\sloth@body!50!white,rotate around={22:(0.195, 1.76)}] (0.195, 1.705) rectangle ++(0.005, 0.02);
- \fill[\sloth@body!50!white,rotate around={44:(0.195, 1.76)}] (0.195, 1.701) rectangle ++(0.005, 0.02);
- \fill[\sloth@body!50!white,rotate around={-22:(0.195, 1.76)}] (0.195, 1.705) rectangle ++(0.005, 0.02);
- \fill[\sloth@body!50!white,rotate around={-44:(0.195, 1.76)}] (0.195, 1.705) rectangle ++(0.005, 0.02);
- %
- \fill[\sloth@body!50!white] (-0.195, 1.705) rectangle ++(0.005, 0.02);
- \fill[\sloth@body!50!white,rotate around={22:(-0.195, 1.76)}] (-0.195, 1.705) rectangle ++(0.005, 0.02);
- \fill[\sloth@body!50!white,rotate around={44:(-0.195, 1.76)}] (-0.195, 1.705) rectangle ++(0.005, 0.02);
- \fill[\sloth@body!50!white,rotate around={-22:(-0.195, 1.76)}] (-0.195, 1.705) rectangle ++(0.005, 0.02);
- \fill[\sloth@body!50!white,rotate around={-44:(-0.195, 1.76)}] (-0.195, 1.701) rectangle ++(0.005, 0.02);
+ \fill[\sloth@body!50!white] (0.237, 1.743) .. controls (0.237, 1.712) and (0.157, 1.712) .. (0.157, 1.743) .. controls (0.157, 1.802) and (0.237, 1.802) .. (0.237, 1.743) -- cycle;
+ \fill[\sloth@body!50!white] (-0.237, 1.743) .. controls (-0.237, 1.712) and (-0.157, 1.712) .. (-0.157, 1.743) .. controls (-0.157, 1.802) and (-0.237, 1.802) .. (-0.237, 1.743) -- cycle;
+ %
+ \fill[\sloth@body!50!white] (0.195, 1.705) rectangle ++(0.005, 0.02);
+ \fill[\sloth@body!50!white,rotate around={22:(0.195, 1.76)}] (0.195, 1.705) rectangle ++(0.005, 0.02);
+ \fill[\sloth@body!50!white,rotate around={44:(0.195, 1.76)}] (0.195, 1.701) rectangle ++(0.005, 0.02);
+ \fill[\sloth@body!50!white,rotate around={-22:(0.195, 1.76)}] (0.195, 1.705) rectangle ++(0.005, 0.02);
+ \fill[\sloth@body!50!white,rotate around={-44:(0.195, 1.76)}] (0.195, 1.705) rectangle ++(0.005, 0.02);
+ %
+ \fill[\sloth@body!50!white] (-0.195, 1.705) rectangle ++(0.005, 0.02);
+ \fill[\sloth@body!50!white,rotate around={22:(-0.195, 1.76)}] (-0.195, 1.705) rectangle ++(0.005, 0.02);
+ \fill[\sloth@body!50!white,rotate around={44:(-0.195, 1.76)}] (-0.195, 1.705) rectangle ++(0.005, 0.02);
+ \fill[\sloth@body!50!white,rotate around={-22:(-0.195, 1.76)}] (-0.195, 1.705) rectangle ++(0.005, 0.02);
+ \fill[\sloth@body!50!white,rotate around={-44:(-0.195, 1.76)}] (-0.195, 1.701) rectangle ++(0.005, 0.02);
\else
- \sloth@part@draw[black] (0.193,1.75) circle (0.04);
- \sloth@part@draw[black] (-0.193,1.75) circle (0.04);
- \fill[white] (-0.2 ,1.765) circle (0.006);
- \fill[white] ( 0.186,1.765) circle (0.006);
+ \sloth@part@draw[black] (0.193,1.75) circle[radius=0.04];
+ \sloth@part@draw[black] (-0.193,1.75) circle[radius=0.04];
+ \fill[white] (-0.2 ,1.765) circle[radius=0.006];
+ \fill[white] ( 0.186,1.765) circle[radius=0.006];
\fi
%
% Nose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\sloth@part@draw[\sloth@body!40!black] (0,1.665) ellipse (0.078 and 0.048);
+\sloth@part@draw[\sloth@body!40!black] (0,1.665) ellipse[x radius=0.078, y radius=0.048];
%
% Mouth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\draw[\sloth@body!40!black,line width=\scalingfactor*0.4pt] (0.115, 1.55) arc [start angle=-40, end angle=-140, radius=0.16];
%
-% Hair %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\sloth@part@draw[\sloth@body] (-0.1128,2.0724) .. controls (-0.1128,2.0724) and (-0.1499,2.2329) .. (-0.0972,2.2525) .. controls (-0.1082,2.1318) and (-0.0047,2.0839) .. (-0.0047,2.0839) .. controls (-0.0047,2.0839) and (-0.0219,2.1866) .. (0.0145,2.1933) .. controls (0.0142,2.1159) and (0.0770,2.0884) .. (0.0770,2.0884) -- cycle;
-%
-% Belly %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\sloth@part@draw[\sloth@body!70!white] (0.36, 0.74) .. controls (0.36, 0.49) and (0.22, 0.41) .. (0, 0.41) .. controls (-0.22, 0.41) and (-0.36, 0.49) .. (-0.36, 0.74) .. controls (-0.36, 1) and (-0.22, 1.16) .. (0, 1.16) .. controls (0.22, 1.16) and (0.36, 1) .. (0.36, 0.74) -- cycle;
-%
% Arms %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sloth@part@draw[\sloth@body] (-0.50, 1.24) .. controls (-0.54, 1.24) and (-0.55, 1.20) .. (-0.56, 1.17) .. controls (-0.61, 1.06) and (-0.63, 0.95) .. (-0.64, 0.83) .. controls (-0.64, 0.80) and (-0.64, 0.77) .. (-0.63, 0.74) .. controls (-0.57, 0.66) and (-0.47, 0.60) .. (-0.38, 0.56) .. controls (-0.31, 0.54) and (-0.23, 0.52) .. (-0.16, 0.54) .. controls (-0.12, 0.54) and (-0.10, 0.59) .. (-0.13, 0.61) .. controls (-0.17, 0.68) and (-0.24, 0.73) .. (-0.30, 0.77) .. controls (-0.34, 0.79) and (-0.38, 0.81) .. (-0.42, 0.83) .. controls (-0.41, 0.92) and (-0.41, 1.01) .. (-0.42, 1.09) .. controls (-0.43, 1.14) and (-0.44, 1.19) .. (-0.48, 1.23) .. controls (-0.48, 1.24) and (-0.49, 1.24) .. (-0.50, 1.24) -- cycle;
\sloth@part@draw[\sloth@body] (0.50, 1.24) .. controls (0.54, 1.24) and (0.55, 1.20) .. (0.56, 1.17) .. controls (0.61, 1.06) and (0.63, 0.95) .. (0.64, 0.83) .. controls (0.64, 0.80) and (0.64, 0.77) .. (0.63, 0.74) .. controls (0.57, 0.66) and (0.47, 0.60) .. (0.38, 0.56) .. controls (0.31, 0.54) and (0.23, 0.52) .. (0.16, 0.54) .. controls (0.12, 0.54) and (0.10, 0.59) .. (0.13, 0.61) .. controls (0.17, 0.68) and (0.24, 0.73) .. (0.30, 0.77) .. controls (0.34, 0.79) and (0.38, 0.81) .. (0.42, 0.83) .. controls (0.41, 0.92) and (0.41, 1.01) .. (0.42, 1.09) .. controls (0.43, 1.14) and (0.44, 1.19) .. (0.48, 1.23) .. controls (0.48, 1.24) and (0.49, 1.24) .. (0.50, 1.24) -- cycle;
%
-\fill[\sloth@body!50!black,rotate around={110:(0.15, 0.61)}] (0.15, 0.61) ellipse (0.017 and 0.07);
-\fill[\sloth@body!50!black,rotate around={117:(0.17, 0.57)}] (0.17, 0.57) ellipse (0.015 and 0.07);
-\fill[\sloth@body!50!black,rotate around={125:(0.19, 0.53)}] (0.19, 0.53) ellipse (0.012 and 0.062);
+\fill[\sloth@body!50!black] (0.15, 0.61) ellipse[x radius=0.017, y radius=0.07, rotate=110];
+\fill[\sloth@body!50!black] (0.17, 0.57) ellipse[x radius=0.015, y radius=0.07, rotate=117];
+\fill[\sloth@body!50!black] (0.19, 0.53) ellipse[x radius=0.012, y radius=0.062, rotate=125];
%
-\fill[\sloth@body!50!black,rotate around={-110:(-0.15, 0.61)}] (-0.15, 0.61) ellipse (0.017 and 0.07);
-\fill[\sloth@body!50!black,rotate around={-117:(-0.17, 0.57)}] (-0.17, 0.57) ellipse (0.015 and 0.07);
-\fill[\sloth@body!50!black,rotate around={-125:(-0.19, 0.53)}] (-0.19, 0.53) ellipse (0.012 and 0.062);
+\fill[\sloth@body!50!black] (-0.15, 0.61) ellipse[x radius=0.017, y radius=0.07, rotate=-110];
+\fill[\sloth@body!50!black] (-0.17, 0.57) ellipse[x radius=0.015, y radius=0.07, rotate=-117];
+\fill[\sloth@body!50!black] (-0.19, 0.53) ellipse[x radius=0.012, y radius=0.062, rotate=-125];
%
% Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\sloth@part@draw[\sloth@body,rotate around={25:(0.33,0.31)}] (0.33,0.31) ellipse (0.25 and 0.13);
-\sloth@part@draw[\sloth@body,rotate around={-25:(-0.33,0.31)}] (-0.33,0.31) ellipse (0.25 and 0.13);
-\fill[\sloth@body!50!black,rotate around={-10:(-0.125,0.265)}] (-0.125,0.265) ellipse (0.07 and 0.019);
-\fill[\sloth@body!50!black,rotate around={-16:(-0.14,0.21)}] (-0.14,0.21) ellipse (0.07 and 0.017);
-\fill[\sloth@body!50!black,rotate around={-22:(-0.16,0.165)}] (-0.16,0.165) ellipse (0.07 and 0.015);
-\fill[\sloth@body!50!black,rotate around={10:(0.125,0.265)}] (0.125,0.265) ellipse (0.07 and 0.019);
-\fill[\sloth@body!50!black,rotate around={16:(0.14,0.21)}] (0.14,0.21) ellipse (0.07 and 0.017);
-\fill[\sloth@body!50!black,rotate around={22:(0.16,0.165)}] (0.16,0.165) ellipse (0.07 and 0.015);
+\sloth@part@draw[\sloth@body] (0.33,0.31) ellipse[x radius=0.25, y radius=0.13, rotate=25];
+\sloth@part@draw[\sloth@body] (-0.33,0.31) ellipse[x radius=0.25, y radius=0.13, rotate=-25];
+\fill[\sloth@body!50!black] (-0.125,0.265) ellipse[x radius=0.07, y radius=0.019, rotate=-10];
+\fill[\sloth@body!50!black] (-0.14,0.21) ellipse[x radius=0.07, y radius=0.017, rotate=-16];
+\fill[\sloth@body!50!black] (-0.16,0.165) ellipse[x radius=0.07, y radius=0.015, rotate=-22];
+\fill[\sloth@body!50!black] (0.125,0.265) ellipse[x radius=0.07, y radius=0.019, rotate=10];
+\fill[\sloth@body!50!black] (0.14,0.21) ellipse[x radius=0.07, y radius=0.017, rotate=16];
+\fill[\sloth@body!50!black] (0.16,0.165) ellipse[x radius=0.07, y radius=0.015, rotate=22];
+%
+\fi
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname slothhookbody\endcsname
+\csname tikzlinghookbody\endcsname
%
}