diff options
Diffstat (limited to 'graphics/pgf/contrib/tikzlings/tikzlings-marmots.sty')
-rw-r--r-- | graphics/pgf/contrib/tikzlings/tikzlings-marmots.sty | 77 |
1 files changed, 52 insertions, 25 deletions
diff --git a/graphics/pgf/contrib/tikzlings/tikzlings-marmots.sty b/graphics/pgf/contrib/tikzlings/tikzlings-marmots.sty index abbeb4a1fb..2e2fd19808 100644 --- a/graphics/pgf/contrib/tikzlings/tikzlings-marmots.sty +++ b/graphics/pgf/contrib/tikzlings/tikzlings-marmots.sty @@ -1,8 +1,8 @@ % !TeX root = ./examples/marmot.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% The tikzlings-marmots package (part of the tikzlings collection) -% A package to bring little marmots 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-marmots} - [2019/04/07 v0.2 Drawing marmots in TikZ] +\ProvidesPackage{tikzlings-marmots}[2020/04/22 version v0.3 Drawing marmots in TikZ] \RequirePackage{tikz} \RequirePackage{tikzlings-addons} @@ -44,6 +40,10 @@ \marmot@draw% \end{scope}% \thing[#1]% + % adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \csname marmothookforeground\endcsname + \csname tikzlinghookforeground\endcsname + % } \newif\ifmarmot@blush @@ -54,6 +54,7 @@ \newif\ifmarmot@askphil \newif\ifmarmot@leftstep \newif\ifmarmot@rightstep +\newif\ifmarmot@back \tikzset{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -90,6 +91,7 @@ left step/.forward to = /marmot/leftstep, rightstep/.code = \marmot@rightsteptrue, right step/.forward to = /marmot/rightstep, + back/.code = \marmot@backtrue, } \def\marmot@draw{% @@ -107,7 +109,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} % @@ -129,6 +131,10 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % +% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\csname marmothookbackground\endcsname +\csname tikzlinghookbackground\endcsname +% \ifmarmot@askphil \pgfmathparse{int(random(1,120))} \let\marmot@random=\pgfmathresult @@ -138,7 +144,7 @@ \fi % \ifmarmot@shadow - \fill[opacity=0,blur shadow,rotate around={-80:(0.3,0.5)}] (0.3,0.5) ellipse (0.28 and 0.8); + \fill[opacity=0,blur shadow,] (0.3,0.5) ellipse[x radius=0.28, y radius=0.8, rotate=-80]; \fi % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -149,43 +155,59 @@ % % Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ifmarmot@leftstep - \marmot@part@draw[\marmot@body!50!black] (-0.255,0.25) ellipse (0.23 and 0.09); + \marmot@part@draw[\marmot@body!50!black] (-0.255,0.25) ellipse[x radius=0.23, y radius=0.09]; \else - \marmot@part@draw[\marmot@body!50!black] (-0.255,0.2) ellipse (0.23 and 0.09); + \marmot@part@draw[\marmot@body!50!black] (-0.255,0.2) ellipse[x radius=0.23, y radius=0.09]; \fi \ifmarmot@rightstep - \marmot@part@draw[\marmot@body!50!black] (0.255,0.25) ellipse (0.23 and 0.09); + \marmot@part@draw[\marmot@body!50!black] (0.255,0.25) ellipse[x radius=0.23, y radius=0.09]; \else - \marmot@part@draw[\marmot@body!50!black] (0.255,0.2) ellipse (0.23 and 0.09); + \marmot@part@draw[\marmot@body!50!black] (0.255,0.2) ellipse[x radius=0.23, y radius=0.09]; \fi % % Ears %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\marmot@part@draw[\marmot@body!50!black] (0.255,2.03) ellipse (0.09 and 0.13); -\marmot@part@draw[\marmot@body!50!black] (-0.255,2.03) ellipse (0.09 and 0.13); +\marmot@part@draw[\marmot@body!50!black] (0.255,2.03) ellipse[x radius=0.09, y radius=0.13]; +\marmot@part@draw[\marmot@body!50!black] (-0.255,2.03) ellipse[x radius=0.09, y radius=0.13]; % % Tail %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\marmot@part@draw[\marmot@body!50!black] (0.885, 0.67) .. controls (0.865, 0.4) and (0.345, 0.24) .. (0.335, 0.44) .. controls (0.315, 0.56) and (0.445, 0.51) .. (0.575, 0.53) .. controls (0.695, 0.54) and (0.885, 0.72) .. (0.885, 0.67) -- cycle; +\ifmarmot@back\else + \marmot@part@draw[\marmot@body!50!black] (0.8856, 0.6504) .. controls (0.8656, 0.3803) and (0.0267, 0.2202) .. (0.0167, 0.4203) .. controls (-0.0033, 0.5404) and (0.1104, 0.4397) .. (0.3951, 0.4803) .. controls (0.6557, 0.5175) and (0.8856, 0.7005) .. (0.8856, 0.6504); +\fi % % Body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \marmot@part@draw[\marmot@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; % +% Tail if back %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifmarmot@back + \marmot@part@draw[\marmot@body!50!black] (0.8856, 0.6504) .. controls (0.8656, 0.3803) and (0.0267, 0.2202) .. (0.0167, 0.4203) .. controls (-0.0033, 0.5404) and (0.1104, 0.4397) .. (0.3951, 0.4803) .. controls (0.6557, 0.5175) and (0.8856, 0.7005) .. (0.8856, 0.6504); +\fi +% % Belly %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\marmot@part@draw[\marmot@body!50!white] (0.425, 0.71) .. controls (0.425, 0.41) and (0.245, 0.37) .. (0, 0.37) .. controls (-0.245, 0.37) and (-0.425, 0.41) .. (-0.425, 0.71) .. controls (-0.425, 1.01) and (-0.225, 1.26) .. (0, 1.26) .. controls (0.225, 1.26) and (0.425, 1.01) .. (0.425, 0.71) -- cycle; +\ifmarmot@back\else + \marmot@part@draw[\marmot@body!50!white] (0.425, 0.71) .. controls (0.425, 0.41) and (0.245, 0.37) .. (0, 0.37) .. controls (-0.245, 0.37) and (-0.425, 0.41) .. (-0.425, 0.71) .. controls (-0.425, 1.01) and (-0.225, 1.26) .. (0, 1.26) .. controls (0.225, 1.26) and (0.425, 1.01) .. (0.425, 0.71) -- cycle; +\fi +% +% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\csname marmothookbelly\endcsname +\csname tikzlinghookbelly\endcsname +% +% Show details only from the front %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifmarmot@back\else % % Arms %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\marmot@part@draw[\marmot@body!50!black,rotate around={70:(0.385,0.93)}] (0.385,0.93) ellipse (0.24 and 0.13); -\marmot@part@draw[\marmot@body!50!black,rotate around={-70:(-0.385,0.93)}] (-0.385,0.93) ellipse (0.24 and 0.13); +\marmot@part@draw[\marmot@body!50!black] (0.385,0.93) ellipse[x radius=0.24, y radius=0.13, rotate=70]; +\marmot@part@draw[\marmot@body!50!black] (-0.385,0.93) ellipse[x radius=0.24, y radius=0.13, rotate=-70]; % % Muzzle %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\marmot@part@draw[\marmot@body!50!white] (0,1.47) ellipse (0.23 and 0.13); +\marmot@part@draw[\marmot@body!50!white] (0,1.47) ellipse[x radius=0.23, y radius=0.13]; % % Nose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\marmot@part@draw[\marmot@body!50!black] (0,1.6) circle (0.08); +\marmot@part@draw[\marmot@body!50!black] (0,1.6) circle[radius=0.08]; % % Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\marmot@part@draw[\marmot@body!50!black] (-0.155,1.77) circle (0.05); -\marmot@part@draw[\marmot@body!50!black] (0.155,1.77) circle (0.05); +\marmot@part@draw[\marmot@body!50!black] (-0.155,1.77) circle[radius=0.05]; +\marmot@part@draw[\marmot@body!50!black] (0.155,1.77) circle[radius=0.05]; % % Mouth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fill[\marmot@body!50!black] (0.145,1.51) arc [start angle=-20, end angle=-160, radius=0.16] -- (-0.14,1.51) -- (-0.14,1.51) arc [start angle=-160, end angle=-20, radius=0.144] -- cycle ; @@ -198,8 +220,8 @@ % % Blushed %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ifmarmot@blush - \fill[red,path fading=marmot@blush] (-0.295,1.6) circle (0.1); - \fill[red,path fading=marmot@blush] (0.295,1.6) circle (0.1); + \fill[red,path fading=marmot@blush] (-0.295,1.6) circle[radius=0.1]; + \fill[red,path fading=marmot@blush] (0.295,1.6) circle[radius=0.1]; \fi % % Wiskers %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -219,5 +241,10 @@ \fill[\marmot@teeth] (0.045,1.407) rectangle (0.004,1.376); \fi % +\fi +% adding hook for users to customise %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\csname marmothookbody\endcsname +\csname tikzlinghookbody\endcsname +% } |