Debian Codegraph @

texmf-dist/tex/latex/tikzlings/tikzlings-sloths.sty

raw
1 % !TeX root = ./examples/sloth.tex
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %%
4 %% This package is part of the TikZlings package
5 %% A package to bring cute little animals and other beings into tikz
6 %% Maintained by samcarter
7 %%
8 %% Project repository and bug tracker:
9 %% https://github.com/samcarter/tikzlings
10 %%
11 %% Released under the LaTeX Project Public License v1.3c or later
12 %% See https://www.latex-project.org/lppl.txt
13 %%
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 \ProvidesPackage{tikzlings-sloths}[2025/12/11 version v2.5 Drawing sloths in TikZ]
16
17 \RequirePackage{tikz}
18 \RequirePackage{tikzlings-addons}
19
20 \definecolor{slothcol}{RGB}{143,133,105}
21
22 \newcommand*{\sloth}[1][]{%
23 \begin{scope}%
24 \tikzset{/sloth/.cd,#1}%
25 \sloth@draw%
26 \end{scope}%
27 \thing[#1]%
28 % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29 \UseHook{tikzlings/sloth/foreground}
30 \UseHook{tikzlings/foreground}
31 \csname slothhookforeground\endcsname
32 \csname tikzlinghookforeground\endcsname
33 %
34 }
35
36 \newif\ifsloth@sleeping
37 \newif\ifsloth@threeD
38 \newif\ifsloth@back
39 \newif\ifsloth@contour
40 \newif\ifsloth@openmouth
41
42 \NewHook{tikzlings/sloth/background}
43 \NewHook{tikzlings/sloth/belly}
44 \NewHook{tikzlings/sloth/body}
45 \NewHook{tikzlings/sloth/foreground}
46
47 \tikzset{
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49 %
50 % Pass unknown keys on to tikz
51 %
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 /sloth/.search also={/tikz,/pgf,/thing},
54 /sloth/.cd,
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 %
57 % body
58 %
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 body/.store in = \sloth@body,
61 body = slothcol,
62 eyes/.store in = \sloth@eyes,
63 eyes = black,
64 eye/.forward to = /sloth/eyes,
65 eyelids/.store in = \sloth@eyelids,
66 eyelids = sloth@bright10!50!white,
67 eyelid/.forward to = /sloth/eyelids,
68 mouth/.store in = \sloth@mouth,
69 mouth = sloth@bright10!40!black,
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 %
72 % options
73 %
74 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
75 sleeping/.code = \sloth@sleepingtrue,
76 openmouth/.code = \sloth@openmouthtrue,
77 open mouth/.forward to = /sloth/openmouth,
78 3D/.code = \sloth@threeDtrue,
79 back/.code = \sloth@backtrue,
80 contour/.code = \sloth@contourtrue
81 \def\sloth@contour{#1}
82 \def\sloth@mouth{#1}
83 \def\sloth@eyelids{#1},
84 contour/.default = black,
85 outline/.forward to = /sloth/contour,
86 }
87
88 \def\sloth@draw{%
89 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90 %
91 % minimal bounding box size
92 %
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 \path (-0.7,0.12) rectangle (0.7, 2.27);
95 %
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 %
98 % store the current scale factor
99 % from https://github.com/samcarter/tikzlings/issues/3#issuecomment-461373494
100 %
101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
102 \pgfgettransformentries{\tmpscaleA}{\tmpscaleB}{\tmpscaleC}{\tmpscaleD}{\tmp}{\tmp}%
103 \pgfmathsetmacro{\scalingfactor}{sqrt(abs(\tmpscaleA*\tmpscaleD-\tmpscaleB*\tmpscaleC))*sqrt(abs((\pgf@xx/1cm)*(\pgf@yy/1cm)-(\pgf@xy/1cm)*(\pgf@yx/1cm)))}%
104 \pgfmathsetmacro{\xscalefactor}{\tmpscaleA}
105 \pgfmathsetmacro{\yscalefactor}{\tmpscaleD}
106 %
107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
108 %
109 % switch between 2D, 3D and contours, from
110 % https://chat.stackexchange.com/transcript/message/45991801#45991801
111 %
112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113 \ifsloth@threeD
114 \def\sloth@part@draw[##1]{\shade[ball color=##1]}
115 \else% 3D
116 \ifsloth@contour
117 \def\sloth@part@draw[##1]{\draw[##1,\sloth@contour,fill=white,line width=\scalingfactor*0.4pt]}
118 \else% contour
119 \def\sloth@part@draw[##1]{\fill[##1]}
120 \fi% contour
121 \fi% 3D
122 %
123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124 %
125 % generating saturated/brighter version of body colour
126 %
127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
128 \extractcolorspecs{\sloth@body}{\sloth@model}{\sloth@colorspec}
129 \convertcolorspec{\sloth@model}{\sloth@colorspec}{hsb}{\sloth@hsbcolorspec}
130 \pgfmathsetmacro{\sloth@hue}{(array({\sloth@hsbcolorspec},0))}
131 \pgfmathsetmacro{\sloth@sat}{(array({\sloth@hsbcolorspec},1))}
132 \pgfmathsetmacro{\sloth@bright}{(array({\sloth@hsbcolorspec},2))+0.1}
133 \definecolor{sloth@bright10}{hsb}{\sloth@hue,\sloth@sat,\sloth@bright}
134 %
135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
136 %
137 % Body parts
138 %
139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
140 %
141 % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
142 \UseHook{tikzlings/sloth/background}
143 \UseHook{tikzlings/background}
144 \csname slothhookbackground\endcsname
145 \csname tikzlinghookbackground\endcsname
146 %
147 % Arms if back %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
148 \ifsloth@back
149 \sloth@part@draw[sloth@bright10] (0.53,0.95) ellipse[x radius=0.1, y radius=0.27, rotate=10];
150 \sloth@part@draw[sloth@bright10] (-0.53,0.95) ellipse[x radius=0.1, y radius=0.27, rotate=-10];
151 \fi% back
152 %
153 % Feet if back%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
154 \ifsloth@back
155 \fill[sloth@bright10!50!black] (-0.125,0.265) ellipse[x radius=0.07, y radius=0.019,rotate=-10];
156 \fill[sloth@bright10!50!black] (-0.14,0.21) ellipse[x radius=0.07, y radius=0.017, rotate=-16];
157 \fill[sloth@bright10!50!black] (-0.16,0.165) ellipse[x radius=0.07, y radius=0.015, rotate=-22];
158 \fill[sloth@bright10!50!black] (0.125,0.265) ellipse[x radius=0.07, y radius=0.019, rotate=10];
159 \fill[sloth@bright10!50!black] (0.14,0.21) ellipse[x radius=0.07, y radius=0.017, rotate=16];
160 \fill[sloth@bright10!50!black] (0.16,0.165) ellipse[x radius=0.07, y radius=0.015, rotate=22];
161 \sloth@part@draw[sloth@bright10] (0.33,0.31) ellipse[x radius=0.25, y radius=0.13, rotate=25];
162 \sloth@part@draw[sloth@bright10] (-0.33,0.31) ellipse[x radius=0.25, y radius=0.13, rotate=-25];
163 \fi% back
164 %
165 % Body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166 \sloth@part@draw[\sloth@body] (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;
167 %
168 % Belly %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169 \unless\ifsloth@back
170 \sloth@part@draw[sloth@bright10!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;
171 \fi% back
172 %
173 % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
174 \UseHook{tikzlings/sloth/belly}
175 \UseHook{tikzlings/belly}
176 \csname slothhookbelly\endcsname
177 \csname tikzlinghookbelly\endcsname
178 %
179 % Hair %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180 \sloth@part@draw[sloth@bright10] (-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;
181 %
182 % Head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183 \sloth@part@draw[sloth@bright10] ( 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;
184 %
185 % Show details only from the front %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
186 \unless\ifsloth@back
187 %
188 % Inner part of hat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
189 \sloth@part@draw[sloth@bright10!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;
190 %
191 % behind the eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
192 \ifsloth@contour
193 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (0.3785,1.5336) .. controls (0.3012,1.5864) and (0.1829,1.6693) .. (0.1377,1.7234) .. controls (0.1184,1.7464) and (0.1624,1.8242) .. (0.1906,1.8137) .. controls (0.2673,1.7851) and (0.3597,1.7125) .. (0.3994,1.6531) .. controls (0.4129,1.6328) and (0.3785,1.5336) .. (0.3785,1.5336) -- cycle;
194 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (-0.3785,1.5336) .. controls (-0.3012,1.5864) and (-0.1829,1.6693) .. (-0.1377,1.7234) .. controls (-0.1184,1.7464) and (-0.1624,1.8242) .. (-0.1906,1.8137) .. controls (-0.2673,1.7851) and (-0.3597,1.7125) .. (-0.3994,1.6531) .. controls (-0.4129,1.6328) and (-0.3785,1.5336) .. (-0.3785,1.5336) -- cycle;
195 \else% contour
196 \fill[sloth@bright10!60!black] (0.3785,1.5336) .. controls (0.3012,1.5864) and (0.1829,1.6693) .. (0.1377,1.7234) .. controls (0.1184,1.7464) and (0.1624,1.8242) .. (0.1906,1.8137) .. controls (0.2673,1.7851) and (0.3597,1.7125) .. (0.3994,1.6531) .. controls (0.4129,1.6328) and (0.3785,1.5336) .. (0.3785,1.5336) -- cycle;
197 \fill[sloth@bright10!60!black] (-0.3785,1.5336) .. controls (-0.3012,1.5864) and (-0.1829,1.6693) .. (-0.1377,1.7234) .. controls (-0.1184,1.7464) and (-0.1624,1.8242) .. (-0.1906,1.8137) .. controls (-0.2673,1.7851) and (-0.3597,1.7125) .. (-0.3994,1.6531) .. controls (-0.4129,1.6328) and (-0.3785,1.5336) .. (-0.3785,1.5336) -- cycle;
198 \fi% contour
199 %
200 % Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
201 \ifsloth@sleeping
202 \fill[\sloth@eyelids] (0.195, 1.705) rectangle ++(0.005, 0.02);
203 \fill[\sloth@eyelids,rotate around={22:(0.195, 1.76)}] (0.195, 1.705) rectangle ++(0.005, 0.02);
204 \fill[\sloth@eyelids,rotate around={44:(0.195, 1.76)}] (0.195, 1.701) rectangle ++(0.005, 0.02);
205 \fill[\sloth@eyelids,rotate around={-22:(0.195, 1.76)}] (0.195, 1.705) rectangle ++(0.005, 0.02);
206 \fill[\sloth@eyelids,rotate around={-44:(0.195, 1.76)}] (0.195, 1.705) rectangle ++(0.005, 0.02);
207 %
208 \fill[\sloth@eyelids] (-0.195, 1.705) rectangle ++(0.005, 0.02);
209 \fill[\sloth@eyelids,rotate around={22:(-0.195, 1.76)}] (-0.195, 1.705) rectangle ++(0.005, 0.02);
210 \fill[\sloth@eyelids,rotate around={44:(-0.195, 1.76)}] (-0.195, 1.705) rectangle ++(0.005, 0.02);
211 \fill[\sloth@eyelids,rotate around={-22:(-0.195, 1.76)}] (-0.195, 1.705) rectangle ++(0.005, 0.02);
212 \fill[\sloth@eyelids,rotate around={-44:(-0.195, 1.76)}] (-0.195, 1.701) rectangle ++(0.005, 0.02);
213 %
214 \sloth@part@draw[\sloth@eyelids] (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;
215 \sloth@part@draw[\sloth@eyelids] (-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;
216 \else% sleeping
217 \sloth@part@draw[\sloth@eyes] (0.193,1.75) circle[radius=0.04];
218 \sloth@part@draw[\sloth@eyes] (-0.193,1.75) circle[radius=0.04];
219 \fill[white] (-0.2 ,1.765) circle[radius=0.006];
220 \fill[white] ( 0.186,1.765) circle[radius=0.006];
221 \fi% sleeping
222 %
223 % Nose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
224 \sloth@part@draw[sloth@bright10!40!black] (0,1.665) ellipse[x radius=0.078, y radius=0.048];
225 %
226 % Mouth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
227 \ifsloth@openmouth
228 \filldraw[\sloth@mouth,line width=\scalingfactor*0.4pt] (0.115, 1.55) arc [start angle=-40, end angle=-140, radius=0.16];
229 \else
230 \draw[\sloth@mouth,line width=\scalingfactor*0.4pt] (0.115, 1.55) arc [start angle=-40, end angle=-140, radius=0.16];
231 \fi
232 %
233 % Arms %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
234 \sloth@part@draw[sloth@bright10] (-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;
235 \sloth@part@draw[sloth@bright10] (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;
236 %
237 \ifsloth@contour
238 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (0.15, 0.61) ellipse[x radius=0.017, y radius=0.07, rotate=110];
239 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (0.17, 0.57) ellipse[x radius=0.015, y radius=0.07, rotate=117];
240 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (0.19, 0.53) ellipse[x radius=0.012, y radius=0.062, rotate=125];
241 %
242 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (-0.15, 0.61) ellipse[x radius=0.017, y radius=0.07, rotate=-110];
243 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (-0.17, 0.57) ellipse[x radius=0.015, y radius=0.07, rotate=-117];
244 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (-0.19, 0.53) ellipse[x radius=0.012, y radius=0.062, rotate=-125];
245 \else% contour
246 \fill[sloth@bright10!50!black] (0.15, 0.61) ellipse[x radius=0.017, y radius=0.07, rotate=110];
247 \fill[sloth@bright10!50!black] (0.17, 0.57) ellipse[x radius=0.015, y radius=0.07, rotate=117];
248 \fill[sloth@bright10!50!black] (0.19, 0.53) ellipse[x radius=0.012, y radius=0.062, rotate=125];
249 %
250 \fill[sloth@bright10!50!black] (-0.15, 0.61) ellipse[x radius=0.017, y radius=0.07, rotate=-110];
251 \fill[sloth@bright10!50!black] (-0.17, 0.57) ellipse[x radius=0.015, y radius=0.07, rotate=-117];
252 \fill[sloth@bright10!50!black] (-0.19, 0.53) ellipse[x radius=0.012, y radius=0.062, rotate=-125];
253 \fi% contour
254 %
255 % Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
256 \sloth@part@draw[sloth@bright10] (0.33,0.31) ellipse[x radius=0.25, y radius=0.13, rotate=25];
257 \sloth@part@draw[sloth@bright10] (-0.33,0.31) ellipse[x radius=0.25, y radius=0.13, rotate=-25];
258 %
259 \ifsloth@contour
260 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (-0.125,0.265) ellipse[x radius=0.07, y radius=0.019, rotate=-10];
261 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (-0.14,0.21) ellipse[x radius=0.07, y radius=0.017, rotate=-16];
262 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (-0.16,0.165) ellipse[x radius=0.07, y radius=0.015, rotate=-22];
263 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (0.125,0.265) ellipse[x radius=0.07, y radius=0.019, rotate=10];
264 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (0.14,0.21) ellipse[x radius=0.07, y radius=0.017, rotate=16];
265 \draw[\sloth@contour,fill=white,line width=\scalingfactor*0.4pt] (0.16,0.165) ellipse[x radius=0.07, y radius=0.015, rotate=22];
266 \else% contour
267 \fill[sloth@bright10!50!black] (-0.125,0.265) ellipse[x radius=0.07, y radius=0.019, rotate=-10];
268 \fill[sloth@bright10!50!black] (-0.14,0.21) ellipse[x radius=0.07, y radius=0.017, rotate=-16];
269 \fill[sloth@bright10!50!black] (-0.16,0.165) ellipse[x radius=0.07, y radius=0.015, rotate=-22];
270 \fill[sloth@bright10!50!black] (0.125,0.265) ellipse[x radius=0.07, y radius=0.019, rotate=10];
271 \fill[sloth@bright10!50!black] (0.14,0.21) ellipse[x radius=0.07, y radius=0.017, rotate=16];
272 \fill[sloth@bright10!50!black] (0.16,0.165) ellipse[x radius=0.07, y radius=0.015, rotate=22];
273 \fi% contour
274 %
275 \fi% back
276 %
277 % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
278 \UseHook{tikzlings/sloth/body}
279 \UseHook{tikzlings/body}
280 \csname slothhookbody\endcsname
281 \csname tikzlinghookbody\endcsname
282 %
283 }
284
285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
286 %%
287 %% Documentation
288 %%
289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
290 %\clearpage
291 %\section[Sloth]{Riley, the sloth}
292 %
293 %\emph{One of good souls behind the TugBoat once met a sloth called Riley}
294 %
295 %\subsection{Package name}
296 %
297 %\begin{tcolorbox}[title={Package usage}]
298 %\begin{samcode}
299 %\usepackage{tikzlings-sloths}
300 %\end{samcode}
301 %\end{tcolorbox}
302 %
303 %\subsection{Basic Usage}
304 %
305 %\begin{tcblisting}{title={Basic sloth}}
306 %\sloth
307 %\end{tcblisting}
308 %
309 %\subsection{Options}
310 %
311 %The basic sloth can be modified by changing its colour:
312 %\begin{tcblisting}{title={Body colour}}
313 %\sloth[body=blue]
314 %\end{tcblisting}
315 %
316 %In addition to the colour of the body, the colour of various body parts can be adjusted:
317 %\begin{tcblisting}{title={Eye colour}}
318 %\sloth[eyes=red]
319 %\end{tcblisting}
320 %\begin{tcblisting}{title={Mouth colour}}
321 %\sloth[mouth=red]
322 %\end{tcblisting}
323 %
324 % The sloth can open its mouth:
325 %\begin{tcblisting}{title={Open mouth}}
326 %\sloth[openmouth]
327 %\end{tcblisting}
328 %
329 %If tired, the sloth can take a nap:
330 %\begin{tcblisting}{title={Sleep}}
331 %\sloth[sleeping]
332 %\end{tcblisting}
333 %\begin{tcblisting}{title={Eyelid colour}}
334 %\sloth[sleeping,eyelids=red]
335 %\end{tcblisting}
336 %
337 %To view the sloth from behind:
338 %\begin{tcblisting}{title={Back view}}
339 %\sloth[back]
340 %\end{tcblisting}
341 %
342 %The key \saminline|3D| will make the sloth 3-dimensional:
343 %\begin{tcblisting}{title={3D view}}
344 %\sloth[3D]
345 %\end{tcblisting}
346 %
347 %And finally the \saminline|contour| key will only draw the outlines:
348 %\begin{tcblisting}{title={Contours}}
349 %\sloth[contour=black]
350 %\end{tcblisting}