From a57051bede0e319de0b758d80206aba3e1b24947 Mon Sep 17 00:00:00 2001 From: Florian Sihler Date: Sat, 1 Feb 2025 22:20:26 +0100 Subject: [PATCH] A fish for penguins (#282) * feat: add fish * feat-fix: migradte to upload-artifacts v4 --- .github/workflows/status_check.yaml | 4 +-- doc/tikzpingus-doc.tex | 56 +++++++++++++++++++++++++++++ examples/minimal.tex | 3 +- tex/tikzpingus.sty | 28 +++++++++++++++ 4 files changed, 87 insertions(+), 4 deletions(-) diff --git a/.github/workflows/status_check.yaml b/.github/workflows/status_check.yaml index 55c2ca5b..9610b4dc 100644 --- a/.github/workflows/status_check.yaml +++ b/.github/workflows/status_check.yaml @@ -38,14 +38,14 @@ jobs: spl.tex hey-pingu.tex - name: ⬆️ Upload doc artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: doc-output path: | doc/build/*.pdf doc/build/tikzpingus-doc.* - name: ⬆️ Upload examples artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: examples-output path: examples/build/*.pdf diff --git a/doc/tikzpingus-doc.tex b/doc/tikzpingus-doc.tex index 63358df7..e2d97e9c 100644 --- a/doc/tikzpingus-doc.tex +++ b/doc/tikzpingus-doc.tex @@ -4514,6 +4514,62 @@ \subsubsection{The lollipop} \end{tcblisting} \endsubkeyexplain +\subsubsection{The fish} + +\showkeyexplain{fish left}{color}{pingu@blue!50!pingu@green!50!black!90!gray} + Enable the left fish for the penguin: +\begin{tcblisting}{@} +\begin{tikzpicture} + \pingu[fish left=green] +\end{tikzpicture} +\end{tcblisting} +\endshowkeyexplain + +\subkeyexplain{fish left}{fish left scales}{color}{\pingu@color@fishleft@scales} + Change the scales color of the left fish: +\begin{tcblisting}{@} +\begin{tikzpicture} + \pingu[fish left, fish left scales=green] +\end{tikzpicture} +\end{tcblisting} +\endsubkeyexplain + +\subkeyexplain{fish left}{fish left eye}{color}{\pingu@color@fishleft@eye} + Change the eye color of the left fish: +\begin{tcblisting}{@} +\begin{tikzpicture} + \pingu[fish left, fish left eye=green] +\end{tikzpicture} +\end{tcblisting} +\endsubkeyexplain + +\showkeyexplain{fish right}{color}{pingu@blue!50!pingu@green!50!black!90!gray} + Enable the right fish for the penguin: +\begin{tcblisting}{@} +\begin{tikzpicture} + \pingu[fish right=green] +\end{tikzpicture} +\end{tcblisting} +\endshowkeyexplain + +\subkeyexplain{fish right}{fish right scales}{color}{\pingu@color@fishright@scales} + Change the scales color of the right fish: +\begin{tcblisting}{@} +\begin{tikzpicture} + \pingu[fish right, fish right scales=green] +\end{tikzpicture} +\end{tcblisting} +\endsubkeyexplain + +\subkeyexplain{fish right}{fish right eye}{color}{\pingu@color@fishright@eye} + Change the eye color of the right fish: +\begin{tcblisting}{@} +\begin{tikzpicture} + \pingu[fish right, fish right eye=green] +\end{tikzpicture} +\end{tcblisting} +\endsubkeyexplain + \subsubsection{The flower} \showkeyexplain{flower left}{color}{pingu@white!80!pingu@black} diff --git a/examples/minimal.tex b/examples/minimal.tex index c72db220..2f993a69 100644 --- a/examples/minimal.tex +++ b/examples/minimal.tex @@ -5,12 +5,11 @@ \usepackage[active, tightpage]{preview} \PreviewBorder.5cm -\colorlet{@main}{pingu@bronze!60!lightgray!95!green!80!black!60!pingu@bronze} \begin{document} \begin{preview} \parbox[c][3.5cm][c]{3.5cm}{\centering \begin{tikzpicture} - \pingu[detective cap,magnifier right=@main,right wing shock,right wing item angle=172,left eye wink,tie=pingu@bronze,right eye vertical,magnifier right yshift=1.5mm,pants=@main,pants buttons=@main!30!pingu@black] + \pingu[fish right,eyes wink] \end{tikzpicture}\kern9pt}% \end{preview} \end{document} diff --git a/tex/tikzpingus.sty b/tex/tikzpingus.sty index e8683f3a..d07cfc85 100644 --- a/tex/tikzpingus.sty +++ b/tex/tikzpingus.sty @@ -2153,6 +2153,34 @@ scale=\pingu@x@pumpkinhat@scale] \pingu@block[thick,rotate around={\@angle-1:(\pingu@name-lollipop-#1-top)}]{\@col} (\pingu@name-lollipop-#1-top)++(0,.5\p@) ellipse [x radius=1.4mm, y radius=\p@]; } + +\pingu@create@wing@extra{fish}{% + fish \@lr/.code = {\pingu@set@extra{fish\@lr}{true}\pingu@color{fish\@lr}{##1}}, + fish \@lr/.default = pingu@blue!50!pingu@green!50!black!90!gray, + fish \@lr\space scales/.code = \pingu@color{fish\@lr @scales}{##1}, + fish \@lr\space eye/.code = \pingu@color{fish\@lr @eye}{##1}, +}{fish \@lr\space scales=white!90!pingu@blue!80!black, fish \@lr\space eye=pingu@white} + +% #1 wing +\def\pingu@draw@wi@fish#1{% + \pingu@setup@wing{fish}{#1}% + \scope[rotate around={\@angle:(\pingu@name-wing-#1)}] + \def\fishpath{(\pingu@name-wing-#1)++(-5mm,0) to[bend left=38] ++(9mm,0) to[out=-40,in=180] ++(1.5mm,-1.5mm) to[bend left=25] ++(0,3mm) to[out=180,in=40] ++(-1.5mm,-1.5mm) to[bend left=38] cycle}; + \pingu@block[draw=\csname pingu@color@fish#1@scales\endcsname, sharp corners, line join=round]{\@col} \fishpath; + + \clip\fishpath; + % TODO: allow to configure + \foreach \i in {0,...,11} { + \foreach \j in {1,...,30} { + \pgfmathsetmacro\upshift{mod(\j,2)*.2mm} + \pingu@draw[very thin]{\csname pingu@color@fish#1@scales\endcsname} (\pingu@name-wing-#1)++(-3.5mm+.35mm*\j,2mm+-.4 85mm*\i+\upshift) arc (75:-90:.35mm and .25mm); + } + } + \pingu@block[rounded corners=.1mm]{\csname pingu@color@fish#1@eye\endcsname} (\pingu@name-wing-#1)++(-3.8mm,.25mm) circle[radius=.2mm]; + \endscope +} + + \pingu@create@extra{heart}{% heart/.code = {\pingu@set@extra{heart}{true}\pingu@color{heart}{#1}}, heart/.default = lightgray