summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzlings/tikzlings-owls.sty
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/tikzlings/tikzlings-owls.sty')
-rw-r--r--graphics/pgf/contrib/tikzlings/tikzlings-owls.sty84
1 files changed, 58 insertions, 26 deletions
diff --git a/graphics/pgf/contrib/tikzlings/tikzlings-owls.sty b/graphics/pgf/contrib/tikzlings/tikzlings-owls.sty
index b54f37f88a..ec25a80198 100644
--- a/graphics/pgf/contrib/tikzlings/tikzlings-owls.sty
+++ b/graphics/pgf/contrib/tikzlings/tikzlings-owls.sty
@@ -1,8 +1,8 @@
% !TeX root = ./examples/owl.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% The tikzlings-owls package (part of the tikzlings collection)
-% A package to draw litlle owls with 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-owls}
- [2019/04/07 v0.2 Draw owls in TikZ]
+\ProvidesPackage{tikzlings-owls}[2020/04/22 version v0.3 Draw owls in TikZ]
\RequirePackage{tikz}
\RequirePackage{tikzlings-addons}
@@ -27,9 +23,14 @@
\owl@draw%
\end{scope}%
\thing[#1]%
+ % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \csname owlhookforeground\endcsname
+ \csname tikzlinghookforeground\endcsname
+ %
}
\newif\ifowl@threeD
+\newif\ifowl@back
\tikzset{
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -60,6 +61,7 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3D/.code = \owl@threeDtrue,
+ back/.code = \owl@backtrue,
}
\def\owl@draw{%
@@ -77,7 +79,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}
%
@@ -99,9 +101,23 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname owlhookbackground\endcsname
+\csname tikzlinghookbackground\endcsname
+%
% Arms %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\owl@part@draw[\owl@body,rotate around={-80:(0.575,0.8)}] (0.575,0.8) ellipse (0.38 and 0.1);
-\owl@part@draw[\owl@body,rotate around={80:(-0.575,0.8)}] (-0.575,0.8) ellipse (0.38 and 0.1);
+\owl@part@draw[\owl@body] (0.575,0.8) ellipse[x radius=0.38, y radius=0.1, rotate=-80];
+\owl@part@draw[\owl@body] (-0.575,0.8) ellipse[x radius=0.38, y radius=0.1, rotate=80];
+%
+% Feet if back %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifowl@back
+ \owl@part@draw[\owl@feet] (0.175,0.2) ellipse[x radius=0.03, y radius=0.1];
+ \owl@part@draw[\owl@feet] (0.225,0.21) ellipse[x radius=0.03, y radius=0.1, rotate=20];
+ \owl@part@draw[\owl@feet] (0.275,0.23) ellipse[x radius=0.03, y radius=0.1, rotate=40];
+ \owl@part@draw[\owl@feet] (-0.175,0.2) ellipse[x radius=0.03, y radius=0.1];
+ \owl@part@draw[\owl@feet] (-0.225,0.21) ellipse[x radius=0.03, y radius=0.1, rotate=-20];
+ \owl@part@draw[\owl@feet] (-0.275,0.23) ellipse[x radius=0.03, y radius=0.1, rotate=-40];
+\fi
%
% Body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\owl@part@draw[\owl@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;
@@ -110,27 +126,43 @@
\owl@part@draw[\owl@body] (-0.6361, 1.777) .. controls (-0.6361, 1.777) and (-0.7586, 1.9603) .. (-0.6759, 2.2145) .. controls (-0.3248, 1.912) and (0.3248, 1.912) .. (0.6759, 2.2145) .. controls (0.7586, 1.9603) and (0.6361, 1.777) .. (0.6361, 1.777);
%
% Belly %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\owl@part@draw[\owl@body!50!white] (0.425,0.5) .. controls (0.425,0.31) and (0.245,0.27) .. (0,0.27) .. controls (-0.245,0.27) and (-0.425,0.31) .. (-0.425,0.5) .. controls (-0.425,0.81) and (-0.225,0.98) .. (0,0.98) .. controls (0.225,0.98) and (0.425,0.81) .. (0.425,0.5) -- cycle;
+\ifowl@back\else
+ \owl@part@draw[\owl@body!50!white] (0.425,0.5) .. controls (0.425,0.31) and (0.245,0.27) .. (0,0.27) .. controls (-0.245,0.27) and (-0.425,0.31) .. (-0.425,0.5) .. controls (-0.425,0.81) and (-0.225,0.98) .. (0,0.98) .. controls (0.225,0.98) and (0.425,0.81) .. (0.425,0.5) -- cycle;
+\fi
+%
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname owlhookbelly\endcsname
+\csname tikzlinghookbelly\endcsname
%
% head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\owl@part@draw[\owl@body] (0,1.55) ellipse (0.7 and 0.55);
+\owl@part@draw[\owl@body] (0,1.55) ellipse[x radius=0.7, y radius=0.55];
%
% Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\fill[\owl@eye] (-0.28, 1.6) circle (0.22);
-\owl@part@draw[\owl@pupil] (-0.28, 1.6) circle (0.15);
-\fill[\owl@eye] (0.28, 1.6) circle (0.22);
-\owl@part@draw[\owl@pupil] (0.28, 1.6) circle (0.15);
-\owl@part@draw[white] (0.25, 1.64) circle (0.03);
-\owl@part@draw[white] (-0.31, 1.64) circle (0.03);
+\ifowl@back\else
+ \fill[\owl@eye] (-0.28, 1.6) circle[radius=0.22];
+ \owl@part@draw[\owl@pupil] (-0.28, 1.6) circle[radius=0.15];
+ \fill[\owl@eye] (0.28, 1.6) circle[radius=0.22];
+ \owl@part@draw[\owl@pupil] (0.28, 1.6) circle[radius=0.15];
+ \owl@part@draw[white] (0.25, 1.64) circle[radius=0.03];
+ \owl@part@draw[white] (-0.31, 1.64) circle[radius=0.03];
+\fi
%
% Bill %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\owl@part@draw[\owl@bill] (0, 1.4) -- (-0.1, 1.3) -- (0, 1.15) -- (0.1, 1.3) -- cycle;
+\ifowl@back\else
+ \owl@part@draw[\owl@bill] (0, 1.4) -- (-0.1, 1.3) -- (0, 1.15) -- (0.1, 1.3) -- cycle;
+\fi
%
% Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\owl@part@draw[\owl@feet] (0.175,0.2) ellipse (0.03 and 0.1);
-\owl@part@draw[\owl@feet,rotate around={20:(0.225,0.21)}] (0.225,0.21) ellipse (0.03 and 0.1);
-\owl@part@draw[\owl@feet,rotate around={40:(0.275,0.23)}] (0.275,0.23) ellipse (0.03 and 0.1);
-\owl@part@draw[\owl@feet] (-0.175,0.2) ellipse (0.03 and 0.1);
-\owl@part@draw[\owl@feet,rotate around={-20:(-0.225,0.21)}] (-0.225,0.21) ellipse (0.03 and 0.1);
-\owl@part@draw[\owl@feet,rotate around={-40:(-0.275,0.23)}] (-0.275,0.23) ellipse (0.03 and 0.1);
-} \ No newline at end of file
+\ifowl@back\else
+ \owl@part@draw[\owl@feet] (0.175,0.2) ellipse[x radius=0.03, y radius=0.1];
+ \owl@part@draw[\owl@feet] (0.225,0.21) ellipse[x radius=0.03, y radius=0.1, rotate=20];
+ \owl@part@draw[\owl@feet] (0.275,0.23) ellipse[x radius=0.03, y radius=0.1, rotate=40];
+ \owl@part@draw[\owl@feet] (-0.175,0.2) ellipse[x radius=0.03, y radius=0.1];
+ \owl@part@draw[\owl@feet] (-0.225,0.21) ellipse[x radius=0.03, y radius=0.1, rotate=-20];
+ \owl@part@draw[\owl@feet] (-0.275,0.23) ellipse[x radius=0.03, y radius=0.1, rotate=-40];
+\fi
+% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\csname owlhookbody\endcsname
+\csname tikzlinghookbody\endcsname
+%
+}