summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzlings/tikzlings-penguins.sty
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/tikzlings/tikzlings-penguins.sty')
-rw-r--r--graphics/pgf/contrib/tikzlings/tikzlings-penguins.sty72
1 files changed, 51 insertions, 21 deletions
diff --git a/graphics/pgf/contrib/tikzlings/tikzlings-penguins.sty b/graphics/pgf/contrib/tikzlings/tikzlings-penguins.sty
index 70d90092fa..022d2a1d97 100644
--- a/graphics/pgf/contrib/tikzlings/tikzlings-penguins.sty
+++ b/graphics/pgf/contrib/tikzlings/tikzlings-penguins.sty
@@ -1,8 +1,8 @@
% !TeX root = ./examples/pingu.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% The tikzlings-penguins package (part of the tikzlings collection)
-% A package to bring penguins 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-penguins}
- [2019/04/07 v0.2 Draw penguins in TikZ]
+\ProvidesPackage{tikzlings-penguins}[2020/04/22 version v0.3 Draw penguins in TikZ]
\RequirePackage{tikz}
\RequirePackage{tikzlings-addons}
@@ -27,9 +23,14 @@
\penguin@draw%
\end{scope}%
\thing[#1]%
+ % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \csname penguinhookforeground\endcsname
+ \csname tikzlinghookforeground\endcsname
+ %
}
\newif\ifpenguin@threeD
+\newif\ifpenguin@back
\tikzset{
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -62,6 +63,7 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3D/.code = \penguin@threeDtrue,
+ back/.code = \penguin@backtrue,
}
\def\penguin@draw{%
@@ -79,7 +81,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}
%
@@ -101,28 +103,56 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname penguinhookbackground\endcsname
+\csname tikzlinghookbackground\endcsname
+%
% Arms %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\penguin@part@draw[\penguin@body,rotate around={-50:(0.575,1.2)}] (0.575,1.2) ellipse (0.38 and 0.1);
-\penguin@part@draw[\penguin@body,rotate around={50:(-0.575,1.2)}] (-0.575,1.2) ellipse (0.38 and 0.1);
+\penguin@part@draw[\penguin@body] (0.575,1.2) ellipse[x radius=0.38, y radius=0.1, rotate=-50];
+\penguin@part@draw[\penguin@body] (-0.575,1.2) ellipse[x radius=0.38, y radius=0.1, rotate=50];
+%
+% Feet if back %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifpenguin@back
+ \penguin@part@draw[\penguin@feet]
+ (-0.265, 0.3941) .. controls (-0.283, 0.4505) and (-0.373, 0.6014) .. (-0.470, 0.6533) .. controls (-0.571, 0.7075) and (-0.576, 0.6369) .. (-0.554, 0.596) .. controls (-0.526, 0.5416) and (-0.573, 0.5302) .. (-0.602, 0.5384) .. controls (-0.695, 0.5653) and (-0.767, 0.5169) .. (-0.684, 0.434) .. controls (-0.664, 0.4137) and (-0.587, 0.3557) .. (-0.699, 0.3492) .. controls (-0.772, 0.345) and (-0.779, 0.268) .. (-0.689, 0.2445) .. controls (-0.597, 0.2206) and (-0.476, 0.2043) .. (-0.34, 0.2096) .. controls (-0.252, 0.2131) and (-0.237, 0.3059) .. (-0.265, 0.3941) -- cycle;
+ \penguin@part@draw[\penguin@feet]
+ (0.265, 0.3941) .. controls (0.283, 0.4505) and (0.3725, 0.6014) .. (0.469, 0.6533) .. controls (0.571, 0.7075) and (0.5756, 0.6369) .. (0.554, 0.596) .. controls (0.526, 0.5416) and (0.5733, 0.5302) .. (0.602, 0.5384) .. controls (0.695, 0.5653) and (0.7672, 0.5169) .. (0.684, 0.434) .. controls (0.663, 0.4137) and (0.587, 0.3557) .. (0.699, 0.3492) .. controls (0.772, 0.345) and (0.7789, 0.268) .. (0.689, 0.2445) .. controls (0.597, 0.2206) and (0.4764, 0.2043) .. (0.34, 0.2096) .. controls (0.252, 0.2131) and (0.2368, 0.3059) .. (0.265, 0.3941) -- cycle;
+\fi
%
% Body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\penguin@part@draw[\penguin@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;
%
% Belly %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\penguin@part@draw[\penguin@belly] (0, 0.6) ellipse (0.48 and 0.35);
+\ifpenguin@back\else
+ \penguin@part@draw[\penguin@belly] (0, 0.6) ellipse[x radius=0.48, y radius=0.35];
+\fi
+%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname penguinhookbelly\endcsname
+\csname tikzlinghookbelly\endcsname
%
% Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\penguin@part@draw[\penguin@feet]
-(-0.265, 0.3941) .. controls (-0.283, 0.4505) and (-0.373, 0.6014) .. (-0.470, 0.6533) .. controls (-0.571, 0.7075) and (-0.576, 0.6369) .. (-0.554, 0.596) .. controls (-0.526, 0.5416) and (-0.573, 0.5302) .. (-0.602, 0.5384) .. controls (-0.695, 0.5653) and (-0.767, 0.5169) .. (-0.684, 0.434) .. controls (-0.664, 0.4137) and (-0.587, 0.3557) .. (-0.699, 0.3492) .. controls (-0.772, 0.345) and (-0.779, 0.268) .. (-0.689, 0.2445) .. controls (-0.597, 0.2206) and (-0.476, 0.2043) .. (-0.34, 0.2096) .. controls (-0.252, 0.2131) and (-0.237, 0.3059) .. (-0.265, 0.3941) -- cycle;
-\penguin@part@draw[\penguin@feet]
-(0.265, 0.3941) .. controls (0.283, 0.4505) and (0.3725, 0.6014) .. (0.469, 0.6533) .. controls (0.571, 0.7075) and (0.5756, 0.6369) .. (0.554, 0.596) .. controls (0.526, 0.5416) and (0.5733, 0.5302) .. (0.602, 0.5384) .. controls (0.695, 0.5653) and (0.7672, 0.5169) .. (0.684, 0.434) .. controls (0.663, 0.4137) and (0.587, 0.3557) .. (0.699, 0.3492) .. controls (0.772, 0.345) and (0.7789, 0.268) .. (0.689, 0.2445) .. controls (0.597, 0.2206) and (0.4764, 0.2043) .. (0.34, 0.2096) .. controls (0.252, 0.2131) and (0.2368, 0.3059) .. (0.265, 0.3941) -- cycle;
+\ifpenguin@back\else
+ \penguin@part@draw[\penguin@feet]
+ (-0.265, 0.3941) .. controls (-0.283, 0.4505) and (-0.373, 0.6014) .. (-0.470, 0.6533) .. controls (-0.571, 0.7075) and (-0.576, 0.6369) .. (-0.554, 0.596) .. controls (-0.526, 0.5416) and (-0.573, 0.5302) .. (-0.602, 0.5384) .. controls (-0.695, 0.5653) and (-0.767, 0.5169) .. (-0.684, 0.434) .. controls (-0.664, 0.4137) and (-0.587, 0.3557) .. (-0.699, 0.3492) .. controls (-0.772, 0.345) and (-0.779, 0.268) .. (-0.689, 0.2445) .. controls (-0.597, 0.2206) and (-0.476, 0.2043) .. (-0.34, 0.2096) .. controls (-0.252, 0.2131) and (-0.237, 0.3059) .. (-0.265, 0.3941) -- cycle;
+ \penguin@part@draw[\penguin@feet]
+ (0.265, 0.3941) .. controls (0.283, 0.4505) and (0.3725, 0.6014) .. (0.469, 0.6533) .. controls (0.571, 0.7075) and (0.5756, 0.6369) .. (0.554, 0.596) .. controls (0.526, 0.5416) and (0.5733, 0.5302) .. (0.602, 0.5384) .. controls (0.695, 0.5653) and (0.7672, 0.5169) .. (0.684, 0.434) .. controls (0.663, 0.4137) and (0.587, 0.3557) .. (0.699, 0.3492) .. controls (0.772, 0.345) and (0.7789, 0.268) .. (0.689, 0.2445) .. controls (0.597, 0.2206) and (0.4764, 0.2043) .. (0.34, 0.2096) .. controls (0.252, 0.2131) and (0.2368, 0.3059) .. (0.265, 0.3941) -- cycle;
+\fi
%
% Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\fill[\penguin@eye,rotate around={-10:(-0.175,1.64)}] (-0.175,1.64) ellipse (0.1 and 0.15);
-\fill[\penguin@pupil,rotate around={-3:(-0.145,1.625)}] (-0.145,1.625) ellipse (0.0357 and 0.0714);
-\fill[\penguin@eye,rotate around={10:(0.175,1.64)}] (0.175,1.64) ellipse (0.1 and 0.15);
-\fill[\penguin@pupil,rotate around={3:(0.145,1.625)}] (0.145,1.625) ellipse (0.0357 and 0.0714);
+\ifpenguin@back\else
+ \fill[\penguin@eye] (-0.175,1.64) ellipse[x radius=0.1, y radius=0.15, rotate=-10];
+ \fill[\penguin@pupil] (-0.145,1.625) ellipse[x radius=0.0357, y radius=0.0714, rotate=-3];
+ \fill[\penguin@eye] (0.175,1.64) ellipse[x radius=0.1, y radius=0.15, rotate=10];
+ \fill[\penguin@pupil] (0.145,1.625) ellipse[x radius=0.0357, y radius=0.0714, rotate=3];
+\fi
%
% Bill %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\penguin@part@draw[\penguin@bill] (0.323, 1.4591) .. controls (0.1467, 1.3257) and (0.1066, 1.4365) .. (0, 1.4358) .. controls (-0.1066, 1.4365) and (-0.1467, 1.3257) .. (-0.323, 1.4591) .. controls (-0.1267, 1.075) and (0.1267, 1.075) .. (0.323, 1.4591) -- cycle;
-} \ No newline at end of file
+\ifpenguin@back\else
+ \penguin@part@draw[\penguin@bill] (0.323, 1.4591) .. controls (0.1467, 1.3257) and (0.1066, 1.4365) .. (0, 1.4358) .. controls (-0.1066, 1.4365) and (-0.1467, 1.3257) .. (-0.323, 1.4591) .. controls (-0.1267, 1.075) and (0.1267, 1.075) .. (0.323, 1.4591) -- cycle;
+\fi
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname penguinhookbody\endcsname
+\csname tikzlinghookbody\endcsname
+%
+}