%% tikzfins.sty -- aquarium fish and aquascapes drawn with TikZ
%% Version 0.3, 2026/11/04
%%
%% Copyright (C) 2026 Vernon Merrick Fanning
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Vernon Merrick Fanning.
%%
%% This work consists of the files tikzfins.sty, tikzfins-doc.tex
%% and README.md, and the derived file tikzfins-doc.pdf.
%%
%% All drawings in this work are original. They were made from scratch
%% with TikZ paths for this package; none is traced from or based on a
%% photograph or on anyone else's artwork.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tikzfins}[2026/11/04 v0.3 Aquarium fish and aquascapes with TikZ]

\RequirePackage{tikz}
\usetikzlibrary{calc,intersections,shapes.misc,decorations,decorations.pathmorphing}

%% ==================================================================
%% Colours
%% ==================================================================
% general
\definecolor{finspupil}{HTML}{14141A}
\definecolor{finsface}{HTML}{2A1E1E}
\definecolor{finsbone}{HTML}{F4EFE2}
\definecolor{finsboneline}{HTML}{9A8E7B}
\definecolor{finsflesh}{HTML}{F7A99F}
\definecolor{finsskin}{HTML}{F1C29C}
\definecolor{finsskinline}{HTML}{B47F5C}
\definecolor{finssole}{HTML}{E8504A}
\definecolor{finsbubble}{HTML}{E4F5FC}
\definecolor{finsbubbleline}{HTML}{7FC2E2}
\definecolor{finshook}{HTML}{8D949C}
\definecolor{finsline}{HTML}{5F6368}
\definecolor{finsmouth}{HTML}{6E2632}
\definecolor{finslips}{HTML}{E5566F}
\definecolor{finstongue}{HTML}{F48C9A}
\definecolor{finsheart}{HTML}{EF4C68}
\definecolor{finsstar}{HTML}{F9C846}
\definecolor{finsstache}{HTML}{4A3226}
\definecolor{finsmask}{HTML}{A9DDF3}
\definecolor{finsstrap}{HTML}{2F3B4C}
\definecolor{finstube}{HTML}{F28C28}
\definecolor{finscrown}{HTML}{F9C846}
\definecolor{finscrownshade}{HTML}{E0A92A}
\definecolor{finsparty}{HTML}{7EC8F2}
\definecolor{finstophat}{HTML}{2B2B33}
% aquarium
\definecolor{finssoilA}{HTML}{3B2C22}
\definecolor{finssoilB}{HTML}{4B392B}
\definecolor{finssoilC}{HTML}{2E241D}
\definecolor{finssoilD}{HTML}{5B4634}
\definecolor{finssoilE}{HTML}{40312A}
\definecolor{finscoralA}{HTML}{F6F1E6}
\definecolor{finscoralB}{HTML}{E9DFCC}
\definecolor{finscoralC}{HTML}{F5DED6}
\definecolor{finscoralD}{HTML}{DCD3C2}
\definecolor{finscoralE}{HTML}{FFFFFF}
\definecolor{finswater}{HTML}{4FAAD6}
\definecolor{finswatertop}{HTML}{A9E1F3}
\definecolor{finsair}{HTML}{EEF8FC}
\definecolor{finsframe}{HTML}{2F3640}
\definecolor{finssand}{HTML}{EAD4A2}
\definecolor{finsgravelA}{HTML}{C9B99A}
\definecolor{finsgravelB}{HTML}{8E8579}
\definecolor{finsgravelC}{HTML}{E7DCC6}
\definecolor{finsgravelD}{HTML}{B07E5B}
\definecolor{finsgravelE}{HTML}{6F7880}
\definecolor{finsplant}{HTML}{5DAE4B}
\definecolor{finsplantlight}{HTML}{8FCF66}
\definecolor{finsfern}{HTML}{3D7D3A}
\definecolor{finscabomba}{HTML}{86C24A}
\definecolor{finsludwigia}{HTML}{D9443F}
\definecolor{finsmoss}{HTML}{4C8D38}
\definecolor{finsmosslight}{HTML}{7DBE4F}
\definecolor{finskelp}{HTML}{A08F35}
\definecolor{finskelplight}{HTML}{C8B552}
\definecolor{finsanemone}{HTML}{C45E9C}
\definecolor{finsanemonetentacle}{HTML}{DB8DC6}
\definecolor{finsanemonetip}{HTML}{F8CDE8}
\definecolor{finsbrain}{HTML}{C9B66A}
\definecolor{finsstaghorn}{HTML}{BA7DC6}
\definecolor{finsstaghorntip}{HTML}{EDCCF1}
\definecolor{finsstarfish}{HTML}{F0874A}
\definecolor{finsshell}{HTML}{FBE6D4}
\definecolor{finsshellrib}{HTML}{E9A59C}
\definecolor{finswood}{HTML}{8A5A36}
\definecolor{finsrock}{HTML}{9E9B93}
\definecolor{finspebbleA}{HTML}{D8CBB4}
\definecolor{finspebbleB}{HTML}{A9A49B}
\definecolor{finspebbleC}{HTML}{C9A08E}
\definecolor{finspebbleD}{HTML}{8B8F94}
\definecolor{finschest}{HTML}{9A5D2E}
\definecolor{finsiron}{HTML}{6C7078}
\definecolor{finsgem}{HTML}{E6405A}
\definecolor{finscastle}{HTML}{AAADB3}
\definecolor{finssnail}{HTML}{A9693A}
\definecolor{finssnailfoot}{HTML}{E9D6B6}
% fish
\definecolor{finsclown}{HTML}{F2701F}
\definecolor{finsclownbelly}{HTML}{F9A55E}
\definecolor{finsclownblack}{HTML}{1E1A1A}
\definecolor{finstang}{HTML}{2E6FDA}
\definecolor{finstangbelly}{HTML}{5D96EE}
\definecolor{finstangblack}{HTML}{16192B}
\definecolor{finstangyellow}{HTML}{F7D23E}
\definecolor{finsgoldfish}{HTML}{F48A1E}
\definecolor{finsgoldfishbelly}{HTML}{FCC55C}
\definecolor{finsgoldfishfin}{HTML}{F9A443}
\definecolor{finsyellowtang}{HTML}{F9D63A}
\definecolor{finsyellowtangbelly}{HTML}{FCE88A}
\definecolor{finsyellowtangfin}{HTML}{F4C826}
\definecolor{finsangel}{HTML}{E4E9EE}
\definecolor{finsangelbar}{HTML}{2C2F3C}
\definecolor{finsangelfin}{HTML}{EEF2F5}
\definecolor{finsidol}{HTML}{F7F5EE}
\definecolor{finsidolyellow}{HTML}{F7D23E}
\definecolor{finsidolblack}{HTML}{1C1C22}
\definecolor{finsidolsnout}{HTML}{F28C28}
\definecolor{finsbetta}{HTML}{3049BE}
\definecolor{finsbettabelly}{HTML}{5A74DA}
\definecolor{finsbettafin}{HTML}{3651C8}
\definecolor{finsbettaedge}{HTML}{C7263F}
\definecolor{finsguppy}{HTML}{C9C7A6}
\definecolor{finsguppybelly}{HTML}{F1EFE4}
\definecolor{finsguppytail}{HTML}{F2683A}
\definecolor{finsguppyspot}{HTML}{2A1E1E}
\definecolor{finsguppyblue}{HTML}{4FA9D9}
\definecolor{finstetra}{HTML}{D9DED9}
\definecolor{finstetraback}{HTML}{8C8A5E}
\definecolor{finstetrablue}{HTML}{2FB8EE}
\definecolor{finstetraglow}{HTML}{9BE6FF}
\definecolor{finstetrared}{HTML}{E5333E}
\definecolor{finssword}{HTML}{E9492B}
\definecolor{finsswordbelly}{HTML}{F6995A}
\definecolor{finsswordfin}{HTML}{EE5B33}
\definecolor{finsswordyellow}{HTML}{F9C33E}
\definecolor{finsdiscus}{HTML}{E8603C}
\definecolor{finsdiscusbelly}{HTML}{F28E62}
\definecolor{finsdiscusline}{HTML}{3FB4C6}
\definecolor{finsbarb}{HTML}{F1C26A}
\definecolor{finsbarbbelly}{HTML}{FBE4AE}
\definecolor{finsbarbblack}{HTML}{22201F}
\definecolor{finsbarbred}{HTML}{E4413A}
\definecolor{finspuffer}{HTML}{E2CE8E}
\definecolor{finspufferbelly}{HTML}{FAF6EA}
\definecolor{finspufferspot}{HTML}{7A5A3A}
\definecolor{finspufferfin}{HTML}{E8D9A8}
\definecolor{finsseahorse}{HTML}{F4B23A}
\definecolor{finsseahorsebelly}{HTML}{FAD27E}
\definecolor{finsgramma}{HTML}{A93ED0}
\definecolor{finsgrammabelly}{HTML}{C673E2}
\definecolor{finsgrammayellow}{HTML}{F9C73A}
\definecolor{finscory}{HTML}{F1E2D8}
\definecolor{finscorybelly}{HTML}{FBF5F0}
\definecolor{finscoryfin}{HTML}{EFEAE4}
\definecolor{finscoryiris}{HTML}{B8BCC2}
\definecolor{finscorybronze}{HTML}{9C8A55}
\definecolor{finscorybronzebelly}{HTML}{E5D9B5}
\definecolor{finscorybronzefin}{HTML}{CBBE96}
\definecolor{finspleco}{HTML}{5C5741}
\definecolor{finsplecobelly}{HTML}{8A8462}
\definecolor{finsplecospot}{HTML}{EAE0BC}
\definecolor{finsgourami}{HTML}{E5492E}
\definecolor{finsgouramibelly}{HTML}{F27A4E}
\definecolor{finsgouramifin}{HTML}{EC6440}
\definecolor{finsgouramiedge}{HTML}{C8301F}
\definecolor{finsgouramiblue}{HTML}{39B6D8}
\definecolor{finsbluegourami}{HTML}{86AFD8}
\definecolor{finsbluegouramibelly}{HTML}{CFE1F2}
\definecolor{finsbluegouramispot}{HTML}{23304A}
\definecolor{finsbluegouramiedge}{HTML}{F2A24E}
\definecolor{finsdanio}{HTML}{E8DDB4}
\definecolor{finsdaniobelly}{HTML}{F8F4E6}
\definecolor{finsdaniostripe}{HTML}{2E4C8C}
\definecolor{finslion}{HTML}{F7EBDD}
\definecolor{finslionred}{HTML}{A6302A}
\definecolor{finsdamsel}{HTML}{F6F6F2}
\definecolor{finsdamselblack}{HTML}{1D1D24}
\definecolor{finsshark}{HTML}{9A9688}
\definecolor{finssharkbelly}{HTML}{F5F3EE}
\definecolor{finssharktip}{HTML}{1F1F24}
\definecolor{finsmystery}{HTML}{F1C04A}
\definecolor{finsmysteryband}{HTML}{8A5A2B}
\definecolor{finsnerite}{HTML}{C9B04A}
\definecolor{finsneritestripe}{HTML}{2A2418}
\definecolor{finsneritefoot}{HTML}{CFC6B4}
\definecolor{finsramshorn}{HTML}{B9483A}
\definecolor{finsramshornfoot}{HTML}{E0857A}
\definecolor{finschocstar}{HTML}{E8C892}
\definecolor{finschocchip}{HTML}{4A2A1C}
\definecolor{finslinckia}{HTML}{3A6FD0}
\definecolor{finsshrimp}{HTML}{F5B54A}
\definecolor{finsshrimpred}{HTML}{CF2E2E}
\definecolor{finshermitshell}{HTML}{EBD5B0}
\definecolor{finshermitband}{HTML}{A06C45}
\definecolor{finshermit}{HTML}{E0532E}
\definecolor{finsjelly}{HTML}{D7E9F7}
\definecolor{finsjellypink}{HTML}{D987B9}

%% ==================================================================
%% Keys
%% ==================================================================
\newif\iffins@fish
\newif\iffins@bones
\newif\iffins@legs
\newif\iffins@bellyup
\newif\iffins@hooked
\newif\iffins@snorkel
\newif\iffins@moustache
\newif\iffins@scales
\newif\iffins@puffed
\newif\iffins@speed
\newif\iffins@jaws
\newif\iffins@sweat
\newif\iffins@open
\newif\iffins@moss
\newif\iffins@rays
\newif\iffins@backdrop
\newif\iffins@glass

% bones=<n> eats the fish down to the bone (0--3); plain `bones' is 1
\def\fins@true{true}
\def\fins@none{none}
\def\fins@false{false}
\def\fins@setbones#1{%
  \edef\fins@tmp{#1}%
  \ifx\fins@tmp\fins@true
    \def\fins@nbones{1}%
  \else\ifx\fins@tmp\fins@false
    \def\fins@nbones{0}%
  \else
    \pgfmathtruncatemacro\fins@nbones{min(3,max(0,#1))}%
  \fi\fi
  \ifnum\fins@nbones>0 \fins@bonestrue\else\fins@bonesfalse\fi
}

\pgfkeys{
  /fins/.is family,
  /fins/.cd,
  % placement and size
  at/.store in=\fins@at,                 at={(0,0)},
  scale/.store in=\fins@scale,           scale=1,
  rotate/.store in=\fins@rotate,         rotate=0,
  facing/.is choice,
  facing/right/.code={\def\fins@dir{1}},
  facing/left/.code={\def\fins@dir{-1}},
  facing=right,
  belly up/.is if=fins@bellyup,          belly up=false,
  tail/.store in=\fins@tail,             tail=0,
  % face
  eye/.estore in=\fins@eye,              eye=normal,
  eye scale/.store in=\fins@eyescale,    eye scale=1,
  mouth/.estore in=\fins@mouth,          mouth=default,
  % fun
  bones/.code={\fins@setbones{#1}},      bones/.default=1,  bones=0,
  legs/.is if=fins@legs,                 legs=false,
  hooked/.is if=fins@hooked,             hooked=false,
  line length/.store in=\fins@linelength, line length=4,
  bubbles/.store in=\fins@bubbles,       bubbles/.default=3, bubbles=0,
  says/.store in=\fins@says,             says=,
  thinks/.store in=\fins@thinks,         thinks=,
  hat/.estore in=\fins@hat,              hat=none,
  snorkel/.is if=fins@snorkel,           snorkel=false,
  moustache/.is if=fins@moustache,       moustache=false,
  puffed/.is if=fins@puffed,             puffed=false,
  speed/.is if=fins@speed,               speed=false,
  gape/.store in=\fins@gape,             gape=110,
  sweat/.is if=fins@sweat,               sweat=false,
  type/.estore in=\fins@type,            type=,
  stripes/.store in=\fins@stripes,       stripes=3,
  arms/.store in=\fins@arms,             arms=5,
  scales/.is if=fins@scales,
  % schools and randomness
  school/.store in=\fins@school,         school=1,
  school spread/.store in=\fins@spread,  school spread=1,
  seed/.store in=\fins@seed,             seed=1,
  % colours (any xcolor expression)
  body/.code={\colorlet{fins@c@body}{#1}%
              \colorlet{fins@c@belly}{fins@c@body!50!white}%
              \colorlet{fins@c@outline}{fins@c@body!50!black}},
  belly/.code={\colorlet{fins@c@belly}{#1}},
  back/.code={\colorlet{fins@c@back}{#1}},
  back opacity/.store in=\fins@backop,   back opacity=0.14,
  fin/.code={\colorlet{fins@c@fin}{#1}},
  fin opacity/.store in=\fins@finop,     fin opacity=0.92,
  pattern/.code={\colorlet{fins@c@pattern}{#1}},
  accent/.code={\colorlet{fins@c@accent}{#1}},
  outline/.code={\colorlet{fins@c@outline}{#1}},
  iris/.code={\colorlet{fins@c@iris}{#1}},
  inside/.code={\colorlet{fins@c@flesh}{#1}},
  % aquarium components
  height/.store in=\fins@height,         height=1,
  width/.store in=\fins@width,           width=1,
  radius/.store in=\fins@radius,         radius=1.8,
  count/.store in=\fins@count,           count=1,
  sway/.store in=\fins@sway,             sway=0,
  variant/.store in=\fins@variant,       variant=1,
  open/.is if=fins@open,                 open=true,
  moss/.is if=fins@moss,                 moss=false,
  face/.estore in=\fins@face,            face=none,
  water/.code={\colorlet{fins@c@water}{#1}},
  water level/.store in=\fins@level,     water level=0.88,
  substrate/.estore in=\fins@substrate,  substrate=sand,
  substrate height/.store in=\fins@subh, substrate height=1,
  sand/.code={\colorlet{fins@c@sand}{#1}},
  frame/.code={\colorlet{fins@c@frame}{#1}},
  light rays/.is if=fins@rays,           light rays=true,
  backdrop/.is if=fins@backdrop,         backdrop=true,
  glass/.is if=fins@glass,               glass=true,
}

% global defaults that every drawing may rely on
\colorlet{fins@c@body}{gray}
\colorlet{fins@c@belly}{white}
\colorlet{fins@c@back}{black}
\colorlet{fins@c@fin}{gray}
\colorlet{fins@c@pattern}{black}
\colorlet{fins@c@accent}{white}
\colorlet{fins@c@outline}{black!70}
\colorlet{fins@c@iris}{finspupil}
\colorlet{fins@c@flesh}{finsflesh}
\colorlet{fins@c@water}{finswater}
\colorlet{fins@c@sand}{finssand}
\colorlet{fins@c@frame}{finsframe}

%% ==================================================================
%% Shared machinery
%% ==================================================================
% Line widths do not follow TikZ's `scale', so derive them from the key.
\def\fins@setwidths{%
  \pgfmathsetlengthmacro\fins@lw{0.6pt*\fins@scale}%
  \pgfmathsetlengthmacro\fins@flw{0.85pt*\fins@scale}%
}

% A cheap deterministic "random" number in [0,1) from two integers.
% (pgf's own generator keeps its state locally, so it repeats inside
% \foreach; this hash does not care.)
\def\fins@hash#1#2{%
  \pgfmathtruncatemacro\fins@hA{#1}\pgfmathtruncatemacro\fins@hB{#2}%
  \fins@mod\fins@hA{\fins@hA}%
  \fins@mod\fins@hB{\fins@hB}%
  \fins@mod\fins@hC{\fins@hA*\fins@hA}%
  \fins@mod\fins@hC{\fins@hC*547+\fins@hA*1453+\fins@hB*9973+1013}%
  \fins@mod\fins@hC{\fins@hC*\fins@hC+\fins@hB*31}%
  \pgfmathsetmacro\fins@h{\fins@hC/997}%
}
% the same for integer arguments, without pgfmath: sets \fins@hC to 0..996
\def\fins@ihash#1#2{%
  \fins@mod\fins@hA{#1}\fins@mod\fins@hB{#2}%
  \fins@mod\fins@hC{\fins@hA*\fins@hA}%
  \fins@mod\fins@hC{\fins@hC*547+\fins@hA*1453+\fins@hB*9973+1013}%
  \fins@mod\fins@hC{\fins@hC*\fins@hC+\fins@hB*31}%
}
% \fins@mod\macro{integer expression}: the expression modulo 997, >= 0
\def\fins@mod#1#2{%
  \count@=\numexpr#2\relax
  \count@=\numexpr\count@-(\count@/997)*997\relax
  \ifnum\count@<0 \advance\count@ 997 \fi
  \edef#1{\the\count@}%
}

\tikzset{
  fins outline/.style={draw=fins@c@outline, line width=\fins@lw,
                       line join=round, line cap=round},
  fins face/.style={draw=finsface, line width=\fins@flw,
                    line join=round, line cap=round},
}

% A thick outlined stroke: #1 = path, #2 = colour, #3 = outline colour,
% #4 = width in cm
\def\fins@tube#1#2#3#4{%
  \pgfmathsetlengthmacro\fins@tubew{#4*28.45274pt*\fins@scale}%
  \draw[#3, line width=\fins@tubew+1.6*\fins@lw, line cap=round, line join=round] #1;
  \draw[#2, line width=\fins@tubew, line cap=round, line join=round] #1;
}

%% ------------------------------------------------------------------
%% Body shading
%%   \fins@bodystart{<path>}{<belly depth>}
%%      ... patterns, drawn inside the body ...
%%   \fins@bodyend{<path>}{<back depth>}
%% The belly is the part of the body that a copy of the body, moved up
%% by <belly depth>, does not cover; the shaded back works the same way
%% from below.  Both follow the outline, so every fish gets
%% counter-shading for free.
%% ------------------------------------------------------------------
\def\fins@bodystart#1#2{%
  \begin{scope}[overlay]
  \clip #1;
  \fill[fins@c@body] #1;
  \begin{scope}[yshift=#2cm]
    \fill[fins@c@belly, even odd rule] (-6,-6) rectangle (6,6) #1;
  \end{scope}
}
\def\fins@bodyend#1#2{%
  \begin{scope}[yshift=-#2cm]
    \fill[fins@c@back, opacity=\fins@backop, even odd rule] (-6,-6) rectangle (6,6) #1;
  \end{scope}
  \end{scope}
  \path[fins outline] #1;
}
% a soft highlight stroke
\def\fins@shine#1{%
  \draw[white, opacity=0.45, line width=2.6*\fins@lw, line cap=round] #1;
}
% the edge of the gill cover
\def\fins@gill#1{%
  \draw[fins@c@outline, opacity=0.55, line width=0.9*\fins@lw, line cap=round] #1;
}
% rows of overlapping scales between x #1..#2, y #3..#4, size #5.
% Each scale is one Bezier arc from 125 to 235 degrees, written straight
% to the output (the current transformation is applied by hand).
\newdimen\fins@qr
\def\fins@tpoint#1#2#3{% user x, user y (dimen expressions), macro for "{x}{y}"
  \fins@qx=\dimexpr\fins@ta\dimexpr#1\relax+\fins@tc\dimexpr#2\relax+\fins@te\relax
  \fins@qy=\dimexpr\fins@tb\dimexpr#1\relax+\fins@td\dimexpr#2\relax+\fins@tf\relax
  \edef#3{{\the\fins@qx}{\the\fins@qy}}%
}
\def\fins@scaletexture#1#2#3#4#5{%
  \iffins@scales
    \begin{pgfscope}
      \pgfsetstrokecolor{fins@c@outline}\pgfsetstrokeopacity{0.22}%
      \pgfsetlinewidth{0.6*\fins@lw}%
      \pgfgettransformentries{\fins@ta}{\fins@tb}{\fins@tc}{\fins@td}{\fins@te}{\fins@tf}%
      \pgfmathsetlength\fins@qr{#5cm}%
      \pgfmathtruncatemacro\fins@ncols{(#2-(#1))/#5}%
      \pgfmathtruncatemacro\fins@nrows{(#4-(#3))/(0.8*#5)}%
      \pgfmathsetlengthmacro\fins@sxa{#1cm}\pgfmathsetlengthmacro\fins@sya{#3cm}%
      \foreach \fins@r in {0,...,\fins@nrows}{%
        \fins@cc=0 \fins@scalerow
      }%
      \pgfsys@stroke
    \end{pgfscope}
  \fi
}
\def\fins@scalerow{%
  \ifnum\fins@cc>\fins@ncols\else
    \fins@qux=\dimexpr\fins@sxa+\fins@cc\fins@qr\relax
    \ifodd\fins@r \advance\fins@qux by 0.5\fins@qr \fi
    \fins@quy=\dimexpr\fins@sya+0.8\fins@qr*\fins@r\relax
    \fins@tpoint{\fins@qux-0.5736\fins@qr}{\fins@quy+0.8192\fins@qr}\fins@pA
    \fins@tpoint{\fins@qux-1.1422\fins@qr}{\fins@quy+0.4211\fins@qr}\fins@pB
    \fins@tpoint{\fins@qux-1.1422\fins@qr}{\fins@quy-0.4211\fins@qr}\fins@pC
    \fins@tpoint{\fins@qux-0.5736\fins@qr}{\fins@quy-0.8192\fins@qr}\fins@pD
    \edef\fins@qcmd{\noexpand\pgfsys@moveto\fins@pA
      \noexpand\pgfsys@curveto\fins@pB\fins@pC\fins@pD}%
    \fins@qcmd
    \advance\fins@cc 1
    \expandafter\fins@scalerow
  \fi
}

%% ------------------------------------------------------------------
%% Fins
%%   \fins@fin{<colour>}{<path>}{A}{B}{C}{D}{<n>}
%% fills the fin, then draws n+1 rays from points along A--B to points
%% along C--D (all clipped to the fin).  A fan-shaped fin uses A = B.
%% \fins@edgedfin{<colour>}{<edge colour>}{...same...} adds a dark rim.
%% ------------------------------------------------------------------
\def\fins@fin#1#2#3#4#5#6#7{%
  \fill[#1, fill opacity=\fins@finop] #2;
  \fins@rays{#1}{#2}{#3}{#4}{#5}{#6}{#7}%
  \path[draw=#1!55!black, line width=0.55*\fins@lw, line join=round] #2;
}
% The rays are computed with plain TeX arithmetic and drawn as one path.
\def\fins@xy(#1,#2)#3#4{\pgfmathsetlength#3{#1cm}\pgfmathsetlength#4{#2cm}}
\newdimen\fins@rax \newdimen\fins@ray \newdimen\fins@rbx \newdimen\fins@rby
\newdimen\fins@rcx \newdimen\fins@rcy \newdimen\fins@rdx \newdimen\fins@rdy
\def\fins@rays#1#2#3#4#5#6#7{%
  \ifnum#7>0
    \fins@xy#3\fins@rax\fins@ray \fins@xy#4\fins@rbx\fins@rby
    \fins@xy#5\fins@rcx\fins@rcy \fins@xy#6\fins@rdx\fins@rdy
    \gdef\fins@raylist{}%
    \fins@cc=0
    \loop
      \xdef\fins@raylist{\fins@raylist
        (\the\dimexpr\fins@rax+(\fins@rbx-\fins@rax)*\fins@cc/#7\relax,
         \the\dimexpr\fins@ray+(\fins@rby-\fins@ray)*\fins@cc/#7\relax) --
        (\the\dimexpr\fins@rcx+(\fins@rdx-\fins@rcx)*\fins@cc/#7\relax,
         \the\dimexpr\fins@rcy+(\fins@rdy-\fins@rcy)*\fins@cc/#7\relax)}%
      \advance\fins@cc 1
    \ifnum\fins@cc>#7 \else\repeat
    \begin{scope}[overlay]
      \clip #2;
      \draw[#1!60!black, opacity=0.4, line width=0.55*\fins@lw] \fins@raylist;
    \end{scope}
  \fi
}
\def\fins@edgedfin#1#2#3#4#5#6#7#8{%
  \fill[#1, fill opacity=\fins@finop] #3;
  \fins@rays{#1}{#3}{#4}{#5}{#6}{#7}{#8}%
  \begin{scope}[overlay]
    \clip #3;
    \draw[#2, line width=3.2*\fins@lw, line join=round] #3;
  \end{scope}
  \path[draw=#2, line width=0.55*\fins@lw, line join=round] #3;
}
% rotate the tail fin around the peduncle by `tail'
\def\fins@tailscope#1#2#3{%
  \begin{scope}[rotate around={\fins@tail:(#1,#2)}]#3\end{scope}%
}

%% ------------------------------------------------------------------
%% Opening and closing every fish
%%   \fins@prepare{<fish defaults>}{<user options>}
%%   \fins@open  ... drawing ...  \fins@close
%% Each fish declares where things go (fish face right, nose at +x):
%%   \fins@eyespot{x}{y}{radius}
%%   \fins@mouthspot{x}{y}{angle}{size}
%%   \fins@topspot{x}{y}{angle}{size}           for hats
%%   \fins@legspots{back x}{front x}{belly y}{size}
%%   \fins@skeleton{tail x}{tail y}{gill x}{gill y}{tail size}   for bones
%% ------------------------------------------------------------------
\def\fins@eyespot#1#2#3{\def\fins@eyedata{{#1}{#2}{#3}}}
\def\fins@mouthspot#1#2#3#4{\def\fins@mouthdata{{#1}{#2}{#3}{#4}}}
\def\fins@topspot#1#2#3#4{\def\fins@topdata{{#1}{#2}{#3}{#4}}}
\def\fins@legspots#1#2#3#4{\def\fins@legdata{{#1}{#2}{#3}{#4}}}
\def\fins@skeleton#1#2#3#4#5{\def\fins@skeldata{{#1}{#2}{#3}{#4}{#5}}}
%%   \fins@eyespotb{x}{y}{radius}   a second eye, for animals facing us
%%   \fins@tailend{x}{y}{half height}   where speed lines start
\def\fins@eyespotb#1#2#3{\def\fins@eyedataB{{#1}{#2}{#3}}}
\def\fins@tailend#1#2#3{\def\fins@taildata{{#1}{#2}{#3}}}

\def\fins@prepare#1#2{%
  \begingroup
  \fins@fishtrue
  \let\fins@skeldata\relax
  \def\fins@bodypath{(0,0) circle (0.5)}%
  \fins@eyespot{0.9}{0.15}{0.1}%
  \fins@mouthspot{1.2}{0}{0}{1}%
  \fins@topspot{0.5}{0.6}{0}{0.7}%
  \fins@legspots{-0.2}{0.3}{-0.5}{1}%
  \let\fins@eyedataB\relax
  \fins@tailend{-1.6}{0}{0.35}%
  \let\fins@jawdata\relax\def\fins@canjaw{1}%
  \pgfkeys{/fins/.cd,#2}% first pass: learn puffed, ...
  #1%                    fish defaults (may depend on the first pass)
  \pgfkeys{/fins/.cd,#2}% second pass: user colours win
  \fins@setwidths
}
\def\fins@open{%
  \iffins@bellyup\def\fins@ysign{-1}\else\def\fins@ysign{1}\fi
  % TikZ will not expand a macro where it expects a coordinate,
  % so hand the stored `at' coordinate over already expanded.
  \expandafter\fins@openscope\expandafter{\fins@at}%
  \begin{scope}[rotate=\fins@rotate, xscale=\fins@dir, yscale=\fins@ysign]%
  \iffins@legs\expandafter\fins@drawlegs\fins@legdata\fi
  \iffins@speed\expandafter\fins@drawspeed\fins@taildata\fi
  \iffins@bones
    \ifx\fins@skeldata\relax
      \PackageWarning{tikzfins}{This one has no bones to show;
        ignoring `bones'}%
      \fins@bonesfalse
    \else
      \expandafter\fins@cutopen\fins@skeldata
    \fi
  \fi
  \fins@jawsfalse
  \ifx\fins@mouth\fins@chompname\ifnum\fins@canjaw=1 \fins@jawstrue\fi\fi
  \iffins@jaws\fins@jawopen\fi
}
\def\fins@openscope#1{\begin{scope}[shift={#1}, scale=\fins@scale]}
\def\fins@close{%
  \iffins@jaws\fins@jawclose\fi
  \expandafter\fins@draweye\fins@eyedata
  \ifx\fins@eyedataB\relax\else\expandafter\fins@draweye\fins@eyedataB\fi
  \expandafter\fins@drawmouth\fins@mouthdata
  \iffins@sweat\expandafter\fins@drawsweat\fins@eyedata\fi
  \iffins@snorkel\fins@drawsnorkel\fi
  \iffins@bones\expandafter\fins@cutclose\fins@skeldata\fi
  \expandafter\fins@drawhat\fins@topdata
  \end{scope}%
  \fins@effects
  \end{scope}%
  \endgroup
}

%% ------------------------------------------------------------------
%% Schools: the user command draws one fish, or a whole school
%% ------------------------------------------------------------------
\def\fins@newfish#1{%
  \expandafter\newcommand\csname #1\endcsname[1][]{\fins@schoolof{#1}{##1}}%
}
\def\fins@schoolof#1#2{%
  \begingroup
  \pgfkeys{/fins/.cd,#2}%
  \ifnum\fins@school>1
    \pgfmathtruncatemacro\fins@last{\fins@school-1}%
    \foreach \fins@m in {\fins@last,...,0}{%
      \fins@hash{\fins@m}{\fins@seed}\let\fins@ha\fins@h
      \fins@hash{\fins@m+31}{\fins@seed}\let\fins@hb\fins@h
      \fins@hash{\fins@m+67}{\fins@seed}\let\fins@hc\fins@h
      % three loose rows trailing behind the leader
      \pgfmathsetmacro\fins@row{mod(\fins@m,3)==1 ? 1 : (mod(\fins@m,3)==2 ? -1 : 0)}%
      \pgfmathsetmacro\fins@sx{-\fins@dir*\fins@spread*\fins@scale
        *(\fins@m*1.45+0.5*\fins@ha)}%
      \pgfmathsetmacro\fins@sy{\fins@spread*\fins@scale
        *(\fins@row*1.05+0.4*(\fins@hb-0.5))}%
      \pgfmathsetmacro\fins@ss{\fins@scale*(0.8+0.2*\fins@hc)}%
      \ifnum\fins@m=0
        \def\fins@sx{0}\def\fins@sy{0}\let\fins@ss\fins@scale
        \def\fins@extra{}%
      \else
        \def\fins@extra{says=,thinks=,hooked=false,bubbles=0}%
      \fi
      \edef\fins@args{\unexpanded{#2},scale=\fins@ss,\fins@extra}%
      \begin{scope}[shift={(\fins@sx,\fins@sy)}]
        \expandafter\fins@callfish\expandafter{\fins@args}{#1}%
      \end{scope}
    }%
  \else
    \fins@callfish{#2}{#1}%
  \fi
  \endgroup
}
\def\fins@callfish#1#2{\csname fins@draw@#2\endcsname{#1}}

%% ------------------------------------------------------------------
%% Bones: everything behind the cut is eaten down to the skeleton.
%% The cut is a row of bite marks at x = tail + n/3 of the way to the
%% gill, so bones=3 leaves only the head.
%% ------------------------------------------------------------------
\def\fins@scallops{\foreach \fins@k in {1,...,14}{arc (90:-90:0.15)}}
\def\fins@cutopen#1#2#3#4#5{%
  \pgfmathsetmacro\fins@cx{#1+\fins@nbones/3*(#3-#1)}%
  \begin{scope}
  % pgf leaves everything drawn after a \clip out of the picture size,
  % and this clip path is huge.  So forget the clip path's own size and
  % let the rest of the fish count again.
  \fins@savebb
  \ifpgf@relevantforpicturesize\def\fins@recount{\pgf@relevantforpicturesizetrue}%
  \else\let\fins@recount\relax\fi
  \clip (9,2.1) -- (\fins@cx,2.1) \fins@scallops -- (9,-2.1) -- cycle;
  \fins@restorebb
  \fins@recount
}
\def\fins@savebb{%
  \edef\fins@restorebb{%
    \global\pgf@picminx=\the\pgf@picminx\relax\global\pgf@picmaxx=\the\pgf@picmaxx\relax
    \global\pgf@picminy=\the\pgf@picminy\relax\global\pgf@picmaxy=\the\pgf@picmaxy\relax}%
}
%% ------------------------------------------------------------------
%% Jaws: mouth=chomp opens the fish's own head into a toothed gape,
%% ready to feed.  The gape is a wedge whose corner, the hinge of the
%% jaws, sits inside the head, under the eye: everything inside the
%% wedge is cut away, the cut edges become the jaws, and teeth line both
%% of them.  `gape' is the opening in degrees, of which a share goes to
%% the upper jaw; the upper jaw always passes below the eye.
%%   \fins@jawspot{hinge x}{hinge y}{direction}{upper share}
%% places the hinge by hand; by default it sits behind and below the
%% eye, opening along the mouth.
%% ------------------------------------------------------------------
\def\fins@jawspot#1#2#3#4{\def\fins@jawdata{{#1}{#2}{#3}{#4}}}
\def\fins@chompname{chomp}
\def\fins@jawsetup{%
  \path[overlay, name path=fins@jbody] \fins@bodypath;
  \ifx\fins@jawdata\relax
    \expandafter\expandafter\expandafter\fins@jawdefault
      \expandafter\fins@eyedata\fins@mouthdata
  \fi
  \expandafter\fins@jawangles\fins@jawdata
  \expandafter\fins@jawgeometry\fins@jawdata
}
\def\fins@jawdefault#1#2#3#4#5#6#7{% eye x, y, r; mouth x, y, angle, size
  % the hinge is behind the eye, as far again as the eye is from the
  % mouth, and well below it, but not too near the belly
  \pgfmathsetmacro\fins@jx{(#1)-max(0.8*((#4)-(#1)),0.15)}%
  \edef\fins@jhx{\fins@jx}\def\fins@jhy{#2}%
  \fins@jawend{fins@jB}{-90}%
  \fins@eyesize
  \pgfmathsetmacro\fins@jR{\fins@ek*(#3)*\fins@eyescale+0.03}%
  \pgfmathsetmacro\fins@jy{max(\fins@jey+0.3*((#2)-\fins@jey), min(#5,(#2)-2.2*\fins@jR))}%
  \edef\fins@jawdata{{\fins@jx}{\fins@jy}{#6}{0.45}}%
}
% the angles of the two jaw edges, \fins@jup and \fins@jlo
\def\fins@jawangles#1#2#3#4{% hinge x, y, direction, upper share
  \pgfmathsetmacro\fins@jup{(#3)+(#4)*\fins@gape}%
  \expandafter\fins@jaweye\fins@eyedata{#1}{#2}%
  \pgfmathsetmacro\fins@jlo{max((#3)-((1-(#4))*\fins@gape)-max(0,(#3)+(#4)*\fins@gape-\fins@jup),-85)}%
  \pgfmathsetmacro\fins@jmid{0.5*(\fins@jup+\fins@jlo)}%
}
% the upper jaw edge may rise no higher than the tangent below the eye
\def\fins@eyesize{% how far an eye reaches, in eye radii
  \def\fins@ek{1.12}%
  \def\fins@tmp{googly}\ifx\fins@eye\fins@tmp\def\fins@ek{1.45}\fi
  \def\fins@tmp{big}\ifx\fins@eye\fins@tmp\def\fins@ek{1.45}\fi
  \def\fins@tmp{dizzy}\ifx\fins@eye\fins@tmp\def\fins@ek{1.25}\fi
  \def\fins@tmp{starry}\ifx\fins@eye\fins@tmp\def\fins@ek{1.45}\fi
  \def\fins@tmp{angry}\ifx\fins@eye\fins@tmp\def\fins@ek{1.6}\fi
}
\def\fins@jaweye#1#2#3#4#5{% eye x, y, radius; hinge x, y
  \fins@eyesize
  \pgfmathsetmacro\fins@jR{\fins@ek*(#3)*\fins@eyescale+0.03}%
  \pgfmathsetmacro\fins@jd{veclen((#1)-(#4),(#2)-(#5))}%
  \pgfmathparse{\fins@jd>\fins@jR ? 1 : 0}%
  \ifnum\pgfmathresult=1
    \pgfmathsetmacro\fins@jmax{atan2((#2)-(#5),(#1)-(#4))-asin(\fins@jR/\fins@jd)}%
    \pgfmathsetmacro\fins@jup{max(-80,min(\fins@jup,\fins@jmax))}%
  \fi
}
% where each jaw edge leaves the body, and the gape as a path
\def\fins@jawgeometry#1#2#3#4{%
  \def\fins@jhx{#1}\def\fins@jhy{#2}%
  \fins@jawend{fins@jU}{\fins@jup}%
  \let\fins@jux\fins@jex\let\fins@juy\fins@jey\let\fins@jul\fins@jel
  \fins@jawend{fins@jL}{\fins@jlo}%
  \let\fins@jlx\fins@jex\let\fins@jly\fins@jey\let\fins@jll\fins@jel
  % the gape, drawn clockwise so that it cuts a hole in a
  % counter-clockwise rectangle; it reaches a little past the lips
  \pgfmathsetmacro\fins@jR{max(\fins@jul,\fins@jll)+0.8}%
  \pgfmathsetmacro\fins@jpx{#1+\fins@jR*cos(\fins@jmid)}%
  \pgfmathsetmacro\fins@jpy{#2+\fins@jR*sin(\fins@jmid)}%
  \pgfmathsetmacro\fins@juxx{\fins@jux+0.5*cos(\fins@jup)}%
  \pgfmathsetmacro\fins@juyy{\fins@juy+0.5*sin(\fins@jup)}%
  \pgfmathsetmacro\fins@jlxx{\fins@jlx+0.5*cos(\fins@jlo)}%
  \pgfmathsetmacro\fins@jlyy{\fins@jly+0.5*sin(\fins@jlo)}%
  \edef\fins@jawhole{(-9,-9) -- (9,-9) -- (9,9) -- (-9,9) -- cycle
    (#1,#2) -- (\fins@jux,\fins@juy) -- (\fins@juxx,\fins@juyy) -- (\fins@jpx,\fins@jpy)
    -- (\fins@jlxx,\fins@jlyy) -- (\fins@jlx,\fins@jly) -- cycle}%
  \edef\fins@jawedge{(\fins@jux,\fins@juy) -- (#1,#2) -- (\fins@jlx,\fins@jly)}%
}
% the point where the ray from the hinge at angle #2 leaves the body
\def\fins@jawend#1#2{%
  \path[overlay, name path=fins@jray] (\fins@jhx,\fins@jhy) -- ++(#2:5);
  \path[overlay, name intersections={of=fins@jbody and fins@jray, name=#1,
        sort by=fins@jray, total=\fins@t}] \pgfextra{\xdef\fins@jn{\fins@t}};
  \ifnum\fins@jn>0
    \pgfpointanchor{#1-1}{center}%
    \edef\fins@tx{\the\pgf@x}\edef\fins@ty{\the\pgf@y}%
    \pgfmathsetmacro\fins@jex{\fins@tx/28.45274}%
    \pgfmathsetmacro\fins@jey{\fins@ty/28.45274}%
  \else
    \pgfmathsetmacro\fins@jex{\fins@jhx+0.45*cos(#2)}%
    \pgfmathsetmacro\fins@jey{\fins@jhy+0.45*sin(#2)}%
  \fi
  \pgfmathsetmacro\fins@jel{veclen(\fins@jex-\fins@jhx,\fins@jey-\fins@jhy)}%
}
\def\fins@jawopen{%
  \fins@jawsetup
  \begin{scope}
  \fins@savebb
  \ifpgf@relevantforpicturesize\def\fins@recount{\pgf@relevantforpicturesizetrue}%
  \else\let\fins@recount\relax\fi
  \clip \fins@jawhole;
  \fins@restorebb
  \fins@recount
}
\def\fins@jawclose{%
  \end{scope}%
  % the inside of the mouth shows along the cut
  \begin{scope}[overlay]
    \clip \fins@bodypath;
    \clip \fins@jawhole;
    \draw[finsmouth, line width=6*\fins@lw, line join=round] \fins@jawedge;
  \end{scope}
  \draw[fins outline, line width=1.1*\fins@lw] \fins@jawedge;
  \fins@teeth{\fins@jup}{\fins@jul}{-90}%
  \fins@teeth{\fins@jlo}{\fins@jll}{90}%
}
% a row of teeth along one jaw edge: edge angle, edge length, and the
% turn (-90 or 90) from the edge into the gape.  Teeth grow towards the
% lips, and every other one is shorter.
\def\fins@teeth#1#2#3{%
  \pgfmathtruncatemacro\fins@tn{max(3,round(0.84*#2/0.072))}%
  \pgfmathsetmacro\fins@tb{0.84*#2/\fins@tn}%
  \pgfmathsetmacro\fins@tca{cos(#1)}\pgfmathsetmacro\fins@tsa{sin(#1)}%
  \pgfmathsetmacro\fins@tcn{cos(#1+#3)}\pgfmathsetmacro\fins@tsn{sin(#1+#3)}%
  \pgfmathtruncatemacro\fins@tlast{\fins@tn-1}%
  \gdef\fins@toothlist{}%
  \foreach \fins@i in {0,...,\fins@tlast}{%
    \pgfmathsetmacro\fins@s{0.15*#2+\fins@i*\fins@tb}%
    \pgfmathsetmacro\fins@m{\fins@s+0.5*\fins@tb}%
    \pgfmathsetmacro\fins@h{\fins@tb*(1.15+0.85*\fins@m/#2)*(mod(\fins@i,2)==0 ? 1 : 0.68)}%
    \pgfmathsetmacro\fins@ax{\fins@jhx+\fins@s*\fins@tca}%
    \pgfmathsetmacro\fins@ay{\fins@jhy+\fins@s*\fins@tsa}%
    \pgfmathsetmacro\fins@bx{\fins@ax+\fins@tb*\fins@tca}%
    \pgfmathsetmacro\fins@by{\fins@ay+\fins@tb*\fins@tsa}%
    \pgfmathsetmacro\fins@px{\fins@jhx+(\fins@m+0.12*\fins@h)*\fins@tca+\fins@h*\fins@tcn}%
    \pgfmathsetmacro\fins@py{\fins@jhy+(\fins@m+0.12*\fins@h)*\fins@tsa+\fins@h*\fins@tsn}%
    \xdef\fins@toothlist{\fins@toothlist
      (\fins@ax,\fins@ay) -- (\fins@px,\fins@py) -- (\fins@bx,\fins@by)}%
  }%
  \filldraw[fill=white, draw=fins@c@outline, line width=0.5*\fins@lw, line join=round]
    \fins@toothlist;
}
\def\fins@bone#1#2{% path, width factor
  \draw[finsboneline, line width=#2*\fins@lw+1.5*\fins@lw, line cap=round] #1;
  \draw[finsbone, line width=#2*\fins@lw, line cap=round] #1;
}
\def\fins@cutclose#1#2#3#4#5{%
  \end{scope}% the flesh
  % the skeleton shows wherever the flesh has gone
  \begin{scope}[overlay]
    \clip (-9,2.1) -- (\fins@cx,2.1) \fins@scallops -- (-9,-2.1) -- cycle;
    \clip \fins@bodypath;
    \pgfmathsetmacro\fins@ribA{#1+0.16}%
    \pgfmathsetmacro\fins@ribB{#1+0.37}%
    \pgfmathsetmacro\fins@ribZ{\fins@cx+0.1}%
    \foreach \fins@x in {\fins@ribA,\fins@ribB,...,\fins@ribZ}{%
      \pgfmathsetmacro\fins@y{#2+(\fins@x-(#1))/((#3)-(#1))*((#4)-(#2))}%
      \fins@bone{(\fins@x,\fins@y) .. controls (\fins@x+0.03,\fins@y+0.5)
        and (\fins@x+0.12,\fins@y+0.9) .. (\fins@x+0.24,\fins@y+1.7)}{1.4}%
      \fins@bone{(\fins@x,\fins@y) .. controls (\fins@x+0.03,\fins@y-0.5)
        and (\fins@x+0.12,\fins@y-0.9) .. (\fins@x+0.24,\fins@y-1.7)}{1.4}%
    }%
    \pgfmathsetmacro\fins@ey{#2+(\fins@cx+0.3-(#1))/((#3)-(#1))*((#4)-(#2))}%
    \fins@bone{(#1,#2) -- (\fins@cx+0.3,\fins@ey)}{3.6}%
  \end{scope}
  % a bony tail
  \begin{scope}[shift={(#1,#2)}, scale=#5]
    \fins@bone{(0,0) -- (-0.46,0.38) (0,0) -- (-0.46,-0.38)
               (0,0) -- (-0.4,0.15) (0,0) -- (-0.4,-0.15)}{1.8}%
    \fill[finsboneline] (0,0) circle (0.045);
    \fill[finsbone] (0,0) circle (0.032);
  \end{scope}
  % the bitten edge: a band of flesh, then the outline
  \begin{scope}[overlay]
    \clip \fins@bodypath;
    \clip (9,2.1) -- (\fins@cx,2.1) \fins@scallops -- (9,-2.1) -- cycle;
    \draw[fins@c@flesh, line width=6*\fins@lw] (\fins@cx,2.1) \fins@scallops;
  \end{scope}
  \begin{scope}[overlay]
    \clip \fins@bodypath;
    \draw[fins@c@outline, line width=\fins@lw] (\fins@cx,2.1) \fins@scallops;
  \end{scope}
}

%% ------------------------------------------------------------------
%% Legs (for fish that have had enough of water)
%% ------------------------------------------------------------------
\def\fins@leg#1{% #1 = skin colour
  \fins@tube{(0,0.18) -- (0.05,-0.22) -- (-0.01,-0.47)}{#1}{finsskinline}{0.085}%
  \fins@tube{(-0.012,-0.43) -- (-0.01,-0.5)}{white}{finsskinline}{0.09}%
  \filldraw[fill=white, draw=finsskinline, line width=0.7*\fins@lw, line join=round]
    (-0.08,-0.5) .. controls (-0.08,-0.45) and (0.0,-0.44) .. (0.05,-0.47)
    .. controls (0.14,-0.5) and (0.21,-0.52) .. (0.21,-0.57) -- (-0.08,-0.57) -- cycle;
  \filldraw[fill=finssole, draw=finsskinline, line width=0.7*\fins@lw, rounded corners=0.6pt]
    (-0.09,-0.565) rectangle (0.22,-0.61);
  \draw[finsskinline, line width=0.6*\fins@lw, line cap=round]
    (0.02,-0.475) -- (0.06,-0.515) (0.07,-0.49) -- (0.11,-0.53);
}
\def\fins@drawlegs#1#2#3#4{% back x, front x, belly y, size
  \begin{scope}[shift={(#1,#3)}, scale=#4]\fins@leg{finsskin!85!black}\end{scope}
  \begin{scope}[shift={(#2,#3)}, scale=#4]\fins@leg{finsskin}\end{scope}
}

%% ==================================================================
%% Eyes and mouths
%% ==================================================================
% All eyes are drawn with radius 0.1 around (0,0), looking towards +x.
\def\fins@eye@normal{%
  \fill[fins@c@iris] (0,0) circle (0.1);
  \fill[finspupil] (0.008,0) circle (0.063);
  \fill[white] (0.032,0.032) circle (0.024);
  \fill[white, opacity=0.6] (-0.03,-0.034) circle (0.011);
  \draw[fins@c@outline, line width=0.7*\fins@lw] (0,0) circle (0.1);
}
\def\fins@eye@googly{%
  \filldraw[fill=white, draw=finsface, line width=0.9*\fins@flw] (0,0) circle (0.14);
  \fill[finspupil] (0.035,-0.052) circle (0.072);
  \draw[black!18, line width=1.3*\fins@flw, line cap=round] (-0.1,0.03) arc (165:115:0.105);
}
\def\fins@eye@big{%
  \filldraw[fill=white, draw=finsface, line width=0.8*\fins@flw] (0,0.01) circle (0.14);
  \fill[finspupil] (0.02,0.0) circle (0.038);
  \fill[white] (0.032,0.012) circle (0.011);
}
\def\fins@eye@sleepy{%
  \fins@eye@normal
  \filldraw[fill=fins@c@body!88!black, draw=finsface, line width=0.8*\fins@flw]
    (-0.112,0.0) arc (180:0:0.112) -- cycle;
  \draw[finsface, line width=0.8*\fins@flw, line cap=round]
    (0.09,-0.005) -- (0.14,-0.04) (0.04,-0.01) -- (0.07,-0.06);
}
\def\fins@eye@closed{%
  \draw[fins face] (-0.08,-0.03) arc (180:0:0.08);
}
\def\fins@eye@dead{%
  \draw[fins face] (-0.075,-0.075) -- (0.075,0.075) (-0.075,0.075) -- (0.075,-0.075);
}
\def\fins@eye@heart{%
  \filldraw[fill=finsheart, draw=finsface, line width=0.7*\fins@flw]
    (0,-0.1) .. controls (-0.17,0.0) and (-0.12,0.15) .. (0,0.06)
    .. controls (0.12,0.15) and (0.17,0.0) .. (0,-0.1) -- cycle;
  \fill[white] (-0.065,0.055) circle (0.022);
}
\def\fins@eye@angry{%
  \fins@eye@normal
  \draw[finsface, line width=1.7*\fins@flw, line cap=round] (-0.15,0.2) -- (0.13,0.1);
}
\def\fins@eye@dizzy{%
  \filldraw[fill=white, draw=finsface, line width=0.7*\fins@flw] (0,0) circle (0.12);
  \draw[finsface, line width=0.85*\fins@flw, line cap=round]
    plot[domain=0:900, samples=70, variable=\fins@t]
      ({0.095*\fins@t/900*cos(\fins@t)},{0.095*\fins@t/900*sin(\fins@t)});
}
\def\fins@eye@side{%
  \filldraw[fill=white, draw=finsface, line width=0.7*\fins@flw] (0,0) circle (0.11);
  \begin{scope}[overlay]
    \clip (0,0) circle (0.11);
    \fill[finspupil] (-0.058,-0.02) circle (0.052);
    \fill[fins@c@body!88!black] (-0.2,0.035) rectangle (0.2,0.2);
  \end{scope}
  \draw[finsface, line width=1.3*\fins@flw, line cap=round] (-0.125,0.035) -- (0.125,0.035);
}
\def\fins@eye@starry{%
  \filldraw[fill=finsstar, draw=finsface, line width=0.6*\fins@flw]
    (0,0.14) -- (0.0353,0.0485) -- (0.1331,0.0433) -- (0.0571,-0.0185)
    -- (0.0823,-0.1133) -- (0,-0.06) -- (-0.0823,-0.1133) -- (-0.0571,-0.0185)
    -- (-0.1331,0.0433) -- (-0.0353,0.0485) -- cycle;
}
\def\fins@eye@none{}
\def\fins@draweye#1#2#3{% x, y, radius
  \begin{scope}[shift={(#1,#2)}, scale=10*#3*\fins@eyescale]
    \ifcsname fins@eye@\fins@eye\endcsname
      \csname fins@eye@\fins@eye\endcsname
    \else
      \PackageError{tikzfins}{Unknown eye `\fins@eye'}
        {Eyes: normal, googly, big, sleepy, closed, dead, heart, angry,
         dizzy, side, starry, none.}%
    \fi
  \end{scope}
}

% Mouths are drawn at the tip of the snout, (0,0), facing +x.
\def\fins@mouth@default{%
  \draw[finsface, line width=0.9*\fins@lw, line cap=round]
    (0,0) .. controls (-0.04,-0.012) and (-0.08,-0.028) .. (-0.12,-0.03);
}
\def\fins@mouth@open{%
  \filldraw[fill=finsmouth, draw=finsface, line width=0.8*\fins@lw] (-0.035,-0.005) ellipse (0.05 and 0.07);
  \fill[finstongue] (-0.035,-0.05) ellipse (0.03 and 0.018);
}
\def\fins@mouth@smile{%
  \draw[fins face] (0,0) .. controls (-0.07,-0.085) and (-0.16,-0.07) .. (-0.21,0.02);
}
\def\fins@mouth@frown{%
  \draw[fins face] (0,0) .. controls (-0.07,0.0) and (-0.16,-0.045) .. (-0.2,-0.12);
}
\def\fins@mouth@teeth{\begin{scope}[scale=1.7]%
  \filldraw[fill=finsmouth, draw=finsface, line width=0.7*\fins@lw]
    (0.03,0.045) -- (-0.13,0.035) .. controls (-0.16,0.0) and (-0.16,-0.03) .. (-0.13,-0.055)
    -- (0.03,-0.06) .. controls (0.05,-0.01) .. (0.03,0.045) -- cycle;
  \filldraw[fill=white, draw=finsface, line width=0.55*\fins@lw, rounded corners=0.4pt]
    (-0.105,0.0) rectangle (0.045,0.04) (-0.105,-0.045) rectangle (0.045,-0.005);
  \draw[finsface, line width=0.45*\fins@lw]
    (-0.055,0.0) -- (-0.055,0.04) (-0.005,0.0) -- (-0.005,0.04)
    (-0.055,-0.045) -- (-0.055,-0.005) (-0.005,-0.045) -- (-0.005,-0.005);
\end{scope}}
\def\fins@mouth@lips{\begin{scope}[scale=1.6]%
  \filldraw[fill=finslips, draw=finslips!55!black, line width=0.6*\fins@lw]
    (-0.11,0.0) .. controls (-0.05,0.045) and (0.0,0.085) .. (0.06,0.055)
    .. controls (0.1,0.035) and (0.1,0.005) .. (0.065,-0.004) -- cycle;
  \filldraw[fill=finslips, draw=finslips!55!black, line width=0.6*\fins@lw]
    (-0.11,0.0) .. controls (-0.05,-0.012) and (0.02,-0.016) .. (0.065,-0.004)
    .. controls (0.115,-0.02) and (0.105,-0.085) .. (0.045,-0.09)
    .. controls (-0.025,-0.092) and (-0.085,-0.04) .. (-0.11,0.0) -- cycle;
  \draw[white, opacity=0.7, line width=0.9*\fins@lw, line cap=round]
    (0.0,-0.06) .. controls (0.02,-0.065) .. (0.045,-0.062);
\end{scope}}
\def\fins@mouth@blep{%
  \fins@mouth@default
  \filldraw[fill=finstongue, draw=finsface, line width=0.6*\fins@lw]
    (-0.02,-0.012) -- (-0.02,-0.06) arc (180:360:0.03) -- (0.04,-0.012);
  \draw[finsface, line width=0.4*\fins@lw] (0.01,-0.02) -- (0.01,-0.055);
}
% mouth=chomp on a fish opens its jaws (see `Jaws' below).  Animals
% without jaws to open (the seahorse and the invertebrates) get this
% instead: a dropped lower jaw and a mouth full of sharp teeth.
\def\fins@mouth@chomp{\begin{scope}[scale=1.4]%
  % the dropped lower jaw
  \filldraw[fill=fins@c@belly, draw=fins@c@outline, line width=0.9*\fins@lw, line join=round]
    (0.03,-0.37) .. controls (0.02,-0.46) and (-0.22,-0.46) .. (-0.42,-0.26)
    .. controls (-0.46,-0.18) and (-0.44,-0.08) .. (-0.37,-0.04)
    .. controls (-0.22,-0.1) and (-0.08,-0.24) .. (0.03,-0.37) -- cycle;
  % inside of the mouth
  \def\fins@gape{(-0.37,-0.04) .. controls (-0.22,0.03) and (-0.08,0.06) .. (0.05,0.05)
    .. controls (0.11,-0.08) and (0.1,-0.25) .. (0.03,-0.37)
    .. controls (-0.08,-0.24) and (-0.22,-0.1) .. (-0.37,-0.04) -- cycle}%
  \fill[finsmouth] \fins@gape;
  \begin{scope}[overlay]
    \clip \fins@gape;
    \fill[black, opacity=0.45] (-0.34,-0.05) circle (0.12);
    \filldraw[fill=finstongue, draw=finstongue!60!black, line width=0.5*\fins@lw]
      (-0.12,-0.25) ellipse (0.16 and 0.07);
    \draw[finstongue!60!black, line width=0.5*\fins@lw] (-0.2,-0.22) -- (-0.04,-0.2);
  \end{scope}
  % teeth: upper row points down, lower row points up and forward
  \filldraw[fill=white, draw=finsface, line width=0.45*\fins@lw, line join=round]
    \foreach \fins@x/\fins@y/\fins@t in {0.03/0.05/0.13, -0.035/0.045/0.07, -0.09/0.035/0.1,
        -0.15/0.02/0.06, -0.205/0.005/0.085, -0.26/-0.01/0.05}{
      (\fins@x-0.026,\fins@y+0.01) -- (\fins@x-0.008,\fins@y-\fins@t) -- (\fins@x+0.026,\fins@y+0.01)}
    \foreach \fins@x/\fins@y/\fins@t in {0.02/-0.355/0.11, -0.04/-0.28/0.07, -0.095/-0.215/0.09,
        -0.15/-0.165/0.055, -0.21/-0.12/0.075, -0.27/-0.085/0.045}{
      (\fins@x-0.03,\fins@y-0.02) -- (\fins@x+0.6*\fins@t,\fins@y+0.8*\fins@t) -- (\fins@x+0.02,\fins@y+0.02)};
  \draw[finsface, line width=0.8*\fins@lw, line join=round] \fins@gape;
  % drool
  \filldraw[fill=finsbubble, draw=finsbubbleline, line width=0.6*\fins@lw]
    (0.0,-0.36) .. controls (0.0,-0.42) and (0.03,-0.47) .. (0.03,-0.5)
    arc (180:360:0.027) .. controls (0.084,-0.46) and (0.07,-0.4) .. (0.05,-0.36) -- cycle;
  \fill[white] (0.068,-0.505) circle (0.009);
\end{scope}}
% A closed mouth with two fangs poking out.
\def\fins@mouth@fangs{\begin{scope}[scale=1.25]%
  \fins@mouth@default
  \filldraw[fill=white, draw=finsface, line width=0.5*\fins@lw, line join=round]
    (-0.042,-0.013) -- (-0.03,-0.085) -- (-0.016,-0.006)
    (-0.105,-0.028) -- (-0.093,-0.092) -- (-0.08,-0.024);
\end{scope}}
\def\fins@mouth@none{}
\def\fins@stache{\begin{scope}[scale=1.6]%
  \filldraw[fill=finsstache, draw=finsstache!60!black, line width=0.5*\fins@lw]
    (0.03,0.05) .. controls (-0.06,0.11) and (-0.2,0.08) .. (-0.27,0.01)
    .. controls (-0.31,-0.035) and (-0.28,-0.1) .. (-0.22,-0.085)
    .. controls (-0.255,-0.055) and (-0.245,-0.02) .. (-0.2,-0.005)
    .. controls (-0.14,0.025) and (-0.05,0.02) .. (0.02,0.015) -- cycle;
\end{scope}}
\def\fins@drawmouth#1#2#3#4{% x, y, angle, size
  \iffins@jaws\else
  \begin{scope}[shift={(#1,#2)}, rotate=#3, scale=#4]
    \ifcsname fins@mouth@\fins@mouth\endcsname
      \csname fins@mouth@\fins@mouth\endcsname
    \else
      \PackageError{tikzfins}{Unknown mouth `\fins@mouth'}
        {Mouths: default, open, smile, frown, teeth, lips, blep, chomp, fangs, none.}%
    \fi
    \iffins@moustache\fins@stache\fi
  \end{scope}
  \fi
}
% a snorkel: a mask over the eye, and a tube from the mouth up past
% the head
\def\fins@drawsnorkel{%
  \expandafter\expandafter\expandafter\fins@snorkelat
    \expandafter\fins@eyedata\fins@mouthdata
}
\def\fins@snorkelat#1#2#3#4#5#6#7{% eye x, y, r, mouth x, y, angle, size
  \pgfmathsetmacro\fins@sk{10*#3}%
  % strap round the back of the head
  \fins@tube{(#1-0.13*\fins@sk,#2+0.06*\fins@sk) .. controls (#1-0.3*\fins@sk,#2+0.14*\fins@sk)
    and (#1-0.48*\fins@sk,#2+0.12*\fins@sk) .. (#1-0.62*\fins@sk,#2+0.02*\fins@sk)}%
    {finsstrap}{finsstrap!60!black}{0.035}%
  % tube: mouthpiece, along the cheek, up behind the mask
  \fins@tube{(#4-0.04,#5) .. controls (#4-0.2,#5-0.06) and (#1-0.1*\fins@sk,#2-0.3*\fins@sk)
    .. (#1-0.24*\fins@sk,#2-0.1*\fins@sk) .. controls (#1-0.3*\fins@sk,#2+0.15*\fins@sk)
    and (#1-0.32*\fins@sk,#2+0.5*\fins@sk) .. (#1-0.3*\fins@sk,#2+0.85*\fins@sk)}%
    {finstube}{finstube!60!black}{0.075}%
  \filldraw[fill=finsstrap, draw=finsstrap!60!black, line width=0.6*\fins@lw]
    (#4-0.06,#5) ellipse (0.035 and 0.06);
  \filldraw[fill=finsmask, fill opacity=0.5, draw=finsstrap, line width=1.6*\fins@lw,
            rounded corners=3pt]
    (#1-0.2*\fins@sk,#2-0.19*\fins@sk) rectangle (#1+0.24*\fins@sk,#2+0.2*\fins@sk);
  \draw[white, opacity=0.85, line width=1.3*\fins@lw, line cap=round]
    (#1+0.1*\fins@sk,#2+0.15*\fins@sk) -- (#1+0.18*\fins@sk,#2+0.07*\fins@sk)
    (#1+0.15*\fins@sk,#2+0.16*\fins@sk) -- (#1+0.2*\fins@sk,#2+0.11*\fins@sk);
}

% speed lines behind the tail: tail x, y, half height
\def\fins@drawspeed#1#2#3{%
  \foreach \fins@dy/\fins@len/\fins@gap in {0.75/0.55/0.1, 0/0.85/0.0, -0.75/0.45/0.18}{%
    \pgfmathsetmacro\fins@sy{#2+\fins@dy*#3}%
    \pgfmathsetmacro\fins@sx{#1-0.12-\fins@gap}%
    \draw[finsline, line width=1.5*\fins@lw, line cap=round]
      (\fins@sx,\fins@sy) -- ++(-\fins@len,0);
  }%
}
% two drops of sweat flying off the top of the head
\def\fins@drawsweat#1#2#3{%
  \pgfmathsetmacro\fins@sk{10*#3}%
  \foreach \fins@dx/\fins@dy/\fins@a/\fins@s in {-0.08/0.27/20/1, 0.17/0.21/-30/0.75}{%
    \begin{scope}[shift={(#1+\fins@dx*\fins@sk,#2+\fins@dy*\fins@sk)}, rotate=\fins@a, scale=\fins@s*\fins@sk]
      \filldraw[fill=finsbubble, draw=finsbubbleline!80!black, line width=0.7*\fins@lw, line join=round]
        (0,0.09) .. controls (0.015,0.04) and (0.05,0.0) .. (0.05,-0.03)
        arc (0:-180:0.05) .. controls (-0.05,0.0) and (-0.015,0.04) .. (0,0.09) -- cycle;
      \fill[white] (-0.02,-0.03) circle (0.012);
    \end{scope}
  }%
}

%% ==================================================================
%% Hats
%% ==================================================================
\def\fins@hat@crown{%
  \path[fins outline, draw=finscrownshade!60!black, fill=finscrown]
    (-0.32,0) -- (-0.37,0.34) -- (-0.17,0.17) -- (0,0.4) -- (0.17,0.17)
    -- (0.37,0.34) -- (0.32,0) .. controls (0.1,-0.04) and (-0.1,-0.04) .. (-0.32,0) -- cycle;
  \draw[finscrownshade, line width=1.2*\fins@lw] (-0.31,0.08) .. controls (-0.1,0.05) and (0.1,0.05) .. (0.31,0.08);
  \path[fins outline, draw=finscrownshade!60!black, fill=finscrown]
    (-0.37,0.34) circle (0.045) (0,0.4) circle (0.045) (0.37,0.34) circle (0.045);
  \fill[finsheart] (0,0.16) circle (0.05);
  \fill[finsparty] (-0.19,0.13) circle (0.035) (0.19,0.13) circle (0.035);
}
\def\fins@hat@party{%
  \def\fins@cone{(-0.26,0) -- (0,0.62) -- (0.26,0)
    .. controls (0.1,-0.05) and (-0.1,-0.05) .. (-0.26,0) -- cycle}%
  \fill[finsparty] \fins@cone;
  \begin{scope}[overlay]
    \clip \fins@cone;
    \foreach \fins@y in {0.1,0.32}{%
      \draw[finsstar, line width=3*\fins@lw] (-0.4,\fins@y-0.08) -- (0.4,\fins@y+0.08);
    }%
  \end{scope}
  \path[draw=finsparty!50!black, line width=\fins@lw, line join=round] \fins@cone;
  \path[draw=finsheart!50!black, line width=\fins@lw, fill=finsheart!65!white] (0,0.64) circle (0.075);
}
\def\fins@hat@top{%
  \filldraw[fill=finstophat, draw=black, line width=\fins@lw, line join=round]
    (-0.21,0.04) -- (-0.23,0.6) .. controls (-0.1,0.63) and (0.1,0.63) .. (0.23,0.6)
    -- (0.21,0.04) -- cycle;
  \fill[finsheart!85!black] (-0.212,0.07) -- (-0.217,0.17) -- (0.217,0.17) -- (0.212,0.07) -- cycle;
  \filldraw[fill=finstophat, draw=black, line width=\fins@lw, rounded corners=1.5pt]
    (-0.38,-0.01) rectangle (0.38,0.06);
  \draw[white, opacity=0.25, line width=2*\fins@lw, line cap=round] (-0.15,0.22) -- (-0.155,0.52);
}
\def\fins@hat@pirate{%
  \filldraw[fill=finstophat, draw=black, line width=\fins@lw, line join=round]
    (-0.46,0.03) .. controls (-0.33,0.1) and (-0.3,0.22) .. (-0.27,0.32)
    .. controls (-0.12,0.47) and (0.12,0.47) .. (0.27,0.32)
    .. controls (0.3,0.22) and (0.33,0.1) .. (0.46,0.03)
    .. controls (0.2,0.1) and (-0.2,0.1) .. (-0.46,0.03) -- cycle;
  \draw[finscrown, line width=1.3*\fins@lw]
    (-0.4,0.06) .. controls (-0.2,0.12) and (0.2,0.12) .. (0.4,0.06);
  \draw[white, line width=1.6*\fins@lw, line cap=round]
    (-0.08,0.15) -- (0.08,0.29) (-0.08,0.29) -- (0.08,0.15);
  \fill[white] (0,0.26) circle (0.055);
  \fill[finstophat] (-0.02,0.265) circle (0.013) (0.02,0.265) circle (0.013);
}
\def\fins@drawhat#1#2#3#4{% x, y, angle, size
  \def\fins@tmp{none}%
  \ifx\fins@hat\fins@tmp\else
    \ifcsname fins@hat@\fins@hat\endcsname
      \begin{scope}[shift={(#1,#2)}, rotate=#3, scale=#4]
        \csname fins@hat@\fins@hat\endcsname
      \end{scope}
    \else
      \PackageError{tikzfins}{Unknown hat `\fins@hat'}{Hats: crown, party, top, pirate, none.}%
    \fi
  \fi
}

%% ==================================================================
%% Effects: bubbles, a fishing line, speech
%% These are drawn upright, outside the fish's own flips.
%% ==================================================================
\def\fins@bubble#1#2#3{% x, y, radius
  \fill[finsbubble, opacity=0.55] (#1,#2) circle (#3);
  \draw[finsbubbleline, line width=0.7*\fins@lw] (#1,#2) circle (#3);
  \draw[white, line width=1.1*\fins@lw, line cap=round]
    (#1,#2) ++(105:{0.62*#3}) arc (105:160:{0.62*#3});
}
\def\fins@mouthpos#1#2#3#4{%
  \pgfmathsetmacro\fins@mx{\fins@dir*(#1)*cos(\fins@rotate)-\fins@ysign*(#2)*sin(\fins@rotate)}%
  \pgfmathsetmacro\fins@my{\fins@dir*(#1)*sin(\fins@rotate)+\fins@ysign*(#2)*cos(\fins@rotate)}%
}
\def\fins@effects{%
  \expandafter\fins@mouthpos\fins@mouthdata
  \ifnum\fins@bubbles>0
    \foreach \fins@i in {1,...,\fins@bubbles}{%
      \pgfmathsetmacro\fins@bx{\fins@mx+\fins@dir*(0.1+0.07*sin(\fins@i*110))}%
      \pgfmathsetmacro\fins@by{\fins@my+0.12+0.26*\fins@i+0.03*\fins@i*\fins@i}%
      \pgfmathsetmacro\fins@br{0.035+0.017*\fins@i}%
      \fins@bubble{\fins@bx}{\fins@by}{\fins@br}%
    }%
  \fi
  \iffins@hooked
    \begin{scope}[shift={(\fins@mx,\fins@my)}, xscale=\fins@dir]
      \draw[finsline, line width=0.45*\fins@lw] (0.075,0.17) -- (0.075,\fins@linelength);
      \draw[finshook, line width=1.5*\fins@lw, line cap=round]
        (0.075,0.15) -- (0.075,-0.05) arc (0:-180:0.065) -- (-0.055,0.03);
      \draw[finshook, line width=1.1*\fins@lw, line cap=round] (-0.055,0.03) -- (-0.025,-0.005);
      \draw[finshook, line width=0.9*\fins@lw] (0.075,0.175) circle (0.022);
    \end{scope}
  \fi
  \ifx\fins@says\pgfutil@empty\else\fins@speech{\fins@says}{0}\fi
  \ifx\fins@thinks\pgfutil@empty\else\fins@speech{\fins@thinks}{1}\fi
}
\def\fins@speech#1#2{% text, 0 = says, 1 = thinks
  \ifnum\fins@dir>0 \def\fins@anchor{south west}\else\def\fins@anchor{south east}\fi
  \ifnum#2=0
    \node[draw=finsbubbleline!70!black, line width=\fins@lw, fill=white, rounded corners=4pt,
          inner sep=3.5pt, anchor=\fins@anchor, font=\sffamily\small, align=center,
          transform shape]
      (fins@speech) at (\fins@mx+\fins@dir*0.3,\fins@my+0.5) {#1};
    \fill[white] ([xshift=\fins@dir*5pt]fins@speech.\fins@anchor) -- (\fins@mx+\fins@dir*0.12,\fins@my+0.1)
      -- ([xshift=\fins@dir*13pt]fins@speech.\fins@anchor) -- cycle;
    \draw[finsbubbleline!70!black, line width=\fins@lw, line join=round]
      ([xshift=\fins@dir*5pt]fins@speech.\fins@anchor) -- (\fins@mx+\fins@dir*0.12,\fins@my+0.1)
      -- ([xshift=\fins@dir*13pt]fins@speech.\fins@anchor);
    \draw[white, line width=1.6*\fins@lw]
      ([xshift=\fins@dir*5.6pt]fins@speech.\fins@anchor) -- ([xshift=\fins@dir*12.4pt]fins@speech.\fins@anchor);
  \else
    \node[draw=finsbubbleline!70!black, line width=\fins@lw, fill=white, rounded rectangle,
          inner sep=4pt, anchor=\fins@anchor, font=\sffamily\small, align=center,
          transform shape]
      (fins@speech) at (\fins@mx+\fins@dir*0.3,\fins@my+0.62) {#1};
    \fins@bubble{\fins@mx+\fins@dir*0.13}{\fins@my+0.17}{0.04}%
    \fins@bubble{\fins@mx+\fins@dir*0.24}{\fins@my+0.36}{0.065}%
  \fi
}

%% ==================================================================
%% FISH
%% ==================================================================
% ---- clownfish ----
\def\fins@clown@body{%
  (1.28,-0.02)
  .. controls (1.22,0.38) and (0.8,0.64) .. (0.18,0.64)
  .. controls (-0.38,0.64) and (-0.78,0.38) .. (-1.02,0.2)
  -- (-1.08,0.19) -- (-1.08,-0.19) -- (-1.02,-0.2)
  .. controls (-0.78,-0.36) and (-0.38,-0.6) .. (0.12,-0.6)
  .. controls (0.72,-0.6) and (1.18,-0.36) .. (1.28,-0.02) -- cycle
}
\def\fins@clown@band#1{% the white bands with black edges
  \filldraw[fill=fins@c@accent, draw=fins@c@pattern, line width=2.4*\fins@lw] #1;
}
\fins@newfish{clownfish}
\def\fins@draw@clownfish#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsclown}\colorlet{fins@c@belly}{finsclownbelly}%
    \colorlet{fins@c@fin}{finsclown}\colorlet{fins@c@outline}{finsclown!45!black}%
    \colorlet{fins@c@accent}{white}\colorlet{fins@c@pattern}{finsclownblack}%
    \colorlet{fins@c@iris}{finsclown!55!black}%
    \fins@eyespot{0.98}{0.2}{0.105}%
    \fins@mouthspot{1.27}{-0.05}{-8}{1}%
    \fins@topspot{0.55}{0.56}{-14}{0.7}%
    \fins@legspots{-0.2}{0.38}{-0.55}{1}%
    \fins@skeleton{-1.05}{0}{0.62}{0.02}{1}%
    \fins@tailend{-1.66}{0}{0.42}%
    \def\fins@bodypath{\fins@clown@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-1.04}{0}{%
      \fins@edgedfin{fins@c@fin}{fins@c@pattern}
        {(-1.0,0.17) .. controls (-1.35,0.52) and (-1.66,0.44) .. (-1.66,0.0)
         .. controls (-1.66,-0.44) and (-1.35,-0.52) .. (-1.0,-0.17) -- cycle}
        {(-1.0,0)}{(-1.0,0)}{(-1.8,0.8)}{(-1.8,-0.8)}{9}}%
    \fins@edgedfin{fins@c@fin}{fins@c@pattern}
      {(0.66,0.5) .. controls (0.58,0.8) and (0.28,0.86) .. (0.08,0.76)
       .. controls (0.0,0.72) and (-0.04,0.72) .. (-0.08,0.76)
       .. controls (-0.22,0.98) and (-0.62,0.92) .. (-0.84,0.32) -- (0.0,0.3) -- cycle}
      {(0.6,0.4)}{(-0.7,0.3)}{(0.4,1.2)}{(-1.0,0.8)}{12}%
    \fins@edgedfin{fins@c@fin}{fins@c@pattern}
      {(-0.2,-0.5) .. controls (-0.3,-0.88) and (-0.66,-0.86) .. (-0.86,-0.3) -- (-0.5,-0.2) -- cycle}
      {(-0.25,-0.4)}{(-0.75,-0.3)}{(-0.4,-1.1)}{(-1.0,-0.7)}{6}%
    \fins@edgedfin{fins@c@fin}{fins@c@pattern}
      {(0.5,-0.5) .. controls (0.45,-0.8) and (0.3,-0.95) .. (0.12,-0.95)
       .. controls (0.16,-0.78) and (0.22,-0.6) .. (0.22,-0.45) -- cycle}
      {(0.4,-0.5)}{(0.4,-0.5)}{(0.4,-1.1)}{(0.0,-1.0)}{5}%
    \fins@bodystart{\fins@clown@body}{0.2}%
      % the head band follows the edge of the gill cover, so it bows back
      \fins@clown@band{(0.86,0.9) .. controls (0.68,0.35) and (0.68,-0.25) .. (0.88,-0.9)
        -- (0.6,-0.9) .. controls (0.42,-0.25) and (0.42,0.35) .. (0.6,0.9) -- cycle}%
      \fins@clown@band{(0.02,0.9) .. controls (0.0,0.4) and (0.26,0.2) .. (0.26,0.0)
        .. controls (0.26,-0.2) and (0.0,-0.4) .. (0.02,-0.9) -- (-0.24,-0.9)
        .. controls (-0.24,-0.4) and (0.02,-0.2) .. (0.02,0.0)
        .. controls (0.02,0.2) and (-0.24,0.4) .. (-0.24,0.9) -- cycle}%
      \fins@clown@band{(-0.8,0.7) .. controls (-0.86,0.2) and (-0.86,-0.2) .. (-0.8,-0.7)
        -- (-0.99,-0.7) .. controls (-1.03,-0.2) and (-1.03,0.2) .. (-0.99,0.7) -- cycle}%
      \fins@shine{(0.42,0.5) .. controls (0.2,0.56) and (-0.1,0.56) .. (-0.3,0.5)}%
    \fins@bodyend{\fins@clown@body}{0.16}%
    \fins@edgedfin{fins@c@fin}{fins@c@pattern}
      {(0.62,-0.06) .. controls (0.42,0.08) and (0.16,0.0) .. (0.08,-0.2)
       .. controls (0.2,-0.36) and (0.46,-0.36) .. (0.62,-0.22) -- cycle}
      {(0.62,-0.14)}{(0.62,-0.14)}{(0.0,0.15)}{(0.05,-0.5)}{6}%
  \fins@close
}

% ---- blue tang ----
\def\fins@tang@body{%
  (1.22,0.06)
  .. controls (1.12,0.48) and (0.62,0.72) .. (0.02,0.7)
  .. controls (-0.55,0.68) and (-0.92,0.38) .. (-1.08,0.13)
  -- (-1.15,0.11) -- (-1.15,-0.11) -- (-1.08,-0.13)
  .. controls (-0.92,-0.36) and (-0.55,-0.62) .. (0.0,-0.62)
  .. controls (0.62,-0.62) and (1.12,-0.36) .. (1.22,0.06) -- cycle
}
\fins@newfish{bluetang}
\def\fins@draw@bluetang#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finstang}\colorlet{fins@c@belly}{finstangbelly}%
    \colorlet{fins@c@fin}{finstang}\colorlet{fins@c@outline}{finstang!40!black}%
    \colorlet{fins@c@pattern}{finstangblack}\colorlet{fins@c@accent}{finstangyellow}%
    \colorlet{fins@c@iris}{finstangblack}%
    \fins@eyespot{0.88}{0.24}{0.1}%
    \fins@mouthspot{1.21}{0.04}{0}{1}%
    \fins@topspot{0.55}{0.62}{-12}{0.7}%
    \fins@legspots{-0.25}{0.35}{-0.56}{1}%
    \fins@skeleton{-1.12}{0}{0.6}{0.05}{1}%
    \fins@tailend{-1.6}{0}{0.45}%
    \def\fins@bodypath{\fins@tang@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-1.12}{0}{%
      \def\fins@path{(-1.1,0.1) -- (-1.6,0.47) .. controls (-1.53,0.15) and (-1.53,-0.15)
        .. (-1.6,-0.47) -- (-1.1,-0.1) -- cycle}%
      \fins@fin{fins@c@accent}{\fins@path}{(-1.1,0)}{(-1.1,0)}{(-1.7,0.6)}{(-1.7,-0.6)}{8}%
      \begin{scope}[overlay]
        \clip \fins@path;
        \draw[fins@c@pattern, line width=3.4*\fins@lw] (-1.1,0.1) -- (-1.6,0.47) (-1.1,-0.1) -- (-1.6,-0.47);
      \end{scope}}%
    \fins@edgedfin{fins@c@fin}{fins@c@pattern}
      {(0.78,0.56) .. controls (0.4,0.9) and (-0.5,0.88) .. (-1.02,0.3) -- (-0.4,0.4) -- cycle}
      {(0.6,0.5)}{(-0.9,0.3)}{(0.4,1.2)}{(-1.2,0.6)}{14}%
    \fins@edgedfin{fins@c@fin}{fins@c@pattern}
      {(0.3,-0.58) .. controls (-0.1,-0.86) and (-0.7,-0.76) .. (-1.02,-0.28) -- (-0.4,-0.4) -- cycle}
      {(0.2,-0.5)}{(-0.9,-0.3)}{(0.0,-1.2)}{(-1.2,-0.6)}{11}%
    \fins@bodystart{\fins@tang@body}{0.2}%
      \fill[fins@c@pattern, even odd rule]
        (0.84,0.33) .. controls (0.45,0.52) and (-0.45,0.5) .. (-1.14,0.12)
        -- (-1.14,-0.03) .. controls (-0.8,-0.1) and (-0.5,-0.48) .. (-0.14,-0.38)
        .. controls (0.06,-0.32) and (0.14,-0.12) .. (0.12,0.08)
        .. controls (0.4,0.17) and (0.64,0.18) .. (0.84,0.19) -- cycle
        [rotate around={6:(-0.5,0.05)}] (-0.5,0.05) ellipse (0.37 and 0.12);
      \fins@shine{(0.62,0.54) .. controls (0.4,0.6) and (0.1,0.62) .. (-0.15,0.6)}%
    \fins@bodyend{\fins@tang@body}{0.14}%
    \def\fins@path{(0.58,-0.04) .. controls (0.38,0.06) and (0.1,0.0) .. (0.02,-0.16)
       .. controls (0.14,-0.32) and (0.42,-0.3) .. (0.58,-0.18) -- cycle}%
    \fins@fin{finstangbelly}{\fins@path}
      {(0.58,-0.11)}{(0.58,-0.11)}{(-0.1,0.12)}{(-0.05,-0.45)}{6}%
    \begin{scope}[overlay]
      \clip \fins@path;
      \fill[fins@c@accent, opacity=0.9] (-0.02,-0.16) circle (0.22);
    \end{scope}
    \path[draw=finstangbelly!55!black, line width=0.55*\fins@lw, line join=round] \fins@path;
  \fins@close
}

% ---- goldfish ----
\def\fins@goldfish@body{%
  (1.2,0.0)
  .. controls (1.15,0.42) and (0.75,0.7) .. (0.2,0.7)
  .. controls (-0.35,0.7) and (-0.62,0.42) .. (-0.8,0.16)
  -- (-0.86,0.13) -- (-0.86,-0.13) -- (-0.8,-0.16)
  .. controls (-0.62,-0.42) and (-0.35,-0.64) .. (0.15,-0.64)
  .. controls (0.75,-0.64) and (1.15,-0.38) .. (1.2,0.0) -- cycle
}
\fins@newfish{goldfish}
\def\fins@draw@goldfish#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsgoldfish}\colorlet{fins@c@belly}{finsgoldfishbelly}%
    \colorlet{fins@c@fin}{finsgoldfishfin}\colorlet{fins@c@outline}{finsgoldfish!50!black}%
    \colorlet{fins@c@iris}{finsstar!80!black}%
    \fins@scalestrue
    \fins@eyespot{0.86}{0.2}{0.115}%
    \fins@mouthspot{1.19}{0.0}{0}{1}%
    \fins@topspot{0.6}{0.6}{-16}{0.72}%
    \fins@legspots{-0.15}{0.42}{-0.58}{1}%
    \fins@skeleton{-0.84}{0}{0.6}{0.02}{1}%
    \fins@tailend{-1.84}{0}{0.6}%
    \def\fins@bodypath{\fins@goldfish@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.84}{0}{%
      \fins@fin{fins@c@fin}
        {(-0.8,0.12) .. controls (-1.1,0.55) and (-1.5,0.88) .. (-1.8,0.72)
         .. controls (-1.66,0.46) and (-1.6,0.2) .. (-1.38,0.04)
         .. controls (-1.62,-0.14) and (-1.68,-0.5) .. (-1.84,-0.76)
         .. controls (-1.48,-0.88) and (-1.1,-0.52) .. (-0.8,-0.12) -- cycle}
        {(-0.82,0)}{(-0.82,0)}{(-1.9,1.0)}{(-1.9,-1.0)}{14}}%
    \fins@fin{fins@c@fin}
      {(0.45,0.64) .. controls (0.25,1.06) and (-0.12,1.08) .. (-0.34,0.98)
       .. controls (-0.34,0.78) and (-0.44,0.62) .. (-0.56,0.45) -- (0.0,0.4) -- cycle}
      {(0.4,0.6)}{(-0.5,0.45)}{(0.15,1.2)}{(-0.45,1.05)}{9}%
    \fins@fin{fins@c@fin}
      {(-0.32,-0.55) .. controls (-0.42,-0.86) and (-0.6,-0.92) .. (-0.78,-0.8)
       .. controls (-0.72,-0.6) and (-0.7,-0.4) .. (-0.66,-0.3) -- cycle}
      {(-0.35,-0.5)}{(-0.66,-0.35)}{(-0.6,-1.0)}{(-0.9,-0.85)}{5}%
    \fins@fin{fins@c@fin}
      {(0.42,-0.58) .. controls (0.36,-0.86) and (0.2,-0.98) .. (0.04,-0.96)
       .. controls (0.1,-0.8) and (0.16,-0.62) .. (0.16,-0.5) -- cycle}
      {(0.35,-0.55)}{(0.35,-0.55)}{(0.35,-1.1)}{(-0.05,-1.0)}{5}%
    \fins@bodystart{\fins@goldfish@body}{0.22}%
      \fins@scaletexture{-0.75}{0.55}{-0.62}{0.66}{0.11}%
      \fins@gill{(0.62,0.5) .. controls (0.72,0.2) and (0.72,-0.2) .. (0.6,-0.48)}%
      \fins@shine{(0.5,0.58) .. controls (0.25,0.64) and (-0.05,0.64) .. (-0.3,0.56)}%
    \fins@bodyend{\fins@goldfish@body}{0.16}%
    \fins@fin{fins@c@fin}
      {(0.56,-0.12) .. controls (0.36,0.0) and (0.12,-0.06) .. (0.02,-0.24)
       .. controls (0.14,-0.38) and (0.4,-0.36) .. (0.56,-0.24) -- cycle}
      {(0.56,-0.18)}{(0.56,-0.18)}{(-0.1,0.08)}{(-0.05,-0.5)}{6}%
  \fins@close
}

% ---- yellow tang ----
\def\fins@ytang@body{%
  (1.32,0.13)
  .. controls (1.18,0.24) and (0.98,0.56) .. (0.5,0.67)
  .. controls (0.0,0.74) and (-0.7,0.5) .. (-1.0,0.12)
  -- (-1.06,0.1) -- (-1.06,-0.1) -- (-1.0,-0.12)
  .. controls (-0.7,-0.5) and (-0.05,-0.72) .. (0.4,-0.62)
  .. controls (0.85,-0.52) and (1.05,-0.2) .. (1.18,0.0)
  .. controls (1.23,0.07) and (1.28,0.1) .. (1.32,0.13) -- cycle
}
\fins@newfish{yellowtang}
\def\fins@draw@yellowtang#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsyellowtang}\colorlet{fins@c@belly}{finsyellowtangbelly}%
    \colorlet{fins@c@fin}{finsyellowtangfin}\colorlet{fins@c@outline}{finsyellowtang!45!black}%
    \colorlet{fins@c@accent}{white}\colorlet{fins@c@iris}{finspupil}%
    \fins@eyespot{0.84}{0.32}{0.1}%
    \fins@mouthspot{1.31}{0.12}{5}{1}%
    \fins@topspot{0.5}{0.7}{-8}{0.7}%
    \fins@legspots{-0.3}{0.35}{-0.58}{1}%
    \fins@skeleton{-1.03}{0}{0.6}{0.08}{1}%
    \fins@tailend{-1.52}{0}{0.45}%
    \def\fins@bodypath{\fins@ytang@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-1.03}{0}{%
      \fins@fin{fins@c@fin}
        {(-1.02,0.08) -- (-1.52,0.45) .. controls (-1.45,0.15) and (-1.45,-0.15)
         .. (-1.52,-0.45) -- (-1.02,-0.08) -- cycle}
        {(-1.03,0)}{(-1.03,0)}{(-1.65,0.6)}{(-1.65,-0.6)}{9}}%
    \fins@fin{fins@c@fin}
      {(0.74,0.6) .. controls (0.55,1.14) and (-0.32,1.2) .. (-0.97,0.3) -- (0,0.4) -- cycle}
      {(0.6,0.55)}{(-0.85,0.3)}{(0.5,1.3)}{(-1.2,0.55)}{15}%
    \fins@fin{fins@c@fin}
      {(0.44,-0.6) .. controls (0.25,-1.12) and (-0.45,-1.1) .. (-0.97,-0.3) -- (0,-0.4) -- cycle}
      {(0.35,-0.55)}{(-0.85,-0.3)}{(0.3,-1.3)}{(-1.2,-0.55)}{12}%
    \fins@bodystart{\fins@ytang@body}{0.2}%
      \filldraw[fill=fins@c@accent, draw=fins@c@outline, line width=0.6*\fins@lw]
        (-0.98,0.0) .. controls (-0.92,0.045) and (-0.82,0.035) .. (-0.76,0.0)
        .. controls (-0.82,-0.035) and (-0.92,-0.045) .. (-0.98,0.0) -- cycle;
      \fins@gill{(0.66,0.56) .. controls (0.76,0.25) and (0.78,-0.1) .. (0.7,-0.42)}%
      \fins@shine{(0.42,0.6) .. controls (0.15,0.65) and (-0.15,0.63) .. (-0.4,0.52)}%
    \fins@bodyend{\fins@ytang@body}{0.14}%
    \fins@fin{fins@c@belly}
      {(0.6,0.02) .. controls (0.4,0.12) and (0.14,0.06) .. (0.04,-0.1)
       .. controls (0.16,-0.26) and (0.44,-0.24) .. (0.6,-0.12) -- cycle}
      {(0.6,-0.05)}{(0.6,-0.05)}{(-0.1,0.2)}{(-0.05,-0.4)}{6}%
  \fins@close
}

% ---- angelfish ----
\def\fins@angel@body{%
  (0.98,0.1)
  .. controls (0.9,0.4) and (0.52,0.62) .. (0.1,0.62)
  .. controls (-0.28,0.6) and (-0.5,0.36) .. (-0.6,0.12)
  -- (-0.66,0.1) -- (-0.66,-0.1) -- (-0.6,-0.12)
  .. controls (-0.5,-0.36) and (-0.28,-0.6) .. (0.1,-0.62)
  .. controls (0.5,-0.62) and (0.86,-0.32) .. (0.98,0.1) -- cycle
}
\def\fins@angel@bars#1{% opacity
  \fill[fins@c@pattern, opacity=#1]
    (0.57,2) -- (0.79,2) -- (0.74,-2) -- (0.52,-2) -- cycle
    (0.16,2) -- (0.34,2) -- (0.2,-2) -- (0.02,-2) -- cycle
    (-0.36,2) -- (-0.2,2) -- (-0.32,-2) -- (-0.48,-2) -- cycle;
}
\def\fins@angel@dorsal{(0.42,0.58) .. controls (0.25,1.15) and (-0.15,1.55) .. (-0.72,1.68)
  .. controls (-0.55,1.25) and (-0.42,0.62) .. (-0.6,0.15) -- (0,0.3) -- cycle}
\def\fins@angel@anal{(0.32,-0.58) .. controls (0.15,-1.15) and (-0.22,-1.55) .. (-0.8,-1.72)
  .. controls (-0.58,-1.25) and (-0.44,-0.62) .. (-0.6,-0.15) -- (0,-0.3) -- cycle}
\fins@newfish{angelfish}
\def\fins@draw@angelfish#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsangel}\colorlet{fins@c@belly}{white}%
    \colorlet{fins@c@fin}{finsangelfin}\colorlet{fins@c@outline}{finsangelbar!70}%
    \colorlet{fins@c@pattern}{finsangelbar}\colorlet{fins@c@iris}{finsbarbred}%
    \def\fins@finop{0.8}%
    \fins@eyespot{0.66}{0.24}{0.09}%
    \fins@mouthspot{0.97}{0.09}{10}{0.9}%
    \fins@topspot{0.3}{0.6}{-6}{0.6}%
    \fins@legspots{-0.15}{0.3}{-0.58}{0.9}%
    \fins@skeleton{-0.64}{0}{0.5}{0.05}{0.9}%
    \fins@tailend{-1.42}{0}{0.55}%
    \def\fins@bodypath{\fins@angel@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.64}{0}{%
      \fins@fin{fins@c@fin}
        {(-0.62,0.08) .. controls (-0.9,0.3) and (-1.1,0.48) .. (-1.4,0.6)
         .. controls (-1.25,0.25) and (-1.25,-0.25) .. (-1.4,-0.6)
         .. controls (-1.1,-0.48) and (-0.9,-0.3) .. (-0.62,-0.08) -- cycle}
        {(-0.64,0)}{(-0.64,0)}{(-1.5,0.75)}{(-1.5,-0.75)}{10}}%
    \foreach \fins@path in {\fins@angel@dorsal,\fins@angel@anal}{%
      \fins@fin{fins@c@fin}{\fins@path}{(0.3,0)}{(-0.6,0)}{(-0.3,2.2)}{(-0.9,1.9)}{0}%
      \begin{scope}[overlay]\clip \fins@path; \fins@angel@bars{0.75}\end{scope}%
    }%
    \fins@rays{fins@c@fin}{\fins@angel@dorsal}{(0.35,0.5)}{(-0.6,0.15)}{(-0.5,1.9)}{(-0.85,1.4)}{11}%
    \fins@rays{fins@c@fin}{\fins@angel@anal}{(0.3,-0.5)}{(-0.6,-0.15)}{(-0.55,-1.95)}{(-0.9,-1.45)}{11}%
    \fins@tube{(0.42,-0.4) .. controls (0.36,-0.9) and (0.24,-1.3) .. (0.04,-1.62)}{fins@c@fin}{fins@c@outline}{0.022}%
    \fins@tube{(0.46,-0.4) .. controls (0.42,-0.9) and (0.33,-1.25) .. (0.18,-1.52)}{fins@c@fin}{fins@c@outline}{0.022}%
    \fins@bodystart{\fins@angel@body}{0.16}%
      \fins@angel@bars{1}%
      \fins@gill{(0.5,0.42) .. controls (0.58,0.2) and (0.58,-0.1) .. (0.5,-0.36)}%
      \fins@shine{(0.42,0.5) .. controls (0.25,0.56) and (0.0,0.56) .. (-0.18,0.48)}%
    \fins@bodyend{\fins@angel@body}{0.12}%
  \fins@close
}

% ---- moorish idol ----
\def\fins@idol@body{%
  (1.24,0.06) -- (0.9,0.13)
  .. controls (0.75,0.32) and (0.55,0.64) .. (0.1,0.66)
  .. controls (-0.35,0.66) and (-0.62,0.35) .. (-0.72,0.1)
  -- (-0.78,0.08) -- (-0.78,-0.08) -- (-0.72,-0.1)
  .. controls (-0.62,-0.35) and (-0.35,-0.66) .. (0.1,-0.66)
  .. controls (0.5,-0.62) and (0.72,-0.3) .. (0.88,-0.04)
  -- (1.24,0.0) .. controls (1.25,0.02) .. (1.24,0.06) -- cycle
}
\def\fins@idol@bands#1{% opacity
  \fill[fins@c@pattern, opacity=#1]
    (0.76,2) -- (0.36,2) -- (0.26,-2) -- (0.64,-2) -- cycle
    (-0.12,2) -- (-0.5,2) -- (-0.62,-2) -- (-0.22,-2) -- cycle;
}
\def\fins@idol@dorsal{(0.45,0.6) .. controls (0.3,0.95) and (0.05,1.15) .. (-0.25,1.3)
  .. controls (-0.6,1.46) and (-1.0,1.52) .. (-1.5,1.44)
  .. controls (-1.0,1.42) and (-0.55,1.26) .. (-0.38,1.04)
  .. controls (-0.28,0.85) and (-0.42,0.5) .. (-0.72,0.12) -- (0,0.3) -- cycle}
% the anal fin is as big as the soft dorsal: a deep, swept-back sail
\def\fins@idol@anal{(0.24,-0.63) .. controls (0.12,-0.95) and (-0.12,-1.24) .. (-0.56,-1.38)
  .. controls (-0.47,-1.04) and (-0.46,-0.5) .. (-0.72,-0.12) -- (0,-0.3) -- cycle}
\def\fins@idol@pelvic{(0.56,-0.5) .. controls (0.58,-0.74) and (0.5,-0.96) .. (0.36,-1.06)
  .. controls (0.37,-0.86) and (0.36,-0.7) .. (0.33,-0.6) -- cycle}
\def\fins@idol@finbands{% the black bands carry on into the fins
  \fins@idol@bands{1}%
  \fill[fins@c@accent, opacity=0.85] (-2,-0.95) rectangle (-0.62,0.98);
}
\fins@newfish{moorishidol}
\def\fins@draw@moorishidol#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsidol}\colorlet{fins@c@belly}{white}%
    \colorlet{fins@c@fin}{finsidol}\colorlet{fins@c@outline}{finsidolblack!70}%
    \colorlet{fins@c@pattern}{finsidolblack}\colorlet{fins@c@accent}{finsidolyellow}%
    \colorlet{fins@c@iris}{finsidolyellow!70!black}%
    \fins@eyespot{0.58}{0.24}{0.085}%
    \fins@mouthspot{1.24}{0.03}{0}{0.8}%
    \fins@topspot{0.3}{0.64}{-6}{0.6}%
    \fins@legspots{-0.15}{0.3}{-0.62}{0.9}%
    \fins@skeleton{-0.76}{0}{0.45}{0.05}{0.8}%
    \fins@tailend{-1.18}{0}{0.45}%
    \def\fins@bodypath{\fins@idol@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.76}{0}{%
      \fins@edgedfin{fins@c@pattern}{white}
        {(-0.74,0.07) -- (-1.16,0.4) .. controls (-1.09,0.13) and (-1.09,-0.13)
         .. (-1.16,-0.4) -- (-0.74,-0.07) -- cycle}
        {(-0.76,0)}{(-0.76,0)}{(-1.3,0.55)}{(-1.3,-0.55)}{7}}%
    % dorsal and anal fins: white, crossed by the bands, with a white rim
    \foreach \fins@path in {\fins@idol@dorsal,\fins@idol@anal}{%
      \fill[fins@c@fin] \fins@path;
      \begin{scope}[overlay]\clip \fins@path;
        \fins@idol@finbands
        \draw[white, line width=3*\fins@lw] \fins@path;
      \end{scope}%
      \path[draw=fins@c@outline, line width=0.55*\fins@lw, line join=round] \fins@path;
    }%
    \fins@rays{fins@c@fin}{\fins@idol@dorsal}{(0.35,0.5)}{(-0.6,0.15)}{(-0.2,1.5)}{(-0.6,1.2)}{9}%
    \fins@rays{fins@c@fin}{\fins@idol@anal}{(0.2,-0.55)}{(-0.62,-0.15)}{(-0.3,-1.5)}{(-0.62,-1.2)}{10}%
    % black pelvic fins, hanging below the first band
    \fins@fin{fins@c@pattern}{\fins@idol@pelvic}{(0.5,-0.55)}{(0.36,-0.58)}{(0.4,-1.1)}{(0.3,-1.0)}{4}%
    % the little bony horns above the eye that give it its name
    \filldraw[fill=fins@c@pattern, draw=fins@c@outline, line width=0.6*\fins@lw, line join=round]
      (0.61,0.4) -- (0.69,0.53) -- (0.73,0.33) -- cycle;
    \fins@bodystart{\fins@idol@body}{0.16}%
      \fill[fins@c@accent] (-2,-2) rectangle (-0.66,2);
      \fill[fins@c@accent, opacity=0.6] (0.1,0.66) .. controls (-0.1,0.5) and (-0.1,0.3) .. (-0.2,0.2)
        -- (-0.2,0.8) -- cycle;
      \fins@idol@bands{1}%
      \fill[finsidolsnout] (0.9,0.13) -- (1.04,0.1) -- (1.03,-0.02) -- (0.89,-0.04)
        .. controls (0.92,0.04) .. (0.9,0.13) -- cycle;
      \fill[fins@c@pattern] (1.2,0.07) -- (1.25,0.06) -- (1.25,-0.005) -- (1.2,-0.005) -- cycle;
      \fins@shine{(0.15,0.56) .. controls (0.0,0.58) and (-0.15,0.55) .. (-0.3,0.48)}%
    \fins@bodyend{\fins@idol@body}{0.12}%
    % small, clear pectoral fin
    \fins@fin{white}
      {(0.24,0.0) .. controls (0.1,0.08) and (-0.06,0.04) .. (-0.12,-0.06)
       .. controls (-0.04,-0.16) and (0.12,-0.16) .. (0.24,-0.1) -- cycle}
      {(0.24,-0.05)}{(0.24,-0.05)}{(-0.2,0.1)}{(-0.18,-0.25)}{5}%
  \fins@close
}

% ---- betta ----
\def\fins@betta@body{%
  (1.12,0.03)
  .. controls (1.07,0.26) and (0.72,0.4) .. (0.2,0.4)
  .. controls (-0.22,0.4) and (-0.5,0.26) .. (-0.62,0.12)
  -- (-0.64,-0.12)
  .. controls (-0.5,-0.3) and (-0.2,-0.4) .. (0.2,-0.4)
  .. controls (0.72,-0.4) and (1.07,-0.22) .. (1.12,0.03) -- cycle
}
% a fin whose colour runs into a wide rim: colour, rim colour, path, A, B, C, D, n
\def\fins@rimfin#1#2#3#4#5#6#7#8{%
  \fill[#1, fill opacity=\fins@finop] #3;
  \begin{scope}[overlay]
    \clip #3;
    \draw[#2, opacity=0.45, line width=14*\fins@lw, line join=round] #3;
    \draw[#2, opacity=0.8, line width=6*\fins@lw, line join=round] #3;
  \end{scope}
  \fins@rays{#1}{#3}{#4}{#5}{#6}{#7}{#8}%
  \path[draw=#2!60!black, line width=0.55*\fins@lw, line join=round] #3;
}
\fins@newfish{betta}
\def\fins@draw@betta#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsbetta}\colorlet{fins@c@belly}{finsbettabelly}%
    \colorlet{fins@c@fin}{finsbettafin}\colorlet{fins@c@outline}{finsbetta!45!black}%
    \colorlet{fins@c@accent}{finsbettaedge}\colorlet{fins@c@iris}{finspupil}%
    \fins@scalestrue
    \fins@eyespot{0.86}{0.13}{0.08}%
    \fins@mouthspot{1.12}{0.05}{12}{0.85}%
    \fins@topspot{0.6}{0.36}{-10}{0.55}%
    \fins@legspots{-0.05}{0.4}{-0.36}{0.85}%
    \fins@skeleton{-0.63}{0}{0.62}{0.02}{0.8}%
    \fins@tailend{-1.95}{0}{0.6}%
    \def\fins@bodypath{\fins@betta@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.62}{0}{%
      \fins@rimfin{fins@c@fin}{fins@c@accent}
        {(-0.6,0.1) .. controls (-0.85,0.6) and (-1.35,0.98) .. (-1.85,0.78)
         .. controls (-1.78,0.5) and (-1.98,0.25) .. (-1.92,0.0)
         .. controls (-1.98,-0.3) and (-1.78,-0.55) .. (-1.88,-0.8)
         .. controls (-1.35,-1.02) and (-0.85,-0.6) .. (-0.6,-0.1) -- cycle}
        {(-0.62,0)}{(-0.62,0)}{(-2.0,1.15)}{(-2.0,-1.15)}{16}}%
    \fins@rimfin{fins@c@fin}{fins@c@accent}
      {(0.12,0.38) .. controls (-0.05,0.85) and (-0.55,1.05) .. (-1.05,0.95)
       .. controls (-0.92,0.65) and (-0.75,0.35) .. (-0.6,0.12) -- (-0.1,0.2) -- cycle}
      {(0.05,0.3)}{(-0.6,0.12)}{(-0.4,1.2)}{(-1.2,0.9)}{10}%
    \fins@rimfin{fins@c@fin}{fins@c@accent}
      {(0.48,-0.36) .. controls (0.3,-0.95) and (-0.45,-1.25) .. (-1.2,-1.02)
       .. controls (-0.92,-0.65) and (-0.75,-0.35) .. (-0.6,-0.12) -- (0,-0.2) -- cycle}
      {(0.4,-0.3)}{(-0.6,-0.12)}{(-0.2,-1.4)}{(-1.3,-1.0)}{13}%
    \fins@rimfin{fins@c@fin}{fins@c@accent}
      {(0.55,-0.33) .. controls (0.5,-0.7) and (0.4,-0.95) .. (0.28,-1.06)
       .. controls (0.32,-0.8) and (0.38,-0.55) .. (0.42,-0.32) -- cycle}
      {(0.48,-0.33)}{(0.48,-0.33)}{(0.35,-1.2)}{(0.2,-1.1)}{2}%
    \fins@bodystart{\fins@betta@body}{0.13}%
      \fins@scaletexture{-0.6}{0.62}{-0.38}{0.4}{0.075}%
      \fins@gill{(0.66,0.3) .. controls (0.72,0.12) and (0.72,-0.12) .. (0.64,-0.3)}%
      \fins@shine{(0.62,0.32) .. controls (0.4,0.37) and (0.15,0.37) .. (-0.05,0.33)}%
    \fins@bodyend{\fins@betta@body}{0.1}%
    \fins@fin{fins@c@belly}
      {(0.58,-0.02) .. controls (0.42,0.06) and (0.24,0.0) .. (0.18,-0.12)
       .. controls (0.28,-0.22) and (0.46,-0.2) .. (0.58,-0.12) -- cycle}
      {(0.58,-0.07)}{(0.58,-0.07)}{(0.1,0.1)}{(0.12,-0.3)}{5}%
  \fins@close
}

% ---- guppy ----
\def\fins@guppy@body{%
  (1.0,0.02)
  .. controls (0.95,0.22) and (0.6,0.32) .. (0.15,0.31)
  .. controls (-0.25,0.29) and (-0.45,0.18) .. (-0.56,0.1)
  -- (-0.56,-0.1)
  .. controls (-0.42,-0.22) and (-0.1,-0.36) .. (0.28,-0.36)
  .. controls (0.65,-0.34) and (0.96,-0.2) .. (1.0,0.02) -- cycle
}
\def\fins@guppy@tail{(-0.54,0.08) .. controls (-0.9,0.35) and (-1.3,0.72) .. (-1.62,0.8)
  .. controls (-1.8,0.4) and (-1.82,-0.4) .. (-1.62,-0.8)
  .. controls (-1.3,-0.72) and (-0.9,-0.35) .. (-0.54,-0.08) -- cycle}
\fins@newfish{guppy}
\def\fins@draw@guppy#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsguppy}\colorlet{fins@c@belly}{finsguppybelly}%
    \colorlet{fins@c@fin}{finsguppytail}\colorlet{fins@c@outline}{finsguppy!40!black}%
    \colorlet{fins@c@pattern}{finsguppyspot}\colorlet{fins@c@accent}{finsguppyblue}%
    \colorlet{fins@c@iris}{finsstar!70!black}%
    \fins@eyespot{0.76}{0.08}{0.08}%
    \fins@mouthspot{1.0}{0.03}{10}{0.8}%
    \fins@topspot{0.55}{0.3}{-8}{0.5}%
    \fins@legspots{0.0}{0.4}{-0.34}{0.8}%
    \fins@skeleton{-0.55}{0}{0.55}{0.0}{0.7}%
    \fins@tailend{-1.8}{0}{0.6}%
    \def\fins@bodypath{\fins@guppy@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.55}{0}{%
      \fins@fin{fins@c@fin}{\fins@guppy@tail}{(-0.55,0)}{(-0.55,0)}{(-1.9,1.0)}{(-1.9,-1.0)}{14}%
      \begin{scope}[overlay]
        \clip \fins@guppy@tail;
        \foreach \fins@i in {1,...,26}{%
          \fins@hash{\fins@i}{\fins@seed}\pgfmathsetmacro\fins@px{-0.75-0.95*\fins@h}%
          \fins@hash{\fins@i+40}{\fins@seed}\pgfmathsetmacro\fins@py{(\fins@h-0.5)*1.5}%
          \fins@hash{\fins@i+80}{\fins@seed}\pgfmathsetmacro\fins@pr{0.022+0.03*\fins@h}%
          \fill[fins@c@pattern, opacity=0.8] (\fins@px,\fins@py) ellipse ({1.3*\fins@pr} and \fins@pr);
        }%
      \end{scope}}%
    \fins@fin{fins@c@fin}
      {(0.04,0.3) .. controls (-0.14,0.56) and (-0.45,0.7) .. (-0.74,0.62)
       .. controls (-0.62,0.44) and (-0.52,0.28) .. (-0.44,0.18) -- cycle}
      {(0.0,0.28)}{(-0.44,0.18)}{(-0.4,0.75)}{(-0.85,0.62)}{7}%
    \fins@fin{fins@c@body}
      {(-0.12,-0.32) .. controls (-0.2,-0.48) and (-0.38,-0.5) .. (-0.48,-0.42)
       .. controls (-0.46,-0.3) and (-0.48,-0.18) .. (-0.5,-0.12) -- cycle}
      {(-0.15,-0.3)}{(-0.48,-0.15)}{(-0.3,-0.6)}{(-0.6,-0.45)}{4}%
    \fins@bodystart{\fins@guppy@body}{0.14}%
      \fill[fins@c@fin, opacity=0.85] (-0.6,0.3) .. controls (-0.3,0.3) and (-0.15,0.1) .. (-0.05,-0.05)
        .. controls (-0.15,-0.2) and (-0.4,-0.2) .. (-0.6,-0.12) -- cycle;
      \fill[fins@c@accent, opacity=0.9] (-0.22,0.06) ellipse (0.13 and 0.08);
      \fill[fins@c@pattern] (-0.42,0.04) circle (0.05);
      \fins@gill{(0.56,0.22) .. controls (0.62,0.08) and (0.62,-0.1) .. (0.55,-0.24)}%
      \fins@shine{(0.55,0.24) .. controls (0.35,0.28) and (0.15,0.28) .. (0.0,0.25)}%
    \fins@bodyend{\fins@guppy@body}{0.08}%
    \fins@fin{fins@c@belly}
      {(0.48,-0.06) .. controls (0.34,0.0) and (0.2,-0.04) .. (0.16,-0.13)
       .. controls (0.24,-0.21) and (0.38,-0.2) .. (0.48,-0.13) -- cycle}
      {(0.48,-0.1)}{(0.48,-0.1)}{(0.1,0.05)}{(0.12,-0.28)}{4}%
  \fins@close
}

% ---- neon tetra ----
\def\fins@tetra@body{%
  (1.15,0.0)
  .. controls (1.1,0.22) and (0.7,0.34) .. (0.2,0.34)
  .. controls (-0.3,0.34) and (-0.7,0.18) .. (-0.95,0.1)
  -- (-0.98,0.08) -- (-0.98,-0.08) -- (-0.95,-0.1)
  .. controls (-0.7,-0.2) and (-0.3,-0.36) .. (0.2,-0.36)
  .. controls (0.7,-0.36) and (1.1,-0.22) .. (1.15,0.0) -- cycle
}
\fins@newfish{neontetra}
\def\fins@draw@neontetra#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finstetra}\colorlet{fins@c@belly}{white}%
    \colorlet{fins@c@back}{finstetraback}\def\fins@backop{0.7}%
    \colorlet{fins@c@fin}{finstetra}\colorlet{fins@c@outline}{finstetraback!60!black}%
    \colorlet{fins@c@pattern}{finstetrablue}\colorlet{fins@c@accent}{finstetrared}%
    \colorlet{fins@c@iris}{finstetrablue!50!black}%
    \def\fins@finop{0.5}%
    \fins@eyespot{0.88}{0.08}{0.085}%
    \fins@mouthspot{1.15}{0.01}{0}{0.85}%
    \fins@topspot{0.55}{0.32}{-6}{0.55}%
    \fins@legspots{-0.1}{0.4}{-0.34}{0.85}%
    \fins@skeleton{-0.97}{0}{0.62}{0.0}{0.8}%
    \fins@tailend{-1.46}{0}{0.32}%
    \def\fins@bodypath{\fins@tetra@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.97}{0}{%
      \fins@fin{fins@c@fin}
        {(-0.95,0.07) -- (-1.45,0.38) .. controls (-1.38,0.2) .. (-1.28,0.0)
         .. controls (-1.38,-0.2) .. (-1.45,-0.38) -- (-0.95,-0.07) -- cycle}
        {(-0.97,0)}{(-0.97,0)}{(-1.6,0.5)}{(-1.6,-0.5)}{8}%
      \fill[fins@c@accent, opacity=0.55] (-0.95,0.07) -- (-1.12,0.18) -- (-1.12,-0.18) -- (-0.95,-0.07) -- cycle;}%
    \fins@fin{fins@c@fin}
      {(0.02,0.33) .. controls (-0.06,0.58) and (-0.24,0.62) .. (-0.34,0.55)
       .. controls (-0.33,0.45) and (-0.3,0.36) .. (-0.3,0.3) -- cycle}
      {(0.0,0.32)}{(-0.3,0.3)}{(-0.2,0.7)}{(-0.4,0.6)}{5}%
    \fins@fin{fins@c@fin}
      {(-0.62,0.22) .. controls (-0.66,0.32) and (-0.76,0.32) .. (-0.78,0.17) -- cycle}
      {(0,0)}{(0,0)}{(0,0)}{(0,0)}{0}%
    \fins@fin{fins@c@fin}
      {(-0.08,-0.35) .. controls (-0.2,-0.52) and (-0.55,-0.46) .. (-0.76,-0.24) -- (-0.3,-0.2) -- cycle}
      {(-0.1,-0.33)}{(-0.7,-0.2)}{(-0.3,-0.6)}{(-0.85,-0.35)}{7}%
    \fins@bodystart{\fins@tetra@body}{0.12}%
      \fill[fins@c@accent] (0.3,0.0) .. controls (0.18,-0.2) and (0.04,-0.34) .. (-0.08,-0.5)
        -- (-1.2,-0.5) -- (-1.2,0.02) -- cycle;
      \fill[fins@c@back, opacity=0.75] (-1.2,0.08) .. controls (-0.4,0.12) and (0.4,0.12)
        .. (1.2,0.16) -- (1.2,0.6) -- (-1.2,0.6) -- cycle;
      \fill[finstetraglow, opacity=0.7] (0.92,0.14) .. controls (0.4,0.15) and (-0.4,0.12) .. (-0.86,0.09)
        -- (-0.86,-0.01) .. controls (-0.4,0.0) and (0.4,0.0) .. (0.92,0.0) -- cycle;
      \fill[fins@c@pattern] (0.9,0.115) .. controls (0.4,0.125) and (-0.4,0.1) .. (-0.84,0.075)
        -- (-0.84,0.01) .. controls (-0.4,0.025) and (0.4,0.025) .. (0.9,0.025) -- cycle;
      \fill[white, opacity=0.5] (0.6,0.095) .. controls (0.2,0.1) and (-0.2,0.09) .. (-0.5,0.07)
        -- (-0.5,0.055) .. controls (-0.2,0.07) and (0.2,0.075) .. (0.6,0.075) -- cycle;
      \fins@gill{(0.66,0.24) .. controls (0.72,0.08) and (0.72,-0.12) .. (0.65,-0.27)}%
    \fins@bodyend{\fins@tetra@body}{0.06}%
    \fins@fin{white}
      {(0.6,-0.1) .. controls (0.44,-0.02) and (0.26,-0.06) .. (0.2,-0.16)
       .. controls (0.3,-0.25) and (0.48,-0.23) .. (0.6,-0.17) -- cycle}
      {(0.6,-0.13)}{(0.6,-0.13)}{(0.1,0.0)}{(0.14,-0.32)}{5}%
  \fins@close
}

% ---- swordtail ----
\def\fins@sword@body{%
  (1.1,0.02)
  .. controls (1.05,0.28) and (0.65,0.42) .. (0.15,0.4)
  .. controls (-0.3,0.38) and (-0.6,0.2) .. (-0.75,0.12)
  -- (-0.75,-0.12)
  .. controls (-0.6,-0.25) and (-0.3,-0.4) .. (0.15,-0.4)
  .. controls (0.65,-0.4) and (1.05,-0.25) .. (1.1,0.02) -- cycle
}
\fins@newfish{swordtail}
\def\fins@draw@swordtail#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finssword}\colorlet{fins@c@belly}{finsswordbelly}%
    \colorlet{fins@c@fin}{finsswordfin}\colorlet{fins@c@outline}{finssword!45!black}%
    \colorlet{fins@c@pattern}{finsbarbblack}\colorlet{fins@c@accent}{finsswordyellow}%
    \colorlet{fins@c@iris}{finssword!60!black}%
    \fins@eyespot{0.84}{0.12}{0.08}%
    \fins@mouthspot{1.1}{0.04}{8}{0.85}%
    \fins@topspot{0.55}{0.37}{-8}{0.55}%
    \fins@legspots{-0.15}{0.38}{-0.38}{0.85}%
    \fins@skeleton{-0.74}{0}{0.6}{0.02}{0.8}%
    \fins@tailend{-1.32}{0.16}{0.3}%
    \def\fins@bodypath{\fins@sword@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.74}{0}{%
      \fins@fin{fins@c@fin}
        {(-0.72,0.1) .. controls (-0.92,0.38) and (-1.12,0.47) .. (-1.3,0.41)
         .. controls (-1.29,0.15) and (-1.28,-0.05) .. (-1.26,-0.16)
         -- (-1.15,-0.34) .. controls (-0.95,-0.3) and (-0.82,-0.2) .. (-0.72,-0.1) -- cycle}
        {(-0.74,0)}{(-0.74,0)}{(-1.4,0.6)}{(-1.4,-0.45)}{8}%
      \def\fins@path{(-1.0,-0.2) -- (-2.3,-0.3) .. controls (-2.36,-0.33) and (-2.33,-0.39)
        .. (-2.27,-0.39) -- (-1.0,-0.34) -- cycle}%
      \fill[fins@c@accent] \fins@path;
      \begin{scope}[overlay]
        \clip \fins@path;
        \draw[fins@c@pattern, line width=3*\fins@lw] (-1.0,-0.2) -- (-2.3,-0.3)
          (-1.0,-0.34) -- (-2.27,-0.39) .. controls (-2.33,-0.39) and (-2.36,-0.33) .. (-2.3,-0.3);
      \end{scope}
      \path[draw=fins@c@pattern, line width=0.55*\fins@lw, line join=round] \fins@path;}%
    \fins@fin{fins@c@fin}
      {(0.18,0.38) .. controls (0.08,0.75) and (-0.22,0.86) .. (-0.45,0.8)
       .. controls (-0.42,0.56) and (-0.45,0.36) .. (-0.5,0.25) -- cycle}
      {(0.15,0.35)}{(-0.5,0.25)}{(-0.1,0.95)}{(-0.6,0.8)}{8}%
    \fins@fin{fins@c@fin}
      {(-0.1,-0.38) .. controls (-0.2,-0.6) and (-0.4,-0.62) .. (-0.5,-0.52)
       .. controls (-0.5,-0.4) and (-0.52,-0.3) .. (-0.55,-0.22) -- cycle}
      {(-0.12,-0.35)}{(-0.52,-0.25)}{(-0.3,-0.75)}{(-0.62,-0.55)}{5}%
    \fins@bodystart{\fins@sword@body}{0.13}%
      \fill[fins@c@body!70!black, opacity=0.6] (0.82,0.05) .. controls (0.3,0.03) and (-0.3,0.01)
        .. (-0.8,0.0) -- (-0.8,-0.04) .. controls (-0.3,-0.03) and (0.3,-0.01) .. (0.8,-0.0) -- cycle;
      \fins@gill{(0.62,0.3) .. controls (0.68,0.12) and (0.68,-0.12) .. (0.6,-0.3)}%
      \fins@shine{(0.6,0.31) .. controls (0.35,0.36) and (0.05,0.36) .. (-0.2,0.31)}%
    \fins@bodyend{\fins@sword@body}{0.1}%
    \fins@fin{fins@c@belly}
      {(0.56,-0.06) .. controls (0.4,0.02) and (0.22,-0.02) .. (0.16,-0.13)
       .. controls (0.26,-0.22) and (0.44,-0.2) .. (0.56,-0.13) -- cycle}
      {(0.56,-0.1)}{(0.56,-0.1)}{(0.08,0.05)}{(0.1,-0.3)}{5}%
  \fins@close
}

% ---- discus ----
\def\fins@discus@body{%
  (0.98,0.02)
  .. controls (0.95,0.45) and (0.55,0.8) .. (0.0,0.8)
  .. controls (-0.5,0.8) and (-0.78,0.45) .. (-0.82,0.12)
  -- (-0.86,0.1) -- (-0.86,-0.1) -- (-0.82,-0.12)
  .. controls (-0.78,-0.45) and (-0.5,-0.8) .. (0.0,-0.8)
  .. controls (0.55,-0.8) and (0.92,-0.42) .. (0.98,0.02) -- cycle
}
\def\fins@discus@lines{%
  \pgfmathsetlengthmacro\fins@sa{1.1pt*\fins@scale}%
  \pgfmathsetlengthmacro\fins@sl{5pt*\fins@scale}%
  \foreach \fins@y in {-1.05,-0.9,...,1.06}{%
    \draw[fins@c@pattern, line width=2.2*\fins@lw, line cap=round,
          decorate, decoration={snake, amplitude=\fins@sa, segment length=\fins@sl}]
      (-1.3,\fins@y-0.1*\fins@y) -- (1.1,\fins@y+0.09*\fins@y);
  }%
}
\def\fins@discus@dorsal{(0.62,0.62) .. controls (0.3,1.06) and (-0.5,1.06) .. (-0.82,0.55)
  .. controls (-0.92,0.35) and (-0.9,0.2) .. (-0.84,0.08) -- (0,0.3) -- cycle}
\def\fins@discus@anal{(0.55,-0.65) .. controls (0.25,-1.06) and (-0.5,-1.06) .. (-0.82,-0.55)
  .. controls (-0.92,-0.35) and (-0.9,-0.2) .. (-0.84,-0.08) -- (0,-0.3) -- cycle}
\fins@newfish{discus}
\def\fins@draw@discus#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsdiscus}\colorlet{fins@c@belly}{finsdiscusbelly}%
    \colorlet{fins@c@fin}{finsdiscus}\colorlet{fins@c@outline}{finsdiscus!40!black}%
    \colorlet{fins@c@pattern}{finsdiscusline}\colorlet{fins@c@iris}{finsbarbred}%
    \fins@eyespot{0.66}{0.22}{0.09}%
    \fins@mouthspot{0.98}{0.02}{0}{0.9}%
    \fins@topspot{0.25}{0.8}{-8}{0.65}%
    \fins@legspots{-0.15}{0.35}{-0.76}{1}%
    \fins@skeleton{-0.85}{0}{0.52}{0.04}{0.8}%
    \fins@tailend{-1.34}{0}{0.6}%
    \def\fins@bodypath{\fins@discus@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.85}{0}{%
      \fins@fin{fins@c@fin}
        {(-0.84,0.07) .. controls (-1.05,0.32) and (-1.25,0.37) .. (-1.33,0.3)
         .. controls (-1.27,0.1) and (-1.27,-0.1) .. (-1.33,-0.3)
         .. controls (-1.25,-0.37) and (-1.05,-0.32) .. (-0.84,-0.07) -- cycle}
        {(-0.85,0)}{(-0.85,0)}{(-1.45,0.45)}{(-1.45,-0.45)}{7}}%
    \foreach \fins@path in {\fins@discus@dorsal,\fins@discus@anal}{%
      \fins@edgedfin{fins@c@fin}{fins@c@body!45!black}{\fins@path}{(0,0)}{(0,0)}{(0,0)}{(0,0)}{0}%
    }%
    \begin{scope}[overlay]
      \clip \fins@discus@dorsal \fins@discus@anal;
      \begin{scope}[opacity=0.85]\fins@discus@lines\end{scope}
    \end{scope}
    \path[draw=fins@c@body!45!black, line width=0.55*\fins@lw, line join=round]
      \fins@discus@dorsal \fins@discus@anal;
    \fins@bodystart{\fins@discus@body}{0.2}%
      \fins@discus@lines
      \fill[fins@c@body!50!black, opacity=0.35] (0.58,1) -- (0.76,1) -- (0.74,-1) -- (0.56,-1) -- cycle;
      \fill[fins@c@body!50!black, opacity=0.3] (-0.66,1) -- (-0.52,1) -- (-0.54,-1) -- (-0.68,-1) -- cycle;
      \fins@shine{(0.5,0.66) .. controls (0.25,0.75) and (0.0,0.77) .. (-0.25,0.72)}%
    \fins@bodyend{\fins@discus@body}{0.15}%
    \fins@fin{fins@c@belly}
      {(0.5,-0.05) .. controls (0.32,0.05) and (0.12,0.0) .. (0.05,-0.14)
       .. controls (0.16,-0.26) and (0.38,-0.24) .. (0.5,-0.14) -- cycle}
      {(0.5,-0.1)}{(0.5,-0.1)}{(-0.05,0.1)}{(0.0,-0.35)}{5}%
  \fins@close
}

% ---- tiger barb ----
\def\fins@barb@body{%
  (1.05,0.0)
  .. controls (1.0,0.3) and (0.62,0.6) .. (0.05,0.62)
  .. controls (-0.45,0.6) and (-0.76,0.26) .. (-0.88,0.1)
  -- (-0.93,0.08) -- (-0.93,-0.08) -- (-0.88,-0.1)
  .. controls (-0.76,-0.26) and (-0.45,-0.55) .. (0.05,-0.55)
  .. controls (0.62,-0.55) and (1.0,-0.28) .. (1.05,0.0) -- cycle
}
\fins@newfish{tigerbarb}
\def\fins@draw@tigerbarb#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsbarb}\colorlet{fins@c@belly}{finsbarbbelly}%
    \colorlet{fins@c@fin}{finsbarbred}\colorlet{fins@c@outline}{finsbarb!40!black}%
    \colorlet{fins@c@pattern}{finsbarbblack}\colorlet{fins@c@accent}{finsbarbred}%
    \colorlet{fins@c@iris}{finsbarbred}%
    \def\fins@finop{0.7}%
    \fins@eyespot{0.74}{0.16}{0.09}%
    \fins@mouthspot{1.05}{0.0}{0}{0.9}%
    \fins@topspot{0.35}{0.6}{-8}{0.65}%
    \fins@legspots{-0.15}{0.35}{-0.52}{1}%
    \fins@skeleton{-0.92}{0}{0.55}{0.03}{0.85}%
    \fins@tailend{-1.44}{0}{0.45}%
    \def\fins@bodypath{\fins@barb@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.92}{0}{%
      \fins@edgedfin{fins@c@belly}{fins@c@accent}
        {(-0.9,0.07) -- (-1.43,0.5) .. controls (-1.38,0.25) .. (-1.24,0.0)
         .. controls (-1.38,-0.25) .. (-1.43,-0.5) -- (-0.9,-0.07) -- cycle}
        {(-0.92,0)}{(-0.92,0)}{(-1.6,0.65)}{(-1.6,-0.65)}{8}}%
    {\def\fins@finop{0.97}%
    \fins@edgedfin{fins@c@pattern}{fins@c@accent}
      {(0.26,0.6) .. controls (0.15,0.96) and (-0.12,1.0) .. (-0.3,0.92)
       .. controls (-0.32,0.75) and (-0.38,0.58) .. (-0.46,0.48) -- cycle}
      {(0.22,0.55)}{(-0.45,0.48)}{(-0.05,1.1)}{(-0.5,0.95)}{7}}%
    \fins@edgedfin{fins@c@belly}{fins@c@accent}
      {(-0.3,-0.5) .. controls (-0.4,-0.78) and (-0.58,-0.8) .. (-0.68,-0.7)
       .. controls (-0.66,-0.5) and (-0.66,-0.38) .. (-0.7,-0.28) -- cycle}
      {(-0.32,-0.48)}{(-0.68,-0.3)}{(-0.5,-0.9)}{(-0.8,-0.7)}{5}%
    \fins@fin{fins@c@accent}
      {(0.32,-0.53) .. controls (0.28,-0.76) and (0.16,-0.86) .. (0.04,-0.84)
       .. controls (0.08,-0.7) and (0.1,-0.56) .. (0.1,-0.48) -- cycle}
      {(0.25,-0.5)}{(0.25,-0.5)}{(0.25,-0.95)}{(-0.05,-0.9)}{4}%
    \fins@bodystart{\fins@barb@body}{0.18}%
      \fill[fins@c@accent, opacity=0.85] (1.08,0.0) circle (0.13);
      \fill[fins@c@pattern]
        (0.7,1) -- (0.86,1) -- (0.78,-1) -- (0.62,-1) -- cycle
        (0.22,1) -- (0.44,1) -- (0.32,-1) -- (0.1,-1) -- cycle
        (-0.3,1) -- (-0.1,1) -- (-0.2,-1) -- (-0.4,-1) -- cycle
        (-0.78,1) -- (-0.66,1) -- (-0.72,-1) -- (-0.84,-1) -- cycle;
      \fins@shine{(0.5,0.52) .. controls (0.25,0.58) and (-0.05,0.58) .. (-0.3,0.5)}%
    \fins@bodyend{\fins@barb@body}{0.14}%
    \fins@fin{fins@c@belly}
      {(0.52,-0.08) .. controls (0.34,0.02) and (0.14,-0.04) .. (0.08,-0.18)
       .. controls (0.2,-0.3) and (0.4,-0.27) .. (0.52,-0.18) -- cycle}
      {(0.52,-0.13)}{(0.52,-0.13)}{(-0.02,0.05)}{(0.02,-0.4)}{5}%
  \fins@close
}

% ---- pufferfish ----
\def\fins@puffer@body{%
  (1.08,0.0)
  .. controls (1.08,0.42) and (0.72,0.68) .. (0.15,0.68)
  .. controls (-0.38,0.68) and (-0.7,0.38) .. (-0.86,0.14)
  -- (-0.9,0.12) -- (-0.9,-0.12) -- (-0.86,-0.14)
  .. controls (-0.7,-0.38) and (-0.38,-0.62) .. (0.15,-0.62)
  .. controls (0.72,-0.62) and (1.08,-0.42) .. (1.08,0.0) -- cycle
}
\def\fins@puffer@ball{(0.02,0) circle (0.96)}
\fins@newfish{pufferfish}
\def\fins@draw@pufferfish#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finspuffer}\colorlet{fins@c@belly}{finspufferbelly}%
    \colorlet{fins@c@fin}{finspufferfin}\colorlet{fins@c@outline}{finspufferspot!80!black}%
    \colorlet{fins@c@pattern}{finspufferspot}\colorlet{fins@c@iris}{finsstar!80!black}%
    \def\fins@finop{0.8}%
    \iffins@puffed
      \fins@eyespot{0.6}{0.3}{0.15}%
      \fins@mouthspot{0.98}{-0.04}{0}{1.1}%
      \def\fins@mouth{open}%
      \fins@topspot{0.1}{0.95}{0}{0.8}%
      \fins@legspots{-0.3}{0.3}{-0.88}{1}%
      \fins@skeleton{-0.9}{0}{0.45}{0.02}{0.8}%
      \fins@tailend{-1.52}{0}{0.75}%
      \def\fins@bodypath{\fins@puffer@ball}%
    \else
      \fins@eyespot{0.66}{0.26}{0.13}%
      \fins@mouthspot{1.08}{-0.02}{0}{1}%
      \fins@topspot{0.42}{0.64}{-10}{0.7}%
      \fins@legspots{-0.15}{0.4}{-0.56}{1}%
      \fins@skeleton{-0.88}{0}{0.45}{0.02}{0.8}%
      \fins@tailend{-1.46}{0}{0.45}%
      \def\fins@bodypath{\fins@puffer@body}%
    \fi
  }{#1}%
  \fins@open
    \iffins@puffed\def\fins@tx{-0.94}\else\def\fins@tx{-0.88}\fi
    \fins@tailscope{\fins@tx}{0}{%
      \begin{scope}[shift={(\fins@tx,0)}]
      \fins@fin{fins@c@fin}
        {(0.02,0.12) .. controls (-0.2,0.38) and (-0.5,0.4) .. (-0.56,0.2)
         .. controls (-0.6,0.05) and (-0.6,-0.05) .. (-0.56,-0.2)
         .. controls (-0.5,-0.4) and (-0.2,-0.38) .. (0.02,-0.12) -- cycle}
        {(0,0)}{(0,0)}{(-0.7,0.5)}{(-0.7,-0.5)}{7}%
      \end{scope}}%
    \iffins@puffed
      \fins@fin{fins@c@fin}{(-0.66,0.66) .. controls (-0.78,0.92) and (-0.98,0.92) .. (-1.0,0.78)
        .. controls (-0.95,0.65) .. (-0.84,0.46) -- cycle}{(-0.7,0.6)}{(-0.84,0.5)}{(-0.9,1.0)}{(-1.05,0.8)}{4}%
      \fins@fin{fins@c@fin}{(-0.66,-0.66) .. controls (-0.78,-0.92) and (-0.98,-0.92) .. (-1.0,-0.78)
        .. controls (-0.95,-0.65) .. (-0.84,-0.46) -- cycle}{(-0.7,-0.6)}{(-0.84,-0.5)}{(-0.9,-1.0)}{(-1.05,-0.8)}{4}%
      % spikes
      \foreach \fins@a in {38,58,...,338}{%
        \filldraw[fill=fins@c@belly, draw=fins@c@outline, line width=0.6*\fins@lw, line join=round]
          ($(0.02,0)+(\fins@a-6:0.94)$) -- ($(0.02,0)+(\fins@a:1.1)$) -- ($(0.02,0)+(\fins@a+6:0.94)$) -- cycle;
      }%
    \else
      \fins@fin{fins@c@fin}{(-0.46,0.56) .. controls (-0.6,0.8) and (-0.8,0.8) .. (-0.84,0.66)
        .. controls (-0.78,0.5) .. (-0.68,0.36) -- cycle}{(-0.5,0.5)}{(-0.68,0.38)}{(-0.7,0.9)}{(-0.9,0.7)}{4}%
      \fins@fin{fins@c@fin}{(-0.46,-0.5) .. controls (-0.6,-0.74) and (-0.8,-0.74) .. (-0.84,-0.6)
        .. controls (-0.78,-0.46) .. (-0.68,-0.32) -- cycle}{(-0.5,-0.45)}{(-0.68,-0.34)}{(-0.7,-0.85)}{(-0.9,-0.65)}{4}%
    \fi
    \fins@bodystart{\fins@bodypath}{0.3}%
      \iffins@puffed\def\fins@spotlo{-0.15}\def\fins@spotr{1.0}\else\def\fins@spotlo{0.0}\def\fins@spotr{0.75}\fi
      \foreach \fins@i in {1,...,30}{%
        \fins@hash{\fins@i}{\fins@seed}\pgfmathsetmacro\fins@px{-0.95+1.8*\fins@h}%
        \fins@hash{\fins@i+50}{\fins@seed}\pgfmathsetmacro\fins@py{\fins@spotlo+(\fins@spotr-\fins@spotlo)*\fins@h}%
        \fins@hash{\fins@i+90}{\fins@seed}\pgfmathsetmacro\fins@pr{0.025+0.03*\fins@h}%
        \fill[fins@c@pattern, opacity=0.75] (\fins@px,\fins@py) circle (\fins@pr);
      }%
      \iffins@puffed
        \fins@shine{(-0.55,0.55) .. controls (-0.4,0.7) and (-0.2,0.8) .. (0.05,0.84)}%
      \else
        \fins@shine{(0.4,0.6) .. controls (0.15,0.64) and (-0.15,0.62) .. (-0.38,0.52)}%
      \fi
    \fins@bodyend{\fins@bodypath}{0.16}%
    \iffins@puffed
      \fins@fin{fins@c@fin}
        {(0.3,-0.05) .. controls (0.12,0.1) and (-0.1,0.08) .. (-0.18,-0.04)
         .. controls (-0.1,-0.2) and (0.15,-0.22) .. (0.3,-0.15) -- cycle}
        {(0.3,-0.1)}{(0.3,-0.1)}{(-0.3,0.15)}{(-0.25,-0.3)}{5}%
    \else
      \fins@fin{fins@c@fin}
        {(0.42,-0.04) .. controls (0.26,0.1) and (0.06,0.08) .. (-0.02,-0.04)
         .. controls (0.06,-0.2) and (0.28,-0.22) .. (0.42,-0.14) -- cycle}
        {(0.42,-0.09)}{(0.42,-0.09)}{(-0.12,0.15)}{(-0.08,-0.3)}{5}%
    \fi
  \fins@close
}

% ---- seahorse ----
\def\fins@seahorse@body{%
  (0.82,0.63) -- (0.42,0.67)
  .. controls (0.36,0.87) and (0.22,0.99) .. (0.05,1.0)
  .. controls (-0.12,1.0) and (-0.24,0.9) .. (-0.24,0.76)
  .. controls (-0.24,0.66) and (-0.2,0.6) .. (-0.16,0.56)
  .. controls (-0.34,0.42) and (-0.44,0.18) .. (-0.42,-0.08)
  .. controls (-0.4,-0.36) and (-0.26,-0.56) .. (-0.12,-0.68)
  .. controls (0.0,-0.82) and (0.02,-1.0) .. (0.18,-1.08)
  .. controls (0.36,-1.16) and (0.53,-1.02) .. (0.49,-0.86)
  .. controls (0.46,-0.74) and (0.3,-0.7) .. (0.25,-0.8)
  .. controls (0.22,-0.86) and (0.28,-0.92) .. (0.33,-0.88)
  .. controls (0.38,-0.88) and (0.4,-0.93) .. (0.36,-0.97)
  .. controls (0.3,-1.03) and (0.18,-1.0) .. (0.14,-0.92)
  .. controls (0.1,-0.82) and (0.12,-0.7) .. (0.14,-0.62)
  .. controls (0.3,-0.45) and (0.36,-0.15) .. (0.3,0.12)
  .. controls (0.26,0.3) and (0.2,0.42) .. (0.22,0.53)
  -- (0.82,0.55) .. controls (0.84,0.59) .. (0.82,0.63) -- cycle
}
\fins@newfish{seahorse}
\def\fins@draw@seahorse#1{%
  \fins@prepare{%
    \def\fins@canjaw{0}%
    \colorlet{fins@c@body}{finsseahorse}\colorlet{fins@c@belly}{finsseahorsebelly}%
    \colorlet{fins@c@fin}{finsseahorsebelly}\colorlet{fins@c@outline}{finsseahorse!45!black}%
    \colorlet{fins@c@pattern}{finsseahorse!75!black}\colorlet{fins@c@iris}{finsseahorse!50!black}%
    \def\fins@finop{0.7}%
    \fins@eyespot{0.12}{0.76}{0.085}%
    \fins@mouthspot{0.83}{0.59}{0}{0.8}%
    \fins@topspot{0.02}{0.98}{-5}{0.55}%
    \fins@legspots{-0.1}{0.15}{-0.55}{0.9}%
    \fins@tailend{-0.55}{0.1}{0.5}%
    \def\fins@bodypath{\fins@seahorse@body}%
  }{#1}%
  \fins@open
    \fins@fin{fins@c@fin}
      {(-0.36,0.2) .. controls (-0.6,0.18) and (-0.68,-0.12) .. (-0.42,-0.24) -- cycle}
      {(-0.36,0.2)}{(-0.42,-0.24)}{(-0.75,0.25)}{(-0.7,-0.2)}{6}%
    \fins@bodystart{\fins@seahorse@body}{-0.0}%
      \begin{scope}[xshift=-0.1cm]
        \fill[fins@c@belly, even odd rule] (-6,-6) rectangle (6,6) \fins@seahorse@body;
      \end{scope}
      \foreach \fins@y in {0.42,0.3,...,-0.62}{%
        \draw[fins@c@pattern, line width=0.8*\fins@lw, opacity=0.7]
          (-0.5,\fins@y+0.05) .. controls (-0.1,\fins@y-0.03) and (0.15,\fins@y-0.03) .. (0.45,\fins@y+0.04);
      }%
      \foreach \fins@a in {200,230,...,350}{%
        \draw[fins@c@pattern, line width=0.8*\fins@lw, opacity=0.7]
          (0.31,-0.89) -- ++(\fins@a:0.25);
      }%
      \fins@shine{(-0.12,0.92) .. controls (-0.2,0.86) and (-0.22,0.78) .. (-0.2,0.7)}%
    \fins@bodyend{\fins@seahorse@body}{0.0}%
    \foreach \fins@x/\fins@y/\fins@a in {-0.08/0.99/110, 0.06/1.0/80, 0.18/0.96/60, -0.2/0.9/140}{%
      \filldraw[fill=fins@c@body, draw=fins@c@outline, line width=0.6*\fins@lw, line join=round]
        ($(\fins@x,\fins@y)+(\fins@a-90:0.035)$) -- ++(\fins@a:0.09) -- ($(\fins@x,\fins@y)+(\fins@a+90:0.035)$);
    }%
    \fins@fin{fins@c@fin}
      {(0.0,0.58) .. controls (-0.1,0.6) and (-0.16,0.5) .. (-0.12,0.42) -- cycle}
      {(0,0.58)}{(-0.12,0.42)}{(-0.2,0.64)}{(-0.18,0.4)}{3}%
  \fins@close
}

% ---- royal gramma ----
\def\fins@gramma@body{%
  (1.12,0.0)
  .. controls (1.08,0.26) and (0.7,0.4) .. (0.15,0.4)
  .. controls (-0.35,0.4) and (-0.72,0.24) .. (-0.92,0.12)
  -- (-0.96,0.1) -- (-0.96,-0.1) -- (-0.92,-0.12)
  .. controls (-0.72,-0.24) and (-0.35,-0.4) .. (0.15,-0.4)
  .. controls (0.7,-0.4) and (1.08,-0.26) .. (1.12,0.0) -- cycle
}
\fins@newfish{royalgramma}
\def\fins@draw@royalgramma#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsgramma}\colorlet{fins@c@belly}{finsgrammabelly}%
    \colorlet{fins@c@fin}{finsgramma}\colorlet{fins@c@outline}{finsgramma!40!black}%
    \colorlet{fins@c@accent}{finsgrammayellow}\colorlet{fins@c@pattern}{finsbarbblack}%
    \colorlet{fins@c@iris}{finsgrammayellow!80!black}%
    \fins@eyespot{0.86}{0.1}{0.08}%
    \fins@mouthspot{1.12}{0.01}{0}{0.85}%
    \fins@topspot{0.55}{0.37}{-6}{0.55}%
    \fins@legspots{-0.1}{0.4}{-0.38}{0.85}%
    \fins@skeleton{-0.95}{0}{0.62}{0.02}{0.8}%
    \fins@tailend{-1.43}{0}{0.32}%
    \def\fins@bodypath{\fins@gramma@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.95}{0}{%
      \fins@fin{fins@c@accent}
        {(-0.94,0.08) .. controls (-1.15,0.3) and (-1.36,0.36) .. (-1.42,0.3)
         .. controls (-1.38,0.1) and (-1.38,-0.1) .. (-1.42,-0.3)
         .. controls (-1.36,-0.36) and (-1.15,-0.3) .. (-0.94,-0.08) -- cycle}
        {(-0.95,0)}{(-0.95,0)}{(-1.55,0.45)}{(-1.55,-0.45)}{8}}%
    \def\fins@path{(0.6,0.34) .. controls (0.5,0.55) and (0.1,0.56) .. (-0.3,0.55)
      .. controls (-0.6,0.54) and (-0.85,0.4) .. (-0.92,0.14) -- (0,0.3) -- cycle}%
    \fins@fin{fins@c@fin}{\fins@path}{(0.5,0.35)}{(-0.85,0.14)}{(0.3,0.7)}{(-1.0,0.5)}{14}%
    \begin{scope}[overlay]\clip \fins@path;
      \fill[fins@c@accent, opacity=0.9] (-2,-2) rectangle (-0.15,2);
      \fill[fins@c@pattern] (0.36,0.46) ellipse (0.09 and 0.07);
    \end{scope}
    \def\fins@path{(0.0,-0.38) .. controls (-0.15,-0.62) and (-0.6,-0.55) .. (-0.86,-0.2) -- (-0.3,-0.2) -- cycle}%
    \fins@fin{fins@c@accent}{\fins@path}{(0.0,-0.36)}{(-0.8,-0.2)}{(-0.2,-0.7)}{(-0.95,-0.4)}{9}%
    \fins@fin{fins@c@fin}
      {(0.55,-0.36) .. controls (0.48,-0.6) and (0.3,-0.82) .. (0.12,-0.86)
       .. controls (0.18,-0.66) and (0.24,-0.5) .. (0.26,-0.34) -- cycle}
      {(0.45,-0.36)}{(0.45,-0.36)}{(0.3,-0.95)}{(0.05,-0.85)}{4}%
    \fins@bodystart{\fins@gramma@body}{0.12}%
      \fill[fins@c@accent] (0.1,0.6) .. controls (0.0,0.2) and (-0.1,-0.2) .. (-0.22,-0.6)
        -- (-1.2,-0.6) -- (-1.2,0.6) -- cycle;
      \fill[fins@c@accent, opacity=0.5] (0.26,0.6) .. controls (0.16,0.2) and (0.06,-0.2) .. (-0.06,-0.6)
        -- (-0.22,-0.6) .. controls (-0.1,-0.2) and (0.0,0.2) .. (0.1,0.6) -- cycle;
      \draw[fins@c@pattern, line width=1.2*\fins@lw, line cap=round] (1.1,0.04) -- (0.62,0.24);
      \fins@gill{(0.64,0.28) .. controls (0.7,0.1) and (0.7,-0.12) .. (0.62,-0.3)}%
      \fins@shine{(0.62,0.31) .. controls (0.38,0.36) and (0.1,0.36) .. (-0.15,0.32)}%
    \fins@bodyend{\fins@gramma@body}{0.09}%
    \fins@fin{fins@c@belly}
      {(0.58,-0.06) .. controls (0.42,0.03) and (0.24,-0.02) .. (0.18,-0.12)
       .. controls (0.28,-0.22) and (0.46,-0.2) .. (0.58,-0.13) -- cycle}
      {(0.58,-0.1)}{(0.58,-0.1)}{(0.1,0.06)}{(0.12,-0.3)}{5}%
  \fins@close
}

% ---- corydoras (panda by default; type=bronze) ----
\def\fins@cory@body{%
  (1.02,-0.2)
  .. controls (1.0,0.05) and (0.82,0.3) .. (0.5,0.44)
  .. controls (0.35,0.5) and (0.2,0.52) .. (0.1,0.52)
  .. controls (-0.25,0.48) and (-0.6,0.24) .. (-0.82,0.13)
  -- (-0.88,0.12) -- (-0.88,-0.1)
  .. controls (-0.6,-0.18) and (-0.2,-0.34) .. (0.2,-0.38)
  .. controls (0.6,-0.4) and (0.9,-0.36) .. (1.02,-0.2) -- cycle
}
\def\fins@cory@dorsal{(0.2,0.5) .. controls (0.16,0.75) and (0.1,0.95) .. (0.02,1.08)
  .. controls (-0.08,0.95) and (-0.22,0.72) .. (-0.34,0.42) -- (0,0.4) -- cycle}
\def\fins@cory@tail{(-0.86,0.1) .. controls (-1.0,0.25) and (-1.15,0.42) .. (-1.32,0.5)
  .. controls (-1.27,0.3) and (-1.2,0.12) .. (-1.12,0.0)
  .. controls (-1.2,-0.12) and (-1.27,-0.3) .. (-1.32,-0.48)
  .. controls (-1.15,-0.4) and (-1.0,-0.24) .. (-0.86,-0.08) -- cycle}
\fins@newfish{corydoras}
\def\fins@draw@corydoras#1{%
  \fins@prepare{%
    \def\fins@tmp{bronze}%
    \ifx\fins@type\fins@tmp
      \colorlet{fins@c@body}{finscorybronze}\colorlet{fins@c@belly}{finscorybronzebelly}%
      \colorlet{fins@c@fin}{finscorybronzefin}\colorlet{fins@c@pattern}{finscorybronze}%
      \def\fins@panda{0}%
    \else
      \colorlet{fins@c@body}{finscory}\colorlet{fins@c@belly}{finscorybelly}%
      \colorlet{fins@c@fin}{finscoryfin}\colorlet{fins@c@pattern}{finsbarbblack}%
      \def\fins@panda{1}%
    \fi
    \colorlet{fins@c@outline}{fins@c@body!45!black}%
    \colorlet{fins@c@iris}{finscoryiris}%
    \def\fins@finop{0.8}\def\fins@mouth{none}%
    \fins@eyespot{0.62}{0.16}{0.1}%
    \fins@mouthspot{1.0}{-0.27}{-35}{0.85}%
    \fins@topspot{0.4}{0.5}{-14}{0.6}%
    \fins@legspots{-0.2}{0.4}{-0.36}{0.9}%
    \fins@skeleton{-0.86}{0.01}{0.42}{0.02}{0.8}%
    \fins@tailend{-1.34}{0}{0.42}%
    \def\fins@bodypath{\fins@cory@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.86}{0}{%
      \fins@fin{fins@c@fin}{\fins@cory@tail}{(-0.86,0)}{(-0.86,0)}{(-1.45,0.62)}{(-1.45,-0.62)}{10}}%
    \fins@fin{fins@c@fin}{\fins@cory@dorsal}{(0.18,0.48)}{(-0.3,0.42)}{(0.02,1.15)}{(-0.42,0.6)}{6}%
    \ifnum\fins@panda=1
      \begin{scope}[overlay]\clip \fins@cory@dorsal;
        \fill[fins@c@pattern, opacity=0.92] (-1,0.64) .. controls (-0.1,0.6) .. (1,0.72) -- (1,2) -- (-1,2) -- cycle;
      \end{scope}
      \path[draw=fins@c@fin!55!black, line width=0.55*\fins@lw, line join=round] \fins@cory@dorsal;
    \fi
    \fins@tube{(0.2,0.48) .. controls (0.16,0.75) and (0.1,0.95) .. (0.02,1.08)}%
      {fins@c@fin!75!black}{fins@c@outline}{0.03}%
    % adipose fin, with its little spine
    \fins@fin{fins@c@fin}{(-0.58,0.25) .. controls (-0.62,0.34) and (-0.68,0.4) .. (-0.72,0.42)
      .. controls (-0.74,0.3) and (-0.76,0.22) .. (-0.8,0.15) -- cycle}{(0,0)}{(0,0)}{(0,0)}{(0,0)}{0}%
    \fins@fin{fins@c@fin}{(-0.02,-0.36) .. controls (-0.12,-0.5) and (-0.22,-0.58) .. (-0.32,-0.6)
      .. controls (-0.3,-0.48) and (-0.3,-0.4) .. (-0.32,-0.3) -- cycle}
      {(-0.05,-0.36)}{(-0.3,-0.32)}{(-0.3,-0.66)}{(-0.4,-0.56)}{4}%
    \fins@fin{fins@c@fin}{(-0.44,-0.26) .. controls (-0.5,-0.38) and (-0.58,-0.46) .. (-0.66,-0.47)
      .. controls (-0.66,-0.36) and (-0.66,-0.28) .. (-0.7,-0.18) -- cycle}
      {(-0.46,-0.26)}{(-0.68,-0.2)}{(-0.6,-0.52)}{(-0.75,-0.45)}{4}%
    \fins@bodystart{\fins@cory@body}{0.14}%
      \ifnum\fins@panda=1
        % the panda's mask and the spot on the tail base
        \fill[fins@c@pattern] (0.46,0.7) .. controls (0.44,0.3) and (0.46,0.0) .. (0.56,-0.14)
          .. controls (0.64,-0.24) and (0.78,-0.2) .. (0.8,-0.08)
          .. controls (0.82,0.1) and (0.8,0.4) .. (0.76,0.7) -- cycle;
        \fill[fins@c@pattern] (-0.79,0.02) ellipse (0.13 and 0.11);
      \else
        \fill[fins@c@body!60!finsplant, opacity=0.45] (-1,0.14) .. controls (-0.2,0.2) and (0.2,0.2) .. (0.5,0.3)
          -- (0.5,0.0) .. controls (0.1,-0.06) and (-0.4,-0.02) .. (-1,-0.02) -- cycle;
      \fi
      % two rows of armour plates
      \draw[fins@c@outline, opacity=0.3, line width=0.6*\fins@lw]
        (0.42,0.06) .. controls (0.0,0.06) and (-0.5,0.03) .. (-0.88,0.0)
        \foreach \fins@x in {0.3,0.16,...,-0.8}{
          (\fins@x-0.07,0.56) .. controls (\fins@x-0.02,0.34) .. (\fins@x,0.04)
          .. controls (\fins@x-0.02,-0.16) .. (\fins@x-0.07,-0.42)};
      \fins@gill{(0.42,0.42) .. controls (0.48,0.2) and (0.48,-0.1) .. (0.4,-0.34)}%
      \fins@shine{(0.3,0.45) .. controls (0.1,0.49) and (-0.15,0.45) .. (-0.35,0.35)}%
    \fins@bodyend{\fins@cory@body}{0.12}%
    % barbels and the spiny pectoral fin
    \fins@tube{(0.97,-0.3) .. controls (1.02,-0.38) and (1.06,-0.42) .. (1.04,-0.5)}{fins@c@belly}{fins@c@outline}{0.022}%
    \fins@tube{(0.91,-0.33) .. controls (0.92,-0.4) and (0.93,-0.44) .. (0.89,-0.5)}{fins@c@belly}{fins@c@outline}{0.02}%
    \def\fins@path{(0.44,-0.27) .. controls (0.3,-0.4) and (0.15,-0.5) .. (-0.02,-0.56)
      .. controls (0.02,-0.42) and (0.12,-0.28) .. (0.24,-0.2) -- cycle}%
    \fins@fin{fins@c@fin}{\fins@path}{(0.42,-0.27)}{(0.24,-0.21)}{(0.0,-0.62)}{(0.02,-0.4)}{6}%
    \fins@tube{(0.44,-0.27) .. controls (0.3,-0.4) and (0.15,-0.5) .. (-0.02,-0.56)}%
      {fins@c@fin!75!black}{fins@c@outline}{0.022}%
  \fins@close
}

% random dots, gathered into one path: count, x0, x1, y0, y1, radius,
% radius spread, seed offset; then \fill[...] \fins@dotlist;
\def\fins@dots#1#2#3#4#5#6#7#8{%
  \pgfmathsetmacro\fins@dx{#3-(#2)}\pgfmathsetmacro\fins@dy{#5-(#4)}%
  \gdef\fins@dotlist{}%
  \foreach \fins@i in {1,...,#1}{%
    \fins@ihash{\fins@i}{\fins@seed+#8}\let\fins@hX\fins@hC
    \fins@ihash{\fins@i+211}{\fins@seed+#8}\let\fins@hY\fins@hC
    \fins@ihash{\fins@i+419}{\fins@seed+#8}%
    \xdef\fins@dotlist{\fins@dotlist
      (\the\dimexpr #2cm+\fins@dx cm*\fins@hX/997\relax,\the\dimexpr #4cm+\fins@dy cm*\fins@hY/997\relax)
      circle [radius=\the\dimexpr #6cm+#7cm*\fins@hC/997\relax]}%
  }%
}

% ---- bristlenose pleco ----
\def\fins@pleco@body{%
  (1.05,-0.26)
  .. controls (1.03,-0.06) and (0.8,0.15) .. (0.45,0.29)
  .. controls (0.25,0.36) and (0.05,0.38) .. (-0.05,0.37)
  .. controls (-0.4,0.3) and (-0.7,0.15) .. (-0.9,0.1)
  -- (-0.95,0.09) -- (-0.95,-0.12)
  .. controls (-0.6,-0.2) and (-0.2,-0.36) .. (0.2,-0.38)
  .. controls (0.6,-0.39) and (0.95,-0.38) .. (1.05,-0.26) -- cycle
}
\def\fins@pleco@dorsal{(0.0,0.36) .. controls (-0.02,0.7) and (-0.1,0.9) .. (-0.18,0.98)
  .. controls (-0.38,0.88) and (-0.52,0.58) .. (-0.62,0.22) -- (-0.3,0.3) -- cycle}
\def\fins@pleco@tail{(-0.93,0.09) -- (-1.3,0.4) .. controls (-1.35,0.1) and (-1.37,-0.2) .. (-1.42,-0.52)
  -- (-0.93,-0.11) -- cycle}
\def\fins@spottedfin#1#2{% path, number of spots
  \begin{scope}[overlay]\clip #1;
    \fins@dots{#2}{-1.6}{1.2}{-1.2}{1.2}{0.016}{0.014}{5}%
    \fill[fins@c@accent, opacity=0.85] \fins@dotlist;
  \end{scope}
}
\fins@newfish{pleco}
\def\fins@draw@pleco#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finspleco}\colorlet{fins@c@belly}{finsplecobelly}%
    \colorlet{fins@c@fin}{finspleco}\colorlet{fins@c@outline}{finspleco!50!black}%
    \colorlet{fins@c@accent}{finsplecospot}\colorlet{fins@c@iris}{finsplecospot!60!black}%
    \def\fins@backop{0.2}\def\fins@finop{0.9}%
    \def\fins@mouth{none}%
    \fins@eyespot{0.58}{0.13}{0.075}%
    \fins@mouthspot{1.03}{-0.3}{-40}{0.9}%
    \fins@topspot{0.35}{0.33}{-12}{0.6}%
    \fins@legspots{-0.25}{0.4}{-0.36}{0.9}%
    \fins@skeleton{-0.94}{0.0}{0.4}{0.0}{0.8}%
    \fins@tailend{-1.42}{-0.05}{0.4}%
    \def\fins@bodypath{\fins@pleco@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.94}{0}{%
      \fins@fin{fins@c@fin}{\fins@pleco@tail}{(-0.94,0)}{(-0.94,0)}{(-1.4,0.55)}{(-1.5,-0.62)}{9}%
      \fins@spottedfin{\fins@pleco@tail}{18}}%
    \fins@fin{fins@c@fin}{\fins@pleco@dorsal}{(-0.02,0.36)}{(-0.6,0.24)}{(-0.18,1.05)}{(-0.66,0.4)}{8}%
    \fins@spottedfin{\fins@pleco@dorsal}{16}%
    \fins@tube{(0.0,0.36) .. controls (-0.02,0.7) and (-0.1,0.9) .. (-0.18,0.98)}%
      {fins@c@fin!80!black}{fins@c@outline}{0.03}%
    \fins@fin{fins@c@fin}{(-0.72,0.16) -- (-0.8,0.32) .. controls (-0.84,0.24) .. (-0.88,0.12) -- cycle}%
      {(0,0)}{(0,0)}{(0,0)}{(0,0)}{0}%
    \def\fins@path{(-0.08,-0.36) .. controls (-0.2,-0.46) and (-0.32,-0.52) .. (-0.45,-0.54)
      .. controls (-0.42,-0.44) and (-0.42,-0.36) .. (-0.44,-0.28) -- cycle}%
    \fins@fin{fins@c@fin}{\fins@path}{(-0.1,-0.36)}{(-0.42,-0.3)}{(-0.42,-0.6)}{(-0.5,-0.5)}{5}%
    \fins@fin{fins@c@fin}{(-0.56,-0.22) .. controls (-0.62,-0.32) and (-0.68,-0.38) .. (-0.74,-0.38)
      .. controls (-0.74,-0.3) and (-0.74,-0.24) .. (-0.78,-0.17) -- cycle}{(0,0)}{(0,0)}{(0,0)}{(0,0)}{0}%
    \fins@bodystart{\fins@pleco@body}{0.1}%
      \fins@dots{70}{-0.95}{1.05}{-0.38}{0.4}{0.013}{0.014}{1}%
      \fill[fins@c@accent, opacity=0.8] \fins@dotlist;
      \draw[fins@c@outline, opacity=0.3, line width=0.6*\fins@lw]
        (0.4,0.02) .. controls (0.0,0.02) and (-0.5,0.0) .. (-0.92,-0.01)
        \foreach \fins@x in {0.25,0.1,...,-0.85}{
          (\fins@x-0.06,0.4) .. controls (\fins@x-0.02,0.24) .. (\fins@x,0.02)
          .. controls (\fins@x-0.02,-0.16) .. (\fins@x-0.06,-0.4)};
      \fins@gill{(0.4,0.3) .. controls (0.46,0.12) and (0.46,-0.12) .. (0.38,-0.32)}%
      \fins@shine{(0.35,0.31) .. controls (0.15,0.36) and (-0.1,0.35) .. (-0.3,0.28)}%
    \fins@bodyend{\fins@pleco@body}{0.1}%
    % the sucker mouth under the snout
    \filldraw[fill=fins@c@belly!70!white, draw=fins@c@outline, line width=0.6*\fins@lw]
      (0.9,-0.36) ellipse [x radius=0.12, y radius=0.045];
    \draw[fins@c@outline, line width=0.5*\fins@lw] (0.8,-0.36) -- (1.0,-0.36);
    % the bristles on the snout that give it its name
    \foreach \fins@x/\fins@y/\fins@a/\fins@l in {1.02/-0.16/15/0.12, 1.0/-0.09/35/0.15,
        0.95/-0.02/55/0.17, 0.88/0.05/72/0.14, 0.8/0.11/85/0.1, 0.92/0.02/30/0.09}{%
      \fins@tube{(\fins@x,\fins@y) -- ++(\fins@a:\fins@l)}{fins@c@belly}{fins@c@outline}{0.028}%
      \filldraw[fill=fins@c@belly!80!white, draw=fins@c@outline, line width=0.5*\fins@lw]
        ($(\fins@x,\fins@y)+(\fins@a:\fins@l)$) circle (0.022);
    }%
    \def\fins@path{(0.56,-0.3) .. controls (0.42,-0.44) and (0.22,-0.52) .. (-0.02,-0.54)
      .. controls (0.04,-0.4) and (0.16,-0.26) .. (0.3,-0.2) -- cycle}%
    \fins@fin{fins@c@fin}{\fins@path}{(0.54,-0.3)}{(0.3,-0.21)}{(0.0,-0.6)}{(0.02,-0.38)}{6}%
    \fins@spottedfin{\fins@path}{6}%
    \fins@tube{(0.56,-0.3) .. controls (0.42,-0.44) and (0.22,-0.52) .. (-0.02,-0.54)}%
      {fins@c@fin!80!black}{fins@c@outline}{0.03}%
  \fins@close
}

% ---- dwarf gourami (type=blue for a three-spot gourami) ----
\def\fins@gourami@body{%
  (1.0,0.05)
  .. controls (0.96,0.3) and (0.7,0.55) .. (0.2,0.58)
  .. controls (-0.25,0.58) and (-0.55,0.36) .. (-0.72,0.15)
  -- (-0.76,0.13) -- (-0.76,-0.13) -- (-0.72,-0.15)
  .. controls (-0.55,-0.4) and (-0.2,-0.6) .. (0.2,-0.58)
  .. controls (0.7,-0.52) and (0.96,-0.25) .. (1.0,0.05) -- cycle
}
\def\fins@gourami@dorsal{(0.12,0.57) .. controls (-0.05,0.76) and (-0.42,0.74) .. (-0.66,0.5)
  .. controls (-0.74,0.38) .. (-0.72,0.14) -- (0,0.4) -- cycle}
\def\fins@gourami@anal{(0.36,-0.54) .. controls (0.1,-0.86) and (-0.45,-0.84) .. (-0.74,-0.52)
  .. controls (-0.8,-0.36) .. (-0.74,-0.14) -- (0,-0.4) -- cycle}
\def\fins@gourami@tail{(-0.74,0.12) .. controls (-1.0,0.46) and (-1.32,0.46) .. (-1.38,0.16)
  .. controls (-1.42,0.0) .. (-1.38,-0.16) .. controls (-1.32,-0.46) and (-1.0,-0.46) .. (-0.74,-0.12) -- cycle}
\def\fins@gourami@fin#1#2{% path, rays
  \fins@edgedfin{fins@c@fin}{fins@c@accent}{#1}{(0,0)}{(0,0)}{(0,0)}{(0,0)}{0}%
  \begin{scope}[overlay]\clip #1;
    \fins@dots{40}{-1.5}{0.5}{-1}{1}{0.018}{0.014}{9}%
    \fill[fins@c@pattern, opacity=0.8] \fins@dotlist;
  \end{scope}
  \path[draw=fins@c@accent!60!black, line width=0.55*\fins@lw, line join=round] #1;
}
\fins@newfish{gourami}
\def\fins@draw@gourami#1{%
  \fins@prepare{%
    \def\fins@tmp{blue}%
    \ifx\fins@type\fins@tmp
      \colorlet{fins@c@body}{finsbluegourami}\colorlet{fins@c@belly}{finsbluegouramibelly}%
      \colorlet{fins@c@fin}{finsbluegourami}\colorlet{fins@c@pattern}{finsbluegouramispot}%
      \colorlet{fins@c@accent}{finsbluegouramiedge}\def\fins@dwarf{0}%
      \colorlet{fins@c@iris}{finsheart}%
    \else
      \colorlet{fins@c@body}{finsgourami}\colorlet{fins@c@belly}{finsgouramibelly}%
      \colorlet{fins@c@fin}{finsgouramifin}\colorlet{fins@c@pattern}{finsgouramiblue}%
      \colorlet{fins@c@accent}{finsgouramiedge}\def\fins@dwarf{1}%
      \colorlet{fins@c@iris}{finsgourami!70!black}%
    \fi
    \colorlet{fins@c@outline}{fins@c@body!45!black}%
    \fins@eyespot{0.72}{0.16}{0.085}%
    \fins@mouthspot{1.0}{0.06}{18}{0.9}%
    \fins@topspot{0.4}{0.58}{-10}{0.65}%
    \fins@legspots{-0.15}{0.35}{-0.55}{1}%
    \fins@skeleton{-0.75}{0}{0.55}{0.04}{0.8}%
    \fins@tailend{-1.4}{0}{0.45}%
    \def\fins@bodypath{\fins@gourami@body}%
  }{#1}%
  \fins@open
    % the pelvic fins are long feelers
    \foreach \fins@d in {0,0.06}{%
      \fins@tube{(0.52-\fins@d,-0.44) .. controls (0.4-\fins@d,-0.75) and (0.0,-0.98) .. (-0.62+\fins@d,-1.02+\fins@d)}%
        {fins@c@body!80!white}{fins@c@outline}{0.022}%
    }%
    \fins@tailscope{-0.75}{0}{%
      \fins@gourami@fin{\fins@gourami@tail}{0}%
      \fins@rays{fins@c@fin}{\fins@gourami@tail}{(-0.75,0)}{(-0.75,0)}{(-1.5,0.6)}{(-1.5,-0.6)}{10}}%
    \fins@gourami@fin{\fins@gourami@dorsal}{0}%
    \fins@rays{fins@c@fin}{\fins@gourami@dorsal}{(0.1,0.5)}{(-0.7,0.15)}{(-0.2,0.85)}{(-0.85,0.5)}{9}%
    \fins@gourami@fin{\fins@gourami@anal}{0}%
    \fins@rays{fins@c@fin}{\fins@gourami@anal}{(0.3,-0.5)}{(-0.72,-0.15)}{(-0.1,-0.95)}{(-0.9,-0.5)}{11}%
    \fins@bodystart{\fins@gourami@body}{0.18}%
      \ifnum\fins@dwarf=1
        \fill[fins@c@pattern, opacity=0.95]
          \foreach \fins@x in {0.48,0.3,...,-0.75}{
            (\fins@x+0.1,0.7) -- (\fins@x+0.17,0.7) -- (\fins@x+0.0,-0.7) -- (\fins@x-0.07,-0.7) -- cycle};
        \fill[fins@c@pattern, opacity=0.85] (0.78,-0.3) ellipse (0.36 and 0.24);
      \else
        \fill[fins@c@pattern!40!fins@c@body, opacity=0.35]
          \foreach \fins@x in {0.4,0.2,...,-0.75}{
            (\fins@x+0.05,0.7) -- (\fins@x+0.12,0.7) -- (\fins@x-0.02,-0.7) -- (\fins@x-0.09,-0.7) -- cycle};
        \fill[fins@c@pattern] (-0.05,0.02) circle (0.09) (-0.64,0.0) circle (0.075);
      \fi
      \fins@gill{(0.56,0.45) .. controls (0.66,0.2) and (0.66,-0.15) .. (0.56,-0.42)}%
      \fins@shine{(0.5,0.48) .. controls (0.25,0.55) and (-0.05,0.55) .. (-0.3,0.46)}%
    \fins@bodyend{\fins@gourami@body}{0.14}%
    \fins@fin{fins@c@belly}
      {(0.52,-0.05) .. controls (0.34,0.05) and (0.14,0.0) .. (0.06,-0.14)
       .. controls (0.18,-0.26) and (0.4,-0.24) .. (0.52,-0.14) -- cycle}
      {(0.52,-0.1)}{(0.52,-0.1)}{(-0.05,0.08)}{(0.0,-0.35)}{5}%
  \fins@close
}

% ---- zebra danio ----
\def\fins@danio@body{%
  (1.1,0.02)
  .. controls (1.05,0.18) and (0.75,0.27) .. (0.25,0.27)
  .. controls (-0.3,0.27) and (-0.7,0.16) .. (-0.92,0.08)
  -- (-0.95,0.07) -- (-0.95,-0.07)
  .. controls (-0.7,-0.16) and (-0.3,-0.28) .. (0.25,-0.27)
  .. controls (0.75,-0.25) and (1.05,-0.16) .. (1.1,0.02) -- cycle
}
\def\fins@danio@tail{(-0.93,0.06) -- (-1.46,0.36) .. controls (-1.38,0.16) .. (-1.26,0.0)
  .. controls (-1.38,-0.16) .. (-1.46,-0.36) -- (-0.93,-0.06) -- cycle}
\def\fins@danio@anal{(-0.22,-0.25) .. controls (-0.32,-0.42) and (-0.5,-0.46) .. (-0.62,-0.42)
  .. controls (-0.62,-0.3) and (-0.64,-0.2) .. (-0.68,-0.15) -- cycle}
% the stripes run from the gill into the tail and anal fin
\def\fins@danio@stripes{%
  \fill[fins@c@pattern]
    \foreach \fins@y in {0.15,0.06,-0.03,-0.12,-0.21}{
      (0.58,\fins@y+0.026) -- (-0.95,0.45*\fins@y+0.017) -- (-1.55,1.7*\fins@y+0.03)
      -- (-1.55,1.7*\fins@y-0.03) -- (-0.95,0.45*\fins@y-0.017) -- (0.58,\fins@y-0.026) -- cycle};
}
\fins@newfish{zebradanio}
\def\fins@draw@zebradanio#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsdanio}\colorlet{fins@c@belly}{finsdaniobelly}%
    \colorlet{fins@c@fin}{finsdanio}\colorlet{fins@c@outline}{finsdaniostripe!60!black}%
    \colorlet{fins@c@pattern}{finsdaniostripe}\colorlet{fins@c@iris}{finsstar!80!black}%
    \def\fins@finop{0.75}%
    \fins@eyespot{0.86}{0.06}{0.07}%
    \fins@mouthspot{1.1}{0.03}{14}{0.75}%
    \fins@topspot{0.55}{0.27}{-5}{0.5}%
    \fins@legspots{-0.1}{0.4}{-0.25}{0.8}%
    \fins@skeleton{-0.94}{0}{0.62}{0.0}{0.75}%
    \fins@tailend{-1.46}{0}{0.3}%
    \def\fins@bodypath{\fins@danio@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.94}{0}{%
      \fins@fin{fins@c@fin}{\fins@danio@tail}{(-0.94,0)}{(-0.94,0)}{(-1.6,0.45)}{(-1.6,-0.45)}{8}%
      \begin{scope}[overlay]\clip \fins@danio@tail; \fins@danio@stripes \end{scope}}%
    \fins@fin{fins@c@fin}{(-0.12,0.26) .. controls (-0.2,0.44) and (-0.34,0.48) .. (-0.44,0.44)
      .. controls (-0.44,0.32) and (-0.48,0.24) .. (-0.52,0.2) -- cycle}
      {(-0.14,0.26)}{(-0.5,0.2)}{(-0.34,0.55)}{(-0.55,0.45)}{5}%
    \fins@fin{fins@c@fin}{\fins@danio@anal}{(-0.24,-0.25)}{(-0.66,-0.16)}{(-0.5,-0.52)}{(-0.7,-0.44)}{5}%
    \begin{scope}[overlay]\clip \fins@danio@anal;
      \fill[fins@c@pattern, opacity=0.85] (-1,-0.36) rectangle (0,-0.31) (-1,-0.27) rectangle (0,-0.22);
    \end{scope}
    \fins@fin{fins@c@fin}{(0.12,-0.25) .. controls (0.05,-0.36) and (-0.05,-0.4) .. (-0.12,-0.38)
      .. controls (-0.1,-0.3) .. (-0.08,-0.24) -- cycle}{(0,0)}{(0,0)}{(0,0)}{(0,0)}{0}%
    \fins@bodystart{\fins@danio@body}{0.09}%
      \fins@danio@stripes
      \fins@gill{(0.64,0.2) .. controls (0.7,0.06) and (0.7,-0.1) .. (0.63,-0.22)}%
      \fins@shine{(0.62,0.21) .. controls (0.4,0.24) and (0.15,0.24) .. (-0.05,0.21)}%
    \fins@bodyend{\fins@danio@body}{0.06}%
    \fins@fin{fins@c@belly}
      {(0.6,-0.07) .. controls (0.46,0.0) and (0.3,-0.03) .. (0.24,-0.12)
       .. controls (0.32,-0.2) and (0.48,-0.19) .. (0.6,-0.13) -- cycle}
      {(0.6,-0.1)}{(0.6,-0.1)}{(0.16,0.02)}{(0.18,-0.26)}{4}%
  \fins@close
}

% ---- lionfish ----
\def\fins@lion@body{%
  (1.12,-0.05)
  .. controls (1.1,0.2) and (0.85,0.42) .. (0.45,0.5)
  .. controls (0.0,0.55) and (-0.5,0.38) .. (-0.82,0.16)
  -- (-0.88,0.14) -- (-0.88,-0.14)
  .. controls (-0.5,-0.34) and (0.0,-0.5) .. (0.4,-0.48)
  .. controls (0.8,-0.44) and (1.06,-0.28) .. (1.12,-0.05) -- cycle
}
\def\fins@lion@softdorsal{(-0.4,0.36) .. controls (-0.48,0.72) and (-0.72,0.66) .. (-0.86,0.15) -- cycle}
\def\fins@lion@anal{(-0.36,-0.36) .. controls (-0.44,-0.72) and (-0.7,-0.64) .. (-0.84,-0.17) -- cycle}
\def\fins@lion@tail{(-0.86,0.12) .. controls (-1.1,0.42) and (-1.4,0.42) .. (-1.45,0.1)
  .. controls (-1.47,0.0) .. (-1.45,-0.1) .. controls (-1.4,-0.42) and (-1.1,-0.42) .. (-0.86,-0.12) -- cycle}
% a banded spine or ray: from, to
\def\fins@lionray#1#2{%
  \pgfmathsetlengthmacro\fins@dA{1.9pt*\fins@scale}\pgfmathsetlengthmacro\fins@dB{1.6pt*\fins@scale}%
  \draw[fins@c@outline, line width=2.5*\fins@lw, line cap=round] #1 -- #2;
  \draw[fins@c@accent, line width=1.4*\fins@lw, line cap=round] #1 -- #2;
  \draw[fins@c@pattern, line width=1.4*\fins@lw, dash pattern=on \fins@dA off \fins@dB] #1 -- #2;
}
\def\fins@lion@dottedfin#1{% path
  \fill[fins@c@fin, fill opacity=0.6] #1;
  \begin{scope}[overlay]\clip #1;
    \fins@dots{26}{-1.5}{-0.3}{-0.8}{0.8}{0.016}{0.012}{3}%
    \fill[fins@c@pattern, opacity=0.85] \fins@dotlist;
  \end{scope}
  \path[draw=fins@c@outline, line width=0.5*\fins@lw, line join=round] #1;
}
\fins@newfish{lionfish}
\def\fins@draw@lionfish#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finslion}\colorlet{fins@c@belly}{white}%
    \colorlet{fins@c@fin}{finslion}\colorlet{fins@c@outline}{finslionred!55!black}%
    \colorlet{fins@c@pattern}{finslionred}\colorlet{fins@c@accent}{finslion}%
    \colorlet{fins@c@iris}{finslionred!80!black}%
    \fins@eyespot{0.8}{0.17}{0.085}%
    \fins@mouthspot{1.12}{-0.06}{-8}{1}%
    \fins@topspot{0.45}{0.52}{-8}{0.6}%
    \fins@legspots{-0.25}{0.35}{-0.45}{1}%
    \fins@skeleton{-0.87}{0}{0.6}{0.02}{0.8}%
    \fins@tailend{-1.48}{0}{0.4}%
    \def\fins@bodypath{\fins@lion@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.87}{0}{\fins@lion@dottedfin{\fins@lion@tail}}%
    \fins@lion@dottedfin{\fins@lion@softdorsal}%
    \fins@lion@dottedfin{\fins@lion@anal}%
    % the long venomous dorsal spines, with a low web between them
    \fill[fins@c@fin, fill opacity=0.55]
      (0.46,0.46) \foreach \fins@x/\fins@y/\fins@a/\fins@l in \fins@lion@spines {
        -- ($(\fins@x,\fins@y)+(\fins@a:0.42*\fins@l)$)} -- (-0.5,0.3) -- cycle;
    \foreach \fins@x/\fins@y/\fins@a/\fins@l in \fins@lion@spines{%
      \fins@lionray{(\fins@x,\fins@y)}{++(\fins@a:\fins@l)}%
    }%
    \fins@bodystart{\fins@lion@body}{0.08}%
      \fill[fins@c@pattern]
        \foreach \fins@x/\fins@w in {0.6/0.05, 0.4/0.055, 0.2/0.055, 0.0/0.055, -0.2/0.05, -0.4/0.045, -0.58/0.04, -0.74/0.035}{
          (\fins@x-\fins@w+0.05,0.7) .. controls (\fins@x-\fins@w,0.2) and (\fins@x-\fins@w+0.04,-0.2) .. (\fins@x-\fins@w+0.08,-0.7)
          -- (\fins@x+\fins@w+0.08,-0.7) .. controls (\fins@x+\fins@w+0.04,-0.2) and (\fins@x+\fins@w,0.2) .. (\fins@x+\fins@w+0.05,0.7) -- cycle};
      \draw[fins@c@pattern, line width=0.7*\fins@lw]
        \foreach \fins@x in {0.5,0.3,0.1,-0.1,-0.3,-0.49,-0.66,0.7}{
          (\fins@x+0.05,0.7) .. controls (\fins@x,0.2) and (\fins@x+0.04,-0.2) .. (\fins@x+0.08,-0.7)};
      % bands radiating from the eye on the head
      \draw[fins@c@pattern, line width=3.2*\fins@lw] (0.8,0.17) circle (0.17) (0.8,0.17) circle (0.31);
      \fins@shine{(0.42,0.46) .. controls (0.2,0.5) and (-0.05,0.48) .. (-0.3,0.38)}%
    \fins@bodyend{\fins@lion@body}{0.08}%
    % tentacles above the eye and on the chin
    \fins@lionray{(0.82,0.3)}{(0.88,0.66)}%
    \fins@tube{(0.82,0.42) -- ++(150:0.08) (0.85,0.52) -- ++(30:0.08)}{fins@c@accent}{fins@c@outline}{0.015}%
    \fins@lionray{(0.98,-0.24)}{(0.96,-0.36)}%
    % pelvic fin
    \def\fins@path{(0.28,-0.44) .. controls (0.22,-0.66) and (0.1,-0.84) .. (-0.02,-0.9)
      .. controls (0.0,-0.7) and (0.0,-0.55) .. (-0.04,-0.42) -- cycle}%
    \fill[fins@c@pattern!70!black] \fins@path;
    \begin{scope}[overlay]\clip \fins@path;
      \fins@dots{8}{-0.1}{0.3}{-0.9}{-0.45}{0.018}{0.01}{7}%
      \fill[white] \fins@dotlist;
    \end{scope}
    \path[draw=fins@c@outline, line width=0.5*\fins@lw] \fins@path;
    % the huge, fan-like pectoral fin
    \fill[fins@c@fin, fill opacity=0.5]
      (0.44,-0.1) \foreach \fins@a/\fins@l in \fins@lion@pectoral{
        -- ($(0.44,-0.1)+(\fins@a:0.8*\fins@l)$)} -- cycle;
    \begin{scope}[overlay]
      \clip (0.44,-0.1) \foreach \fins@a/\fins@l in \fins@lion@pectoral{
        -- ($(0.44,-0.1)+(\fins@a:0.8*\fins@l)$)} -- cycle;
      \draw[fins@c@pattern, opacity=0.55, line width=3.5*\fins@lw]
        \foreach \fins@r in {0.3,0.52,0.74,0.96,1.18}{(0.44,-0.1) circle (\fins@r)};
    \end{scope}
    \foreach \fins@a/\fins@l in \fins@lion@pectoral{%
      \fins@lionray{(0.44,-0.1)}{++(\fins@a:\fins@l)}%
    }%
  \fins@close
}
\def\fins@lion@spines{0.42/0.46/86/0.85, 0.34/0.49/92/1.05, 0.26/0.5/97/1.2, 0.18/0.51/101/1.28,
  0.1/0.51/105/1.3, 0.02/0.5/109/1.26, -0.06/0.49/113/1.18, -0.14/0.47/117/1.08,
  -0.22/0.45/121/0.96, -0.3/0.42/125/0.82, -0.37/0.39/129/0.66, -0.43/0.36/133/0.5}
\def\fins@lion@pectoral{160/1.05, 169/1.2, 178/1.32, 187/1.4, 196/1.44, 205/1.42,
  214/1.36, 223/1.26, 232/1.12, 241/0.96, 250/0.8}

% ---- damselfish (humbug; stripes=4 for the four-stripe damsel) ----
\def\fins@damsel@body{%
  (0.95,0.05)
  .. controls (0.92,0.38) and (0.62,0.62) .. (0.15,0.64)
  .. controls (-0.3,0.62) and (-0.6,0.36) .. (-0.72,0.14)
  -- (-0.78,0.12) -- (-0.78,-0.12) -- (-0.72,-0.14)
  .. controls (-0.6,-0.36) and (-0.3,-0.6) .. (0.15,-0.6)
  .. controls (0.62,-0.56) and (0.92,-0.3) .. (0.95,0.05) -- cycle
}
\def\fins@damsel@dorsal{(0.42,0.6) .. controls (0.25,0.86) and (-0.15,0.92) .. (-0.45,0.78)
  .. controls (-0.62,0.62) and (-0.7,0.35) .. (-0.72,0.14) -- (0,0.4) -- cycle}
\def\fins@damsel@anal{(-0.1,-0.58) .. controls (-0.25,-0.85) and (-0.55,-0.82) .. (-0.7,-0.55)
  .. controls (-0.74,-0.4) .. (-0.72,-0.14) -- (0,-0.4) -- cycle}
\def\fins@damsel@tail{(-0.76,0.1) -- (-1.24,0.46) .. controls (-1.18,0.16) .. (-1.1,0.0)
  .. controls (-1.18,-0.16) .. (-1.24,-0.46) -- (-0.76,-0.1) -- cycle}
\def\fins@damsel@bars{%
  \fill[fins@c@pattern]
    (0.5,1.1) -- (0.76,1.1) -- (0.7,-1.1) -- (0.38,-1.1) -- cycle
    (-0.08,1.1) -- (0.18,1.1) -- (0.08,-1.1) -- (-0.2,-1.1) -- cycle
    (-0.62,1.1) -- (-0.4,1.1) -- (-0.5,-1.1) -- (-0.74,-1.1) -- cycle;
}
\fins@newfish{damselfish}
\def\fins@draw@damselfish#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsdamsel}\colorlet{fins@c@belly}{white}%
    \colorlet{fins@c@fin}{finsdamsel}\colorlet{fins@c@outline}{finsdamselblack!65}%
    \colorlet{fins@c@pattern}{finsdamselblack}\colorlet{fins@c@iris}{finsdamselblack!60}%
    \fins@eyespot{0.62}{0.2}{0.09}%
    \fins@mouthspot{0.95}{0.04}{5}{0.9}%
    \fins@topspot{0.35}{0.62}{-10}{0.65}%
    \fins@legspots{-0.2}{0.3}{-0.58}{1}%
    \fins@skeleton{-0.77}{0}{0.5}{0.04}{0.85}%
    \fins@tailend{-1.26}{0}{0.45}%
    \def\fins@bodypath{\fins@damsel@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-0.77}{0}{%
      \fins@fin{fins@c@fin}{\fins@damsel@tail}{(-0.77,0)}{(-0.77,0)}{(-1.35,0.6)}{(-1.35,-0.6)}{9}%
      \ifnum\fins@stripes>3
        \begin{scope}[overlay]\clip \fins@damsel@tail;
          \fill[fins@c@pattern] (-1.0,1) .. controls (-0.94,0.3) and (-0.94,-0.3) .. (-1.0,-1) -- (-2,-1) -- (-2,1) -- cycle;
        \end{scope}
        \path[draw=fins@c@fin!55!black, line width=0.55*\fins@lw, line join=round] \fins@damsel@tail;
      \fi}%
    \foreach \fins@path in {\fins@damsel@dorsal,\fins@damsel@anal}{%
      \fill[fins@c@fin, fill opacity=\fins@finop] \fins@path;
      \begin{scope}[overlay]\clip \fins@path; \fins@damsel@bars \end{scope}
      \path[draw=fins@c@outline, line width=0.55*\fins@lw, line join=round] \fins@path;
    }%
    \fins@rays{fins@c@fin}{\fins@damsel@dorsal}{(0.4,0.55)}{(-0.7,0.15)}{(0.2,1.0)}{(-0.85,0.5)}{11}%
    \fins@rays{fins@c@fin}{\fins@damsel@anal}{(-0.1,-0.55)}{(-0.7,-0.15)}{(-0.3,-0.95)}{(-0.85,-0.5)}{8}%
    \fins@fin{fins@c@pattern}{(0.42,-0.54) .. controls (0.38,-0.75) and (0.3,-0.9) .. (0.2,-0.98)
      .. controls (0.2,-0.8) and (0.2,-0.66) .. (0.16,-0.56) -- cycle}
      {(0.4,-0.55)}{(0.18,-0.56)}{(0.22,-1.0)}{(0.15,-0.9)}{4}%
    \fins@bodystart{\fins@damsel@body}{0.16}%
      \fins@damsel@bars
      \fins@shine{(0.42,0.55) .. controls (0.2,0.6) and (-0.05,0.6) .. (-0.25,0.52)}%
    \fins@bodyend{\fins@damsel@body}{0.12}%
    \fins@fin{white}
      {(0.36,-0.02) .. controls (0.2,0.08) and (0.0,0.04) .. (-0.08,-0.08)
       .. controls (0.02,-0.2) and (0.22,-0.2) .. (0.36,-0.12) -- cycle}
      {(0.36,-0.07)}{(0.36,-0.07)}{(-0.16,0.1)}{(-0.12,-0.26)}{5}%
  \fins@close
}

% ---- blacktip reef shark ----
\def\fins@shark@body{%
  (2.05,-0.08)
  .. controls (2.02,0.12) and (1.7,0.3) .. (1.2,0.38)
  .. controls (0.6,0.48) and (-0.2,0.45) .. (-0.9,0.26)
  .. controls (-1.3,0.16) and (-1.55,0.1) .. (-1.7,0.08)
  -- (-1.72,-0.05)
  .. controls (-1.5,-0.1) and (-1.0,-0.24) .. (-0.4,-0.36)
  .. controls (0.4,-0.48) and (1.3,-0.42) .. (1.7,-0.3)
  .. controls (1.95,-0.22) and (2.05,-0.15) .. (2.05,-0.08) -- cycle
}
\def\fins@shark@dorsal{(0.55,0.44) .. controls (0.4,0.72) and (0.2,0.98) .. (-0.02,1.12)
  .. controls (-0.06,0.88) and (-0.14,0.62) .. (-0.32,0.42) -- (0,0.4) -- cycle}
\def\fins@shark@pectoral{(1.02,-0.36) .. controls (0.82,-0.6) and (0.56,-0.86) .. (0.24,-1.0)
  .. controls (0.38,-0.76) and (0.48,-0.56) .. (0.52,-0.4) -- cycle}
\def\fins@shark@tail{(-1.66,0.08) .. controls (-1.95,0.26) and (-2.25,0.5) .. (-2.62,0.8)
  .. controls (-2.52,0.55) and (-2.42,0.3) .. (-2.32,0.12) -- (-2.38,0.05)
  .. controls (-2.32,-0.1) and (-2.27,-0.3) .. (-2.3,-0.54)
  .. controls (-2.06,-0.33) and (-1.86,-0.15) .. (-1.7,-0.05) -- cycle}
% a shark fin with a black tip: path, clip for the tip
\def\fins@tipfin#1#2{%
  \fill[fins@c@fin] #1;
  \begin{scope}[overlay]\clip #1;
    \fill[fins@c@belly!40!fins@c@fin, opacity=0.6] #2;
    \fill[fins@c@pattern] #2;
  \end{scope}
  \path[draw=fins@c@outline, line width=0.6*\fins@lw, line join=round] #1;
}
\fins@newfish{shark}
\def\fins@draw@shark#1{%
  \fins@prepare{%
    \colorlet{fins@c@body}{finsshark}\colorlet{fins@c@belly}{finssharkbelly}%
    \colorlet{fins@c@fin}{finsshark}\colorlet{fins@c@outline}{finsshark!45!black}%
    \colorlet{fins@c@pattern}{finssharktip}\colorlet{fins@c@iris}{finssharktip}%
    \def\fins@backop{0.18}%
    \fins@eyespot{1.55}{0.06}{0.06}%
    \fins@mouthspot{1.76}{-0.27}{-16}{1.5}%
    \fins@topspot{1.2}{0.38}{-8}{0.75}%
    \fins@legspots{-0.4}{0.6}{-0.4}{1.4}%
    \fins@skeleton{-1.7}{0.02}{0.95}{0.0}{1.2}%
    \fins@tailend{-2.4}{0.1}{0.55}%
    \fins@jawspot{1.15}{-0.14}{-45}{0.36}%
    \def\fins@bodypath{\fins@shark@body}%
  }{#1}%
  \fins@open
    \fins@tailscope{-1.7}{0}{%
      \fins@tipfin{\fins@shark@tail}{(-2.38,0.05) .. controls (-2.33,-0.1) and (-2.27,-0.3) .. (-2.3,-0.54)
        -- (-2.12,-0.5) .. controls (-2.16,-0.3) and (-2.2,-0.12) .. (-2.26,0.06) -- cycle
        (-2.62,0.8) -- (-2.36,0.66) -- (-2.48,0.5) -- cycle}}%
    % second dorsal, pelvic and anal fins
    \fins@fin{fins@c@fin}{(-1.04,0.22) .. controls (-1.1,0.32) and (-1.16,0.38) .. (-1.24,0.4)
      .. controls (-1.24,0.3) and (-1.26,0.22) .. (-1.32,0.15) -- cycle}{(0,0)}{(0,0)}{(0,0)}{(0,0)}{0}%
    \fins@fin{fins@c@fin}{(-0.3,-0.36) .. controls (-0.42,-0.5) and (-0.56,-0.58) .. (-0.68,-0.58)
      .. controls (-0.64,-0.46) and (-0.64,-0.38) .. (-0.68,-0.29) -- cycle}{(0,0)}{(0,0)}{(0,0)}{(0,0)}{0}%
    \fins@fin{fins@c@fin}{(-1.08,-0.2) .. controls (-1.14,-0.3) and (-1.22,-0.36) .. (-1.3,-0.37)
      .. controls (-1.28,-0.28) and (-1.3,-0.2) .. (-1.34,-0.13) -- cycle}{(0,0)}{(0,0)}{(0,0)}{(0,0)}{0}%
    \fins@bodystart{\fins@shark@body}{0.3}%
      % the pale band along the flank
      \fill[fins@c@belly, opacity=0.6] (-1.0,-0.12) .. controls (-0.6,0.0) and (-0.2,-0.02) .. (0.2,-0.12)
        -- (0.2,-0.3) .. controls (-0.2,-0.3) and (-0.6,-0.3) .. (-1.0,-0.2) -- cycle;
      % five gill slits
      \draw[fins@c@outline, opacity=0.6, line width=0.9*\fins@lw, line cap=round]
        \foreach \fins@x/\fins@h in {1.08/0.36, 1.0/0.36, 0.92/0.35, 0.84/0.33, 0.76/0.3}{
          (\fins@x,0.15) .. controls (\fins@x-0.04,0.15-0.5*\fins@h) .. (\fins@x+0.01,0.15-\fins@h)};
      \fins@shine{(1.4,0.3) .. controls (0.9,0.42) and (0.2,0.44) .. (-0.4,0.34)}%
    \fins@bodyend{\fins@shark@body}{0.2}%
    \fins@tipfin{\fins@shark@dorsal}{(-1,0.86) .. controls (0,0.82) .. (1,0.9) -- (1,2) -- (-1,2) -- cycle}%
    \fins@tipfin{\fins@shark@pectoral}{(0,-1.2) -- (0.62,-0.76) .. controls (0.5,-0.72) .. (0.3,-0.7) -- (-0.1,-0.9) -- cycle}%
    % nostril
    \draw[fins@c@outline, line width=0.8*\fins@lw, line cap=round] (1.88,-0.12) -- (1.94,-0.13);
  \fins@close
}

%% ==================================================================
%% INVERTEBRATES
%% These stand on their `at' point like the aquarium components (the
%% jellyfish floats, centred on it), but take every fish key: eyes,
%% mouths, hats, speech, legs, schools...
%% ==================================================================
% scale a path about a point: centre x, y, factor, path
\def\fins@scaledpath#1#2#3#4#5{%
  \begin{scope}[shift={(#1,#2)}, scale=#3, shift={(-#1,-#2)}]#4 #5;\end{scope}%
}

% ---- snails: type=mystery (default), nerite, ramshorn ----
\def\fins@mystery@foot{(-0.78,0.0) .. controls (-0.82,0.08) and (-0.72,0.15) .. (-0.5,0.16)
  -- (0.45,0.2) .. controls (0.62,0.22) and (0.74,0.3) .. (0.84,0.27)
  .. controls (0.95,0.24) and (0.97,0.12) .. (0.9,0.06) .. controls (0.86,0.02) .. (0.78,0.0) -- cycle}
\def\fins@mystery@shell{(0.42,0.2) .. controls (0.62,0.42) and (0.58,0.9) .. (0.2,1.08)
  .. controls (-0.05,1.18) and (-0.35,1.16) .. (-0.52,1.06)
  .. controls (-0.78,0.92) and (-0.84,0.45) .. (-0.55,0.24)
  .. controls (-0.3,0.12) and (0.2,0.1) .. (0.42,0.2) -- cycle}
\def\fins@mystery@spire{(-0.26,1.13) .. controls (-0.32,1.27) and (-0.48,1.34) .. (-0.6,1.31)
  .. controls (-0.71,1.25) and (-0.74,1.1) .. (-0.64,0.98) -- cycle}
\def\fins@mystery@apex{(-0.5,1.3) .. controls (-0.54,1.39) and (-0.62,1.41) .. (-0.68,1.36)
  .. controls (-0.7,1.31) .. (-0.66,1.25) -- cycle}
\def\fins@nerite@foot{(-0.62,0.0) .. controls (-0.66,0.06) and (-0.58,0.12) .. (-0.42,0.13)
  -- (0.4,0.16) .. controls (0.55,0.18) and (0.64,0.24) .. (0.72,0.22)
  .. controls (0.8,0.19) and (0.8,0.09) .. (0.74,0.05) .. controls (0.7,0.01) .. (0.62,0.0) -- cycle}
\def\fins@nerite@shell{(0.5,0.15) .. controls (0.62,0.5) and (0.35,0.8) .. (-0.05,0.8)
  .. controls (-0.45,0.8) and (-0.7,0.55) .. (-0.66,0.3)
  .. controls (-0.64,0.16) and (-0.5,0.1) .. (-0.3,0.09) -- cycle}
\def\fins@ramshorn@foot{(-0.62,0.0) .. controls (-0.66,0.06) and (-0.58,0.12) .. (-0.42,0.13)
  -- (0.42,0.16) .. controls (0.58,0.18) and (0.7,0.24) .. (0.78,0.22)
  .. controls (0.86,0.19) and (0.86,0.09) .. (0.8,0.05) .. controls (0.76,0.01) .. (0.68,0.0) -- cycle}
\def\fins@ramshorn@shell{(-0.08,0.6) circle (0.47)}
\def\fins@snailtentacle#1#2{% path, colour
  \pgfmathsetlengthmacro\fins@tw{0.035*28.45274pt*\fins@scale}%
  \draw[fins@c@accent!50!black, line width=\fins@tw+1.4*\fins@lw, line cap=round] #1;
  \draw[#2, line width=\fins@tw, line cap=round] #1;
}
\fins@newfish{snail}
\def\fins@draw@snail#1{%
  \fins@prepare{%
    \def\fins@canjaw{0}%
    \def\fins@mouth{none}%
    \def\fins@tmp{nerite}%
    \ifx\fins@type\fins@tmp \def\fins@kind{2}\else
      \def\fins@tmp{ramshorn}%
      \ifx\fins@type\fins@tmp \def\fins@kind{3}\else\def\fins@kind{1}\fi
    \fi
    \ifcase\fins@kind\or
      \colorlet{fins@c@body}{finsmystery}\colorlet{fins@c@belly}{finsmystery!45!white}%
      \colorlet{fins@c@pattern}{finsmysteryband}\colorlet{fins@c@accent}{finssnailfoot}%
      \fins@eyespot{0.67}{0.38}{0.045}%
      \fins@mouthspot{0.92}{0.09}{-40}{0.6}%
      \fins@topspot{-0.1}{1.12}{10}{0.55}%
      \fins@tailend{-0.85}{0.4}{0.3}%
    \or
      \colorlet{fins@c@body}{finsnerite}\colorlet{fins@c@belly}{finsnerite!50!white}%
      \colorlet{fins@c@pattern}{finsneritestripe}\colorlet{fins@c@accent}{finsneritefoot}%
      \fins@eyespot{0.58}{0.3}{0.038}%
      \fins@mouthspot{0.77}{0.08}{-40}{0.55}%
      \fins@topspot{-0.08}{0.8}{0}{0.55}%
      \fins@tailend{-0.7}{0.35}{0.25}%
    \or
      \colorlet{fins@c@body}{finsramshorn}\colorlet{fins@c@belly}{finsramshorn!50!white}%
      \colorlet{fins@c@pattern}{finsramshorn!55!black}\colorlet{fins@c@accent}{finsramshornfoot}%
      \fins@eyespot{0.66}{0.3}{0.038}%
      \fins@mouthspot{0.83}{0.08}{-40}{0.55}%
      \fins@topspot{-0.08}{1.06}{0}{0.55}%
      \fins@tailend{-0.62}{0.55}{0.35}%
    \fi
    \colorlet{fins@c@outline}{fins@c@body!45!black}\colorlet{fins@c@iris}{finspupil}%
    \fins@legspots{-0.3}{0.35}{0.06}{0.7}%
  }{#1}%
  \fins@open
    \ifcase\fins@kind\or
      % far tentacle, foot, near tentacle and eye stalk
      \fins@snailtentacle{(0.74,0.27) .. controls (0.86,0.42) and (1.0,0.52) .. (1.14,0.55)}{fins@c@accent!80!black}%
      \filldraw[fill=fins@c@accent, draw=fins@c@accent!50!black, line width=0.7*\fins@lw, line join=round]
        \fins@mystery@foot;
      \begin{scope}[overlay]\clip \fins@mystery@foot;
        \fins@dots{30}{-0.8}{0.95}{0.0}{0.3}{0.008}{0.01}{2}%
        \fill[fins@c@accent!55!black, opacity=0.5] \fins@dotlist;
      \end{scope}
      \fins@snailtentacle{(0.78,0.24) .. controls (0.95,0.32) and (1.1,0.38) .. (1.26,0.36)}{fins@c@accent}%
      \fins@snailtentacle{(0.64,0.26) -- (0.67,0.36)}{fins@c@accent}%
      % shell: spire, body whorl, spiral bands
      \foreach \fins@path in {\fins@mystery@apex,\fins@mystery@spire}{%
        \fins@cshade{\fins@path}{0.04}\path[fins outline] \fins@path;}%
      \fins@cshade{\fins@mystery@shell}{0.07}%
      \begin{scope}[overlay]\clip \fins@mystery@shell;
        % spiral bands follow the coil; growth lines follow the lip
        \draw[fins@c@pattern, opacity=0.5, line width=1.5*\fins@lw]
          \foreach \fins@d in {0.12,0.3,0.5,0.68}{
            (-0.9,1.02-\fins@d) .. controls (-0.45,1.16-\fins@d) and (0.15,1.08-\fins@d) .. (0.65,0.66-0.8*\fins@d)};
        \draw[fins@c@outline, opacity=0.16, line width=0.6*\fins@lw]
          \foreach \fins@d in {0.14,0.3,0.48,0.66,0.84}{
            (0.42-\fins@d,0.15) .. controls (0.64-\fins@d,0.42) and (0.58-\fins@d,0.9) .. (0.2-0.7*\fins@d,1.12)};
        \fins@shine{(-0.5,0.8) .. controls (-0.4,0.98) and (-0.2,1.06) .. (0.0,1.06)}%
      \end{scope}
      \path[fins outline] \fins@mystery@shell;
      \draw[fins@c@belly, line width=1.6*\fins@lw, line cap=round] (0.4,0.22) .. controls (0.48,0.3) .. (0.5,0.4);
    \or
      \fins@snailtentacle{(0.62,0.22) .. controls (0.72,0.32) and (0.8,0.36) .. (0.9,0.38)}{fins@c@accent!80!black}%
      \filldraw[fill=fins@c@accent, draw=fins@c@accent!50!black, line width=0.7*\fins@lw, line join=round]
        \fins@nerite@foot;
      \fins@snailtentacle{(0.66,0.2) .. controls (0.78,0.26) and (0.88,0.28) .. (0.98,0.26)}{fins@c@accent}%
      \fins@cshade{\fins@nerite@shell}{0.06}%
      \begin{scope}[overlay]\clip \fins@nerite@shell;
        \pgfmathsetlengthmacro\fins@za{1.5pt*\fins@scale}\pgfmathsetlengthmacro\fins@zl{6pt*\fins@scale}%
        \draw[fins@c@pattern, line width=2.4*\fins@lw, line join=round,
              decorate, decoration={zigzag, amplitude=\fins@za, segment length=\fins@zl}]
          \foreach \fins@x in {-0.72,-0.44,...,0.6}{(\fins@x,0.95) .. controls (\fins@x+0.08,0.5) .. (\fins@x+0.32,0.0)};
        \fins@shine{(-0.5,0.55) .. controls (-0.4,0.72) and (-0.2,0.78) .. (0.0,0.77)}%
      \end{scope}
      \path[fins outline] \fins@nerite@shell;
      \fill[fins@c@outline] (-0.56,0.64) circle (0.03);
    \or
      \fins@snailtentacle{(0.7,0.22) .. controls (0.86,0.36) and (1.0,0.46) .. (1.16,0.5)}{fins@c@accent!80!black}%
      \filldraw[fill=fins@c@accent, draw=fins@c@accent!50!black, line width=0.7*\fins@lw, line join=round]
        \fins@ramshorn@foot;
      \fins@snailtentacle{(0.74,0.2) .. controls (0.9,0.28) and (1.06,0.3) .. (1.22,0.28)}{fins@c@accent}%
      \fins@cshade{\fins@ramshorn@shell}{0.06}%
      \begin{scope}[overlay]\clip \fins@ramshorn@shell;
        \draw[fins@c@pattern, line width=1.2*\fins@lw]
          plot[smooth, domain=0:1260, samples=60, variable=\fins@t]
            ({-0.08+0.47*(1-\fins@t/1440)*cos(\fins@t+60)},{0.6+0.47*(1-\fins@t/1440)*sin(\fins@t+60)});
        \draw[fins@c@outline, opacity=0.2, line width=0.6*\fins@lw]
          \foreach \fins@a in {0,20,...,340}{(-0.08,0.6) ++(\fins@a:0.18) -- ++(\fins@a:0.3)};
        \fins@shine{(-0.42,0.78) .. controls (-0.32,0.94) and (-0.18,1.0) .. (0.0,1.0)}%
      \end{scope}
      \path[fins outline] \fins@ramshorn@shell;
    \fi
  \fins@close
}

% ---- starfish: type=common (default), chocolatechip, linckia; arms=<n> ----
\def\fins@starpath{%
  \gdef\fins@starlist{}%
  \pgfmathsetmacro\fins@sa{360/\fins@arms}%
  \pgfmathtruncatemacro\fins@sn{\fins@arms-1}%
  \foreach \fins@k in {0,...,\fins@sn}{%
    \pgfmathsetmacro\fins@aa{90+\fins@k*\fins@sa}%
    \pgfmathsetmacro\fins@ab{\fins@aa+0.5*\fins@sa}%
    \xdef\fins@starlist{\fins@starlist (\fins@aa:\fins@sR) (\fins@ab:\fins@sr)}%
  }%
  \edef\fins@path{plot[smooth cycle, tension=\fins@stension] coordinates {\fins@starlist}}%
}
\fins@newfish{starfish}
\def\fins@draw@starfish#1{%
  \fins@prepare{%
    \def\fins@canjaw{0}%
    \def\fins@eye{none}\def\fins@mouth{none}%
    \def\fins@tmp{happy}\ifx\fins@face\fins@tmp\def\fins@eye{normal}\def\fins@mouth{smile}\fi
    \def\fins@tmp{sleepy}\ifx\fins@face\fins@tmp\def\fins@eye{closed}\def\fins@mouth{smile}\fi
    \def\fins@tmp{chocolatechip}%
    \ifx\fins@type\fins@tmp \def\fins@kind{2}\else
      \def\fins@tmp{linckia}%
      \ifx\fins@type\fins@tmp \def\fins@kind{3}\else\def\fins@kind{1}\fi
    \fi
    \ifcase\fins@kind\or
      \colorlet{fins@c@body}{finsstarfish}\colorlet{fins@c@belly}{finsstarfish!55!white}%
      \colorlet{fins@c@pattern}{finsstarfish!70!black}%
      \def\fins@sR{0.58}\def\fins@sr{0.23}\def\fins@stension{0.55}%
    \or
      \colorlet{fins@c@body}{finschocstar}\colorlet{fins@c@belly}{finschocstar!50!white}%
      \colorlet{fins@c@pattern}{finschocchip}%
      \def\fins@sR{0.58}\def\fins@sr{0.3}\def\fins@stension{0.6}%
    \or
      \colorlet{fins@c@body}{finslinckia}\colorlet{fins@c@belly}{finslinckia!55!white}%
      \colorlet{fins@c@pattern}{finslinckia!60!black}%
      \def\fins@sR{0.62}\def\fins@sr{0.165}\def\fins@stension{0.62}%
    \fi
    \colorlet{fins@c@outline}{fins@c@body!45!black}%
    \fins@eyespot{-0.075}{0.66}{0.035}\fins@eyespotb{0.075}{0.66}{0.035}%
    \fins@mouthspot{0.063}{0.56}{0}{0.6}%
    \fins@topspot{-0.06}{1.1}{8}{0.45}%
    \fins@legspots{-0.15}{0.15}{0.14}{0.7}%
    \fins@tailend{-0.6}{0.6}{0.3}%
  }{#1}%
  \fins@open
    \begin{scope}[shift={(0,0.6)}, rotate=8]
      \fins@starpath
      \fins@cshade{\fins@path}{0.05}%
      \begin{scope}[overlay]\clip \fins@path;
        \pgfmathsetmacro\fins@sa{360/\fins@arms}%
        \ifcase\fins@kind\or
          \fill[fins@c@belly]
            \foreach \fins@k in {1,...,\fins@arms}{
              \foreach \fins@r in {0.14,0.23,0.32,0.41,0.5}{
                (90+\fins@k*\fins@sa:\fins@r) circle (0.028)
                (90+\fins@k*\fins@sa+9:0.8*\fins@r) circle (0.016)
                (90+\fins@k*\fins@sa-9:0.8*\fins@r) circle (0.016)}};
        \or
          \draw[fins@c@pattern!40!fins@c@body, opacity=0.5, line width=0.6*\fins@lw]
            \foreach \fins@k in {1,...,\fins@arms}{(0,0) -- (90+\fins@k*\fins@sa:0.55)};
          \foreach \fins@k in {1,...,\fins@arms}{%
            \foreach \fins@r/\fins@s in {0.2/0.045, 0.33/0.042, 0.45/0.035}{%
              \fill[fins@c@pattern] (90+\fins@k*\fins@sa:\fins@r) circle (\fins@s);
              \fill[white, opacity=0.5] ($(90+\fins@k*\fins@sa:\fins@r)+(120:0.5*\fins@s)$) circle (0.3*\fins@s);
            }%
          }%
          \fill[fins@c@pattern] \foreach \fins@k in {1,...,\fins@arms}{(90+\fins@k*\fins@sa+0.5*\fins@sa:0.1) circle (0.035)};
        \or
          \fins@dots{60}{-0.6}{0.6}{-0.6}{0.6}{0.006}{0.008}{4}%
          \fill[fins@c@pattern, opacity=0.5] \fins@dotlist;
          \draw[white, opacity=0.35, line width=1.6*\fins@lw, line cap=round]
            \foreach \fins@k in {1,...,\fins@arms}{(90+\fins@k*\fins@sa+6:0.12) -- (90+\fins@k*\fins@sa+3:0.5)};
        \fi
      \end{scope}
      \path[fins outline] \fins@path;
    \end{scope}
  \fins@close
}

% ---- cleaner shrimp ----
\def\fins@shrimp@body{(0.86,0.52) .. controls (0.84,0.62) and (0.7,0.7) .. (0.45,0.72)
  .. controls (0.2,0.74) and (-0.05,0.72) .. (-0.2,0.66)
  .. controls (-0.45,0.58) and (-0.62,0.45) .. (-0.72,0.32) -- (-0.64,0.22)
  .. controls (-0.5,0.3) and (-0.3,0.36) .. (-0.1,0.38)
  .. controls (0.2,0.38) and (0.55,0.36) .. (0.75,0.4)
  .. controls (0.84,0.43) .. (0.86,0.52) -- cycle}
\def\fins@shrimp@tail{(-0.7,0.34) .. controls (-0.85,0.46) and (-1.0,0.5) .. (-1.1,0.44)
  .. controls (-1.14,0.3) and (-1.1,0.14) .. (-1.0,0.06)
  .. controls (-0.88,0.08) and (-0.74,0.16) .. (-0.64,0.22) -- cycle}
\def\fins@shrimpleg#1#2{% base x, colour
  \pgfmathsetlengthmacro\fins@dA{2pt*\fins@scale}%
  \draw[fins@c@outline, line width=2.2*\fins@lw, line join=round, line cap=round]
    (#1,0.51) -- (#1+0.11,0.26) -- (#1+0.05,0.0);
  \draw[#2, line width=1.1*\fins@lw, line join=round, line cap=round]
    (#1,0.51) -- (#1+0.11,0.26) -- (#1+0.05,0.0);
  \draw[fins@c@pattern, line width=1.1*\fins@lw, dash pattern=on \fins@dA off \fins@dA]
    (#1,0.51) -- (#1+0.11,0.26) -- (#1+0.05,0.0);
}
\def\fins@antenna#1{%
  \draw[fins@c@outline, line width=1.7*\fins@lw, line cap=round] #1;
  \draw[fins@c@accent, line width=0.9*\fins@lw, line cap=round] #1;
}
\fins@newfish{shrimp}
\def\fins@draw@shrimp#1{%
  \fins@prepare{%
    \def\fins@canjaw{0}%
    \def\fins@mouth{none}%
    \colorlet{fins@c@body}{finsshrimp}\colorlet{fins@c@belly}{finsshrimp!55!white}%
    \colorlet{fins@c@pattern}{finsshrimpred}\colorlet{fins@c@accent}{white}%
    \colorlet{fins@c@outline}{finsshrimpred!55!black}\colorlet{fins@c@iris}{finspupil}%
    \fins@eyespot{0.87}{0.84}{0.05}%
    \fins@mouthspot{0.88}{0.62}{-20}{0.6}%
    \fins@topspot{0.42}{0.85}{-3}{0.5}%
    \fins@legspots{0.05}{0.45}{0.48}{0.7}%
    \fins@tailend{-1.12}{0.4}{0.2}%
    \def\fins@bodypath{\fins@shrimp@body}%
  }{#1}%
  \fins@open
    % legs on the far side
    \foreach \fins@x in {0.58,0.46,0.34,0.22,0.1}{\fins@shrimpleg{\fins@x-0.06}{fins@c@accent!70!fins@c@body}}%
    \begin{scope}[yshift=0.12cm]
    \fins@antenna{(0.88,0.6) .. controls (1.2,0.95) and (1.15,1.35) .. (0.55,1.5) .. controls (0.2,1.58) .. (-0.1,1.45)}%
    \fins@fin{fins@c@body}{\fins@shrimp@tail}{(-0.67,0.28)}{(-0.67,0.28)}{(-1.2,0.55)}{(-1.1,0.0)}{5}%
    \begin{scope}[overlay]\clip \fins@shrimp@tail;
      \fill[fins@c@pattern, opacity=0.8] (-0.6,0.28) -- (-1.3,0.7) -- (-1.3,0.35) -- cycle;
      \fill[fins@c@accent] (-1.0,0.38) circle (0.035) (-0.98,0.17) circle (0.03);
    \end{scope}
    \path[draw=fins@c@outline, line width=0.6*\fins@lw, line join=round] \fins@shrimp@tail;
    \fill[fins@c@body, fill opacity=0.9] \fins@shrimp@body;
    \begin{scope}[overlay]\clip \fins@shrimp@body;
      \fill[fins@c@belly, opacity=0.5] (-1,0.2) rectangle (1,0.47);
      % the red back, split by a white stripe down the middle
      \begin{scope}[yshift=-0.17cm]
        \fill[fins@c@pattern, even odd rule] (-2,-2) rectangle (2,2) \fins@shrimp@body;
      \end{scope}
      \begin{scope}[yshift=-0.045cm]
        \fill[fins@c@accent, even odd rule] (-2,-2) rectangle (2,2) \fins@shrimp@body;
      \end{scope}
      \draw[fins@c@outline, opacity=0.45, line width=0.7*\fins@lw]
        (0.3,0.72) .. controls (0.24,0.55) .. (0.3,0.39)
        (-0.1,0.71) -- (-0.06,0.38) (-0.3,0.63) -- (-0.25,0.35)
        (-0.47,0.54) -- (-0.42,0.31) (-0.6,0.44) -- (-0.55,0.27);
      \fins@shine{(0.66,0.62) .. controls (0.5,0.68) and (0.3,0.68) .. (0.1,0.64)}%
    \end{scope}
    \path[draw=fins@c@outline, line width=0.7*\fins@lw, line join=round] \fins@shrimp@body;
    % rostrum, swimmerets, near legs, eye stalk, antennae
    \filldraw[fill=fins@c@pattern, draw=fins@c@outline, line width=0.6*\fins@lw, line join=round]
      (0.82,0.62) -- (1.05,0.64) -- (0.86,0.55) -- cycle;
    \draw[fins@c@accent!70!fins@c@pattern, line width=1.1*\fins@lw, line cap=round]
      \foreach \fins@x in {-0.08,-0.24,-0.4}{(\fins@x,0.36) -- ++(-0.08,-0.12)};
    \end{scope}
    \foreach \fins@x in {0.62,0.5,0.38,0.26,0.14}{\fins@shrimpleg{\fins@x}{fins@c@accent}}%
    \begin{scope}[yshift=0.12cm]
    \fins@tube{(0.8,0.62) -- (0.86,0.7)}{fins@c@body}{fins@c@outline}{0.03}%
    \fins@antenna{(0.9,0.6) .. controls (1.3,0.75) and (1.6,0.72) .. (1.85,0.55)}%
    \fins@antenna{(0.9,0.62) .. controls (1.2,1.0) and (1.45,1.25) .. (1.52,1.62)}%
    \fins@antenna{(0.86,0.5) .. controls (1.0,0.4) and (1.12,0.34) .. (1.22,0.36)}%
    \end{scope}
  \fins@close
}

% ---- hermit crab ----
\def\fins@hermit@whorl{(0.22,0.15) .. controls (0.35,0.45) and (0.25,0.85) .. (-0.15,0.92)
  .. controls (-0.5,0.98) and (-0.75,0.8) .. (-0.72,0.48)
  .. controls (-0.7,0.2) and (-0.4,0.06) .. (-0.1,0.06)
  .. controls (0.05,0.06) and (0.15,0.1) .. (0.22,0.15) -- cycle}
\def\fins@hermit@spireA{(-0.5,0.86) .. controls (-0.56,1.06) and (-0.8,1.12) .. (-0.94,1.04)
  .. controls (-1.02,0.92) and (-0.95,0.75) .. (-0.74,0.66) -- cycle}
\def\fins@hermit@spireB{(-0.86,1.0) .. controls (-0.9,1.13) and (-1.03,1.18) .. (-1.12,1.12)
  .. controls (-1.17,1.04) and (-1.11,0.95) .. (-1.0,0.9) -- cycle}
\def\fins@hermit@spireC{(-1.06,1.1) .. controls (-1.1,1.18) and (-1.17,1.21) .. (-1.22,1.18)
  .. controls (-1.24,1.13) .. (-1.18,1.06) -- cycle}
\def\fins@crableg#1{% path
  \fins@tube{#1}{fins@c@accent}{fins@c@accent!45!black}{0.05}%
}
\fins@newfish{hermitcrab}
\def\fins@draw@hermitcrab#1{%
  \fins@prepare{%
    \def\fins@canjaw{0}%
    \def\fins@mouth{none}%
    \colorlet{fins@c@body}{finshermitshell}\colorlet{fins@c@belly}{finshermitshell!45!white}%
    \colorlet{fins@c@pattern}{finshermitband}\colorlet{fins@c@accent}{finshermit}%
    \colorlet{fins@c@outline}{finshermitband!60!black}\colorlet{fins@c@iris}{finspupil}%
    \fins@eyespot{0.42}{0.84}{0.04}\fins@eyespotb{0.5}{0.8}{0.045}%
    \fins@mouthspot{0.44}{0.47}{0}{0.5}%
    \fins@topspot{-0.3}{0.92}{10}{0.6}%
    \fins@legspots{-0.3}{0.15}{0.1}{0.7}%
    \fins@tailend{-0.8}{0.5}{0.35}%
  }{#1}%
  \fins@open
    % legs on the far side, behind the shell
    {\colorlet{fins@c@accent}{fins@c@accent!75!black}%
     \fins@crableg{(0.12,0.26) -- (0.46,0.34) -- (0.6,0.02)}%
     \fins@crableg{(0.08,0.2) -- (0.3,0.26) -- (0.36,0.01)}}%
    % shell
    \foreach \fins@path in {\fins@hermit@spireC,\fins@hermit@spireB,\fins@hermit@spireA}{%
      \fins@cshade{\fins@path}{0.035}%
      \begin{scope}[overlay]\clip \fins@path;
        \draw[fins@c@pattern, opacity=0.6, line width=1.2*\fins@lw]
          \foreach \fins@d in {-0.06,0.06}{(-1.4,0.95+\fins@d) -- (-0.4,0.75+\fins@d)};
      \end{scope}
      \path[fins outline] \fins@path;
    }%
    \fins@cshade{\fins@hermit@whorl}{0.07}%
    \begin{scope}[overlay]\clip \fins@hermit@whorl;
      \foreach \fins@k in {0.8,0.6,0.4}{%
        \fins@scaledpath{-0.22}{0.48}{\fins@k}{\draw[fins@c@pattern, opacity=0.6, line width=1.5*\fins@lw]}{\fins@hermit@whorl}}%
      \fins@shine{(-0.58,0.62) .. controls (-0.5,0.8) and (-0.32,0.88) .. (-0.12,0.88)}%
    \end{scope}
    \path[fins outline] \fins@hermit@whorl;
    % the opening, with the crab coming out of it
    \filldraw[fill=finsmouth!60!black, draw=fins@c@outline, line width=0.7*\fins@lw]
      (0.12,0.33) ellipse [x radius=0.2, y radius=0.13, rotate=65];
    \filldraw[fill=fins@c@accent, draw=fins@c@accent!45!black, line width=0.7*\fins@lw, line join=round]
      (0.06,0.24) .. controls (0.08,0.48) and (0.24,0.6) .. (0.38,0.56)
      .. controls (0.44,0.46) and (0.4,0.3) .. (0.3,0.24) -- cycle;
    \fill[white, opacity=0.6] (0.2,0.45) circle (0.025) (0.28,0.5) circle (0.02);
    % eye stalks and antennae
    \fins@crableg{(0.32,0.5) -- (0.42,0.82)}%
    \fins@crableg{(0.36,0.48) -- (0.5,0.78)}%
    \draw[fins@c@accent!45!black, line width=1.6*\fins@lw, line cap=round]
      (0.38,0.52) .. controls (0.6,0.8) .. (0.72,1.1) (0.4,0.5) .. controls (0.7,0.66) .. (0.9,0.8);
    \draw[fins@c@accent, line width=0.8*\fins@lw, line cap=round]
      (0.38,0.52) .. controls (0.6,0.8) .. (0.72,1.1) (0.4,0.5) .. controls (0.7,0.66) .. (0.9,0.8);
    % near legs and the big claw
    \fins@crableg{(0.2,0.24) -- (0.54,0.3) -- (0.72,0.02)}%
    \fins@crableg{(0.16,0.18) -- (0.4,0.22) -- (0.5,0.01)}%
    \fins@crableg{(0.3,0.36) -- (0.5,0.38) -- (0.6,0.4)}%
    \filldraw[fill=fins@c@accent, draw=fins@c@accent!45!black, line width=0.8*\fins@lw, line join=round]
      (0.58,0.33) .. controls (0.62,0.22) and (0.8,0.22) .. (0.94,0.29) -- (0.82,0.36) -- (0.95,0.44)
      .. controls (0.86,0.56) and (0.64,0.56) .. (0.58,0.48) -- cycle;
    \fill[white, opacity=0.55] (0.68,0.46) circle (0.02) (0.76,0.48) circle (0.018) (0.7,0.32) circle (0.016);
  \fins@close
}

% ---- moon jellyfish (it floats, centred on `at') ----
\def\fins@jelly@bell{(-0.75,0.0) .. controls (-0.78,0.55) and (-0.4,0.78) .. (0,0.78)
  .. controls (0.4,0.78) and (0.78,0.55) .. (0.75,0.0)
  .. controls (0.5,-0.06) and (-0.5,-0.06) .. (-0.75,0.0) -- cycle}
\fins@newfish{jellyfish}
\def\fins@draw@jellyfish#1{%
  \fins@prepare{%
    \def\fins@canjaw{0}%
    \def\fins@eye{none}\def\fins@mouth{none}%
    \def\fins@tmp{happy}\ifx\fins@face\fins@tmp\def\fins@eye{normal}\def\fins@mouth{smile}\fi
    \def\fins@tmp{sleepy}\ifx\fins@face\fins@tmp\def\fins@eye{closed}\def\fins@mouth{smile}\fi
    \colorlet{fins@c@body}{finsjelly}\colorlet{fins@c@belly}{white}%
    \colorlet{fins@c@pattern}{finsjellypink}\colorlet{fins@c@accent}{finsjellypink!40!white}%
    \colorlet{fins@c@outline}{finsjellypink!50!finsbubbleline!70!black}\colorlet{fins@c@iris}{finspupil}%
    \fins@eyespot{-0.17}{0.25}{0.06}\fins@eyespotb{0.17}{0.25}{0.06}%
    \fins@mouthspot{0.08}{0.12}{0}{0.75}%
    \fins@topspot{0}{0.77}{0}{0.6}%
    \fins@legspots{-0.25}{0.2}{-0.05}{0.8}%
    \fins@tailend{-0.75}{0.35}{0.35}%
  }{#1}%
  \fins@open
    \pgfmathsetmacro\fins@sw{\fins@sway/40}%
    \pgfmathsetlengthmacro\fins@sa{1.6pt*\fins@scale}\pgfmathsetlengthmacro\fins@sl{5pt*\fins@scale}%
    % four frilly oral arms
    \foreach \fins@x/\fins@len in {-0.14/1.05, 0.12/1.2, -0.02/1.3, 0.24/0.95}{%
      \draw[fins@c@accent, opacity=0.75, line width=4*\fins@lw, line cap=round,
            decorate, decoration={snake, amplitude=\fins@sa, segment length=\fins@sl}]
        (\fins@x,-0.02) .. controls (\fins@x+0.08,-0.4*\fins@len) and (\fins@x-0.1+0.5*\fins@sw,-0.75*\fins@len)
        .. (\fins@x+\fins@sw,-\fins@len);
      \draw[fins@c@pattern, opacity=0.55, line width=0.7*\fins@lw,
            decorate, decoration={snake, amplitude=\fins@sa, segment length=\fins@sl}]
        (\fins@x,-0.02) .. controls (\fins@x+0.08,-0.4*\fins@len) and (\fins@x-0.1+0.5*\fins@sw,-0.75*\fins@len)
        .. (\fins@x+\fins@sw,-\fins@len);
    }%
    % fine tentacles round the rim
    \draw[fins@c@outline, opacity=0.45, line width=0.45*\fins@lw, line cap=round]
      \foreach \fins@x in {-0.72,-0.66,...,0.73}{
        (\fins@x,{-0.045*(1-(\fins@x/0.75)^2)}) .. controls +(0,-0.15) and +(0.3*\fins@sw,0.1) ..
        ++(0.08*\fins@x+0.6*\fins@sw,{-0.3-0.12*sin(\fins@x*900)})};
    % the bell, with the four horseshoe-shaped gonads seen through it
    \fill[fins@c@body, fill opacity=0.55] \fins@jelly@bell;
    \begin{scope}[overlay]\clip \fins@jelly@bell;
      \fill[white, opacity=0.5] (-0.2,0.6) ellipse (0.35 and 0.12);
      \draw[fins@c@pattern, opacity=0.85, line width=3.6*\fins@lw, line cap=round]
        (-0.33,0.47) ++(-60:0.11) arc (-60:240:0.11)
        (0.0,0.53) ++(-60:0.12) arc (-60:240:0.12)
        (0.33,0.47) ++(-60:0.11) arc (-60:240:0.11);
      \draw[fins@c@accent, opacity=0.9, line width=4*\fins@lw] (0.75,0.0) .. controls (0.5,-0.06) and (-0.5,-0.06) .. (-0.75,0.0);
    \end{scope}
    \path[draw=fins@c@outline, line width=0.7*\fins@lw] \fins@jelly@bell;
    \draw[white, opacity=0.8, line width=2*\fins@lw, line cap=round]
      (-0.62,0.32) .. controls (-0.55,0.52) and (-0.4,0.64) .. (-0.22,0.7);
  \fins@close
}

%% ==================================================================
%% AQUARIUM COMPONENTS
%% Components sit on their `at' point (the middle of their base).
%% ==================================================================
\def\fins@cprepare#1#2{%
  \begingroup
  \fins@fishfalse
  \pgfkeys{/fins/.cd,#2}%
  #1%
  \pgfkeys{/fins/.cd,#2}%
  \fins@setwidths
}
\def\fins@copen{%
  \expandafter\fins@openscope\expandafter{\fins@at}%
  \begin{scope}[rotate=\fins@rotate, xscale=\fins@dir]%
}
\def\fins@cclose{\end{scope}\end{scope}\endgroup}

% Object shading: a lighter rim on top, a darker one below.
% \fins@cshade{<path>}{<depth>} fills with body, belly (light) and back.
\def\fins@cshade#1#2{%
  \begin{scope}[overlay]
    \clip #1;
    \fill[fins@c@body] #1;
    \begin{scope}[yshift=-#2cm]
      \fill[fins@c@belly, even odd rule] (-9,-9) rectangle (9,9) #1;
    \end{scope}
    \begin{scope}[yshift=#2cm]
      \fill[black, opacity=0.16, even odd rule] (-9,-9) rectangle (9,9) #1;
    \end{scope}
  \end{scope}
}

% Fluffy edge for moss: a row of small outward bumps of random height.
\pgfdeclaredecoration{fins fluff}{bump}{%
  \state{bump}[width=\pgfdecorationsegmentlength, next state=bump]{%
    \pgfmathsetlengthmacro\fins@bump{-\pgfdecorationsegmentamplitude*(0.35+0.65*rnd)}%
    \pgfpathcurveto
      {\pgfqpoint{0.15\pgfdecorationsegmentlength}{\fins@bump}}%
      {\pgfqpoint{0.85\pgfdecorationsegmentlength}{\fins@bump}}%
      {\pgfqpoint{\pgfdecorationsegmentlength}{0pt}}%
  }%
  \state{final}{\pgfpathlineto{\pgfpointdecoratedpathlast}}%
}
\def\fins@fluffy#1#2{%
  \pgfmathsetseed{\fins@seed}%
  \pgfmathsetlengthmacro\fins@fseg{3pt*\fins@scale}%
  \pgfmathsetlengthmacro\fins@famp{1.4pt*\fins@scale}%
  \path[decorate, decoration={fins fluff, segment length=\fins@fseg,
        amplitude=\fins@famp}, #1] #2;%
}

% A tapered, gently bent branch from (#1,#2) to (#3,#4), half widths
% #5 and #6, bent sideways by #7.  Used for wood, coral and kelp.
\def\fins@taperpath#1#2#3#4#5#6#7{%
  \pgfmathsetmacro\fins@ta{atan2(#4-(#2),#3-(#1))}%
  \pgfmathsetmacro\fins@tnx{-sin(\fins@ta)}%
  \pgfmathsetmacro\fins@tny{cos(\fins@ta)}%
  \pgfmathsetmacro\fins@tcx{(#1+#3)/2+#7*\fins@tnx}%
  \pgfmathsetmacro\fins@tcy{(#2+#4)/2+#7*\fins@tny}%
  \pgfmathsetmacro\fins@tw{(#5+#6)/2}%
  \edef\fins@tpath{(#1+#5*\fins@tnx,#2+#5*\fins@tny)
    .. controls (\fins@tcx+\fins@tw*\fins@tnx,\fins@tcy+\fins@tw*\fins@tny)
    .. (#3+#6*\fins@tnx,#4+#6*\fins@tny)
    arc (\fins@ta+90:\fins@ta-90:#6)
    .. controls (\fins@tcx-\fins@tw*\fins@tnx,\fins@tcy-\fins@tw*\fins@tny)
    .. (#1-#5*\fins@tnx,#2-#5*\fins@tny) -- cycle}%
}

%% ------------------------------------------------------------------
%% Rocks and stones
%% ------------------------------------------------------------------
\def\fins@rock@a{(-0.95,0) .. controls (-1.0,0.35) and (-0.75,0.9) .. (-0.2,1.0)
  .. controls (0.35,1.08) and (0.85,0.75) .. (0.95,0.35) .. controls (1.0,0.15) .. (0.98,0) -- cycle}
\def\fins@rock@b{(-0.8,0) .. controls (-0.9,0.5) and (-0.55,1.25) .. (-0.05,1.4)
  .. controls (0.25,1.48) and (0.5,1.1) .. (0.62,0.75) .. controls (0.75,0.4) and (0.85,0.2) .. (0.82,0) -- cycle}
\def\fins@rock@c{(-1.1,0) .. controls (-1.05,0.25) and (-0.8,0.55) .. (-0.4,0.6)
  .. controls (-0.1,0.66) and (0.2,0.5) .. (0.5,0.55) .. controls (0.85,0.6) and (1.1,0.3) .. (1.1,0) -- cycle}
\newcommand\rock[1][]{%
  \fins@cprepare{%
    \colorlet{fins@c@body}{finsrock}\colorlet{fins@c@belly}{finsrock!55!white}%
    \colorlet{fins@c@outline}{finsrock!45!black}\colorlet{fins@c@accent}{finsmoss}%
  }{#1}%
  \fins@copen
    \ifcase\fins@variant\relax\let\fins@path\fins@rock@a\or\let\fins@path\fins@rock@a
      \or\let\fins@path\fins@rock@b\or\let\fins@path\fins@rock@c\else\let\fins@path\fins@rock@a\fi
    \fins@cshade{\fins@path}{0.14}%
    \begin{scope}[overlay]
      \clip \fins@path;
      \draw[fins@c@outline, opacity=0.35, line width=0.9*\fins@lw, line cap=round]
        (-0.6,0.62) .. controls (-0.3,0.5) and (0.1,0.62) .. (0.45,0.48)
        (-0.75,0.3) .. controls (-0.4,0.24) and (0.0,0.34) .. (0.3,0.22)
        (0.15,0.85) .. controls (0.35,0.78) .. (0.6,0.8);
      \foreach \fins@i in {1,...,14}{%
        \fins@hash{\fins@i}{\fins@seed}\pgfmathsetmacro\fins@px{-0.9+1.8*\fins@h}%
        \fins@hash{\fins@i+20}{\fins@seed}\pgfmathsetmacro\fins@py{1.2*\fins@h}%
        \fill[fins@c@outline, opacity=0.25] (\fins@px,\fins@py) circle (0.018);
      }%
      \iffins@moss
        \fins@fluffy{fill=fins@c@accent}{(-1.2,0.6) .. controls (-0.5,0.95) and (0.2,1.05) .. (1.2,0.75)
          -- (1.2,1.6) -- (-1.2,1.6) -- cycle}%
      \fi
      \fins@shine{(-0.6,0.62) .. controls (-0.45,0.8) and (-0.3,0.86) .. (-0.1,0.9)}%
    \end{scope}
    \path[fins outline] \fins@path;
  \fins@cclose
}
\newcommand\stones[1][]{%
  \fins@cprepare{\def\fins@count{5}\def\fins@width{1.8}}{#1}%
  \fins@copen
    \foreach \fins@i in {1,...,\fins@count}{%
      \fins@hash{\fins@i}{\fins@seed}\pgfmathsetmacro\fins@px{(\fins@h-0.5)*\fins@width}%
      \fins@hash{\fins@i+13}{\fins@seed}\pgfmathsetmacro\fins@pw{0.22+0.2*\fins@h}%
      \fins@hash{\fins@i+29}{\fins@seed}\pgfmathsetmacro\fins@ph{\fins@pw*(0.5+0.25*\fins@h)}%
      \pgfmathtruncatemacro\fins@pc{mod(\fins@i,4)}%
      \colorlet{fins@c@body}{\ifcase\fins@pc finspebbleA\or finspebbleB\or finspebbleC\else finspebbleD\fi}%
      \colorlet{fins@c@belly}{fins@c@body!55!white}%
      \colorlet{fins@c@outline}{fins@c@body!45!black}%
      \def\fins@path{(\fins@px,\fins@ph) ellipse [x radius=\fins@pw, y radius=\fins@ph]}%
      \fins@cshade{\fins@path}{0.04}%
      \path[fins outline] \fins@path;
    }%
  \fins@cclose
}

%% ------------------------------------------------------------------
%% Driftwood
%% ------------------------------------------------------------------
\def\fins@wood#1{% a list of x1/y1/x2/y2/w1/w2/bend
  \foreach \fins@a/\fins@b/\fins@c/\fins@d/\fins@e/\fins@f/\fins@g in {#1}{%
    \fins@taperpath{\fins@a}{\fins@b}{\fins@c}{\fins@d}{\fins@e}{\fins@f}{\fins@g}%
    \fill[fins@c@body] \fins@tpath;
    \begin{scope}[overlay]
      \clip \fins@tpath;
      \draw[fins@c@belly, opacity=0.7, line width=1.4*\fins@lw, line cap=round]
        (\fins@a,\fins@b) .. controls (\fins@tcx,\fins@tcy) .. (\fins@c,\fins@d);
      \begin{scope}[shift={(0,-0.03)}]
      \draw[fins@c@outline, opacity=0.35, line width=0.7*\fins@lw, line cap=round]
        (\fins@a,\fins@b) .. controls (\fins@tcx,\fins@tcy) .. (\fins@c,\fins@d);
      \end{scope}
    \end{scope}
    \path[fins outline] \fins@tpath;
  }%
}
\newcommand\driftwood[1][]{%
  \fins@cprepare{%
    \colorlet{fins@c@body}{finswood}\colorlet{fins@c@belly}{finswood!60!white}%
    \colorlet{fins@c@outline}{finswood!45!black}%
  }{#1}%
  \fins@copen
    \fins@wood{-1.6/0.05/0.4/0.75/0.16/0.12/0.15, 0.3/0.7/1.4/1.8/0.11/0.05/-0.1,
               -0.6/0.32/-0.85/1.5/0.09/0.04/0.18, 0.35/0.72/1.25/0.95/0.07/0.035/0.05,
               -0.75/1.05/-0.25/1.65/0.045/0.025/-0.05}%
    \filldraw[fill=fins@c@body!70!black, draw=fins@c@outline, line width=0.6*\fins@lw]
      (-0.9,0.3) ellipse (0.06 and 0.04);
    \fill[fins@c@body!60!black] (-1.6,0.05) ellipse (0.04 and 0.13);
  \fins@cclose
}

%% ------------------------------------------------------------------
%% Plants
%% ------------------------------------------------------------------
\newcommand\vallisneria[1][]{%
  \fins@cprepare{%
    \def\fins@height{4}\def\fins@count{9}\def\fins@width{0.8}%
    \colorlet{fins@c@body}{finsplant}\colorlet{fins@c@belly}{finsplantlight}%
    \colorlet{fins@c@outline}{finsplant!45!black}%
  }{#1}%
  \fins@copen
    \foreach \fins@i in {1,...,\fins@count}{%
      \fins@hash{\fins@i}{\fins@seed}\pgfmathsetmacro\fins@x{(\fins@h-0.5)*\fins@width}%
      \fins@hash{\fins@i+17}{\fins@seed}\pgfmathsetmacro\fins@bh{\fins@height*(0.55+0.45*\fins@h)}%
      \fins@hash{\fins@i+43}{\fins@seed}\let\fins@hc\fins@h
      \pgfmathsetmacro\fins@lean{\fins@sway/40*\fins@bh+(\fins@hc-0.5)*1.1+\fins@x*0.8}%
      \pgfmathsetmacro\fins@w{0.045+0.03*\fins@hc}%
      \ifodd\fins@i\colorlet{fins@c@leaf}{fins@c@body!82!black}\else\colorlet{fins@c@leaf}{fins@c@body}\fi
      \filldraw[fill=fins@c@leaf, draw=fins@c@outline, line width=0.5*\fins@lw, line join=round]
        (\fins@x-\fins@w,0) .. controls (\fins@x-\fins@w,0.5*\fins@bh)
          and (\fins@x+0.35*\fins@lean-0.7*\fins@w,1.02*\fins@bh) .. (\fins@x+\fins@lean,\fins@bh)
        .. controls (\fins@x+0.35*\fins@lean+0.7*\fins@w,1.02*\fins@bh-2*\fins@w)
          and (\fins@x+\fins@w,0.5*\fins@bh) .. (\fins@x+\fins@w,0) -- cycle;
      \draw[fins@c@belly, opacity=0.8, line width=0.7*\fins@lw]
        (\fins@x,0) .. controls (\fins@x,0.5*\fins@bh)
          and (\fins@x+0.35*\fins@lean,1.0*\fins@bh-\fins@w) .. (\fins@x+0.92*\fins@lean,0.97*\fins@bh);
    }%
  \fins@cclose
}
\newcommand\amazonsword[1][]{%
  \fins@cprepare{%
    \def\fins@height{2.2}\def\fins@count{9}%
    \colorlet{fins@c@body}{finsplant}\colorlet{fins@c@belly}{finsplantlight}%
    \colorlet{fins@c@outline}{finsplant!45!black}%
  }{#1}%
  \fins@copen
    \pgfmathsetmacro\fins@n{\fins@count-1}%
    \foreach \fins@i [evaluate=\fins@i as \fins@t using {mod(\fins@i,2)==0 ? \fins@i/2 : \fins@n-(\fins@i-1)/2}]
        in {0,...,\fins@n}{%
      \pgfmathsetmacro\fins@ang{-62+124*\fins@t/\fins@n+\fins@sway*0.5}%
      \fins@hash{\fins@t}{\fins@seed}%
      \pgfmathsetmacro\fins@L{\fins@height*(0.55+0.3*\fins@h)*(0.75+0.25*cos(\fins@ang))}%
      \begin{scope}[rotate=\fins@ang]
        \fins@tube{(0,0) -- (0,0.32*\fins@L)}{fins@c@body!80!black}{fins@c@outline}{0.035}%
        \def\fins@path{(0,0.28*\fins@L) .. controls (0.17*\fins@L,0.4*\fins@L) and (0.15*\fins@L,0.78*\fins@L)
          .. (0,\fins@L) .. controls (-0.15*\fins@L,0.78*\fins@L) and (-0.17*\fins@L,0.4*\fins@L)
          .. (0,0.28*\fins@L) -- cycle}%
        \fill[fins@c@body] \fins@path;
        \begin{scope}[overlay]
          \clip \fins@path;
          \fill[fins@c@body!78!black] (0,0) rectangle (1,2*\fins@L);
          \foreach \fins@v in {0.42,0.58,0.74}{%
            \draw[fins@c@belly, opacity=0.75, line width=0.6*\fins@lw]
              (0,\fins@v*\fins@L) .. controls (0.06*\fins@L,\fins@v*\fins@L+0.04*\fins@L) .. (0.15*\fins@L,\fins@v*\fins@L+0.1*\fins@L)
              (0,\fins@v*\fins@L) .. controls (-0.06*\fins@L,\fins@v*\fins@L+0.04*\fins@L) .. (-0.15*\fins@L,\fins@v*\fins@L+0.1*\fins@L);
          }%
        \end{scope}
        \draw[fins@c@belly, line width=0.9*\fins@lw] (0,0.3*\fins@L) -- (0,0.97*\fins@L);
        \path[fins outline] \fins@path;
      \end{scope}
    }%
  \fins@cclose
}
\newcommand\cabomba[1][]{%
  \fins@cprepare{%
    \def\fins@height{3}\def\fins@count{4}\def\fins@width{0.6}%
    \colorlet{fins@c@body}{finscabomba}\colorlet{fins@c@outline}{finscabomba!45!black}%
  }{#1}%
  \fins@copen
    \foreach \fins@i in {1,...,\fins@count}{%
      \fins@hash{\fins@i}{\fins@seed}\pgfmathsetmacro\fins@x{(\fins@h-0.5)*\fins@width}%
      \fins@hash{\fins@i+11}{\fins@seed}\pgfmathsetmacro\fins@bh{\fins@height*(0.65+0.35*\fins@h)}%
      \pgfmathsetmacro\fins@lean{\fins@sway/40*\fins@bh+\fins@x*0.5}%
      \ifodd\fins@i\colorlet{fins@c@leaf}{fins@c@body!78!black}\else\colorlet{fins@c@leaf}{fins@c@body}\fi
      \draw[fins@c@leaf!80!black, line width=1.1*\fins@lw]
        (\fins@x,0) .. controls (\fins@x,0.5*\fins@bh) .. (\fins@x+\fins@lean,\fins@bh);
      % all the leaf whorls of a stem go into one path
      \pgfmathtruncatemacro\fins@nodes{\fins@bh/0.16}%
      \gdef\fins@leaflist{}%
      \foreach \fins@k in {1,...,\fins@nodes}{%
        \pgfmathsetmacro\fins@t{\fins@k/\fins@nodes}%
        \pgfmathsetmacro\fins@nx{\fins@x+\fins@lean*\fins@t*\fins@t}%
        \pgfmathsetmacro\fins@ny{\fins@bh*\fins@t}%
        \pgfmathsetmacro\fins@r{0.26*(1-0.55*\fins@t)}%
        \pgfmathsetmacro\fins@rA{0.55*\fins@r}\pgfmathsetmacro\fins@rB{0.38*\fins@r}%
        \foreach \fins@a in {15,45,75,105,135,165}{%
          \edef\fins@ap{\the\numexpr\fins@a+28\relax}\edef\fins@am{\the\numexpr\fins@a-28\relax}%
          \xdef\fins@leaflist{\fins@leaflist
            (\fins@nx,\fins@ny) -- ++(\fins@a:\fins@r)
            (\fins@nx,\fins@ny) ++(\fins@a:\fins@rA) -- ++(\fins@ap:\fins@rB)
            (\fins@nx,\fins@ny) ++(\fins@a:\fins@rA) -- ++(\fins@am:\fins@rB)}%
        }%
      }%
      \draw[fins@c@leaf, line width=0.6*\fins@lw, line cap=round] \fins@leaflist;
    }%
  \fins@cclose
}
\newcommand\ludwigia[1][]{%
  \fins@cprepare{%
    \def\fins@height{2.6}\def\fins@count{4}\def\fins@width{0.6}%
    \colorlet{fins@c@body}{finsplant}\colorlet{fins@c@accent}{finsludwigia}%
    \colorlet{fins@c@outline}{finsplant!40!black}%
  }{#1}%
  \fins@copen
    \foreach \fins@i in {1,...,\fins@count}{%
      \fins@hash{\fins@i}{\fins@seed}\pgfmathsetmacro\fins@x{(\fins@h-0.5)*\fins@width}%
      \fins@hash{\fins@i+11}{\fins@seed}\pgfmathsetmacro\fins@bh{\fins@height*(0.65+0.35*\fins@h)}%
      \pgfmathsetmacro\fins@lean{\fins@sway/40*\fins@bh+\fins@x*0.4}%
      \draw[fins@c@accent!60!fins@c@body!70!black, line width=1.3*\fins@lw]
        (\fins@x,0) .. controls (\fins@x,0.5*\fins@bh) .. (\fins@x+\fins@lean,\fins@bh);
      % leaves are sorted into five colour bands, one path each
      \pgfmathtruncatemacro\fins@nodes{\fins@bh/0.2}%
      \foreach \fins@b in {0,...,4}{\expandafter\gdef\csname fins@lb\fins@b\endcsname{}}%
      \foreach \fins@k in {1,...,\fins@nodes}{%
        \pgfmathsetmacro\fins@t{\fins@k/\fins@nodes}%
        \pgfmathsetmacro\fins@nx{\fins@x+\fins@lean*\fins@t*\fins@t}%
        \pgfmathsetmacro\fins@ny{\fins@bh*\fins@t}%
        \pgfmathtruncatemacro\fins@band{min(4,5*\fins@t*\fins@t)}%
        \pgfmathsetmacro\fins@r{0.17*(1-0.35*\fins@t)}%
        \pgfmathsetmacro\fins@ra{0.516*\fins@r}\pgfmathsetmacro\fins@rb{0.602*\fins@r}%
        \pgfmathsetmacro\fins@rl{1.3*\fins@r}%
        \ifodd\fins@k\def\fins@tilt{10}\else\def\fins@tilt{-10}\fi
        \foreach \fins@a in {35,145}{%
          \edef\fins@p{\the\numexpr\fins@a+\fins@tilt\relax}%
          \expandafter\xdef\csname fins@lb\fins@band\endcsname{%
            \csname fins@lb\fins@band\endcsname
            (\fins@nx,\fins@ny) .. controls +(\the\numexpr\fins@p+54\relax:\fins@ra)
              and +(\the\numexpr\fins@p+138\relax:\fins@rb) .. ++(\fins@p:\fins@rl)
            .. controls +(\the\numexpr\fins@p+222\relax:\fins@rb)
              and +(\the\numexpr\fins@p-54\relax:\fins@ra) .. (\fins@nx,\fins@ny) -- cycle}%
        }%
      }%
      \foreach \fins@b/\fins@m in {0/10,1/30,2/50,3/70,4/90}{%
        \colorlet{fins@c@leaf}{fins@c@accent!\fins@m!fins@c@body}%
        \filldraw[fill=fins@c@leaf, draw=fins@c@leaf!55!black, line width=0.45*\fins@lw]
          \csname fins@lb\fins@b\endcsname;
      }%
    }%
  \fins@cclose
}
\newcommand\javafern[1][]{%
  \fins@cprepare{%
    \def\fins@height{1.8}\def\fins@count{7}%
    \colorlet{fins@c@body}{finsfern}\colorlet{fins@c@belly}{finsfern!60!white}%
    \colorlet{fins@c@outline}{finsfern!45!black}%
  }{#1}%
  \fins@copen
    \pgfmathsetmacro\fins@n{\fins@count-1}%
    \foreach \fins@i [evaluate=\fins@i as \fins@t using {mod(\fins@i,2)==0 ? \fins@i/2 : \fins@n-(\fins@i-1)/2}]
        in {0,...,\fins@n}{%
      \pgfmathsetmacro\fins@ang{-55+110*\fins@t/\fins@n+\fins@sway*0.5}%
      \fins@hash{\fins@t}{\fins@seed}%
      \pgfmathsetmacro\fins@L{\fins@height*(0.65+0.35*\fins@h)}%
      \pgfmathsetmacro\fins@k{-\fins@ang/90*0.5*\fins@L}%
      \begin{scope}[rotate=\fins@ang]
        \def\fins@path{(0,0) .. controls (0.11*\fins@L,0.3*\fins@L) and (0.1*\fins@L-0.3*\fins@k,0.75*\fins@L)
          .. (-\fins@k,\fins@L) .. controls (-0.1*\fins@L-0.3*\fins@k,0.72*\fins@L) and (-0.07*\fins@L,0.3*\fins@L)
          .. (0,0) -- cycle}%
        \fill[fins@c@body] \fins@path;
        \begin{scope}[overlay]
          \clip \fins@path;
          \fill[fins@c@body!75!black] (0,0) .. controls (0,0.5*\fins@L) .. (-\fins@k,\fins@L) -- (2,2) -- (2,0) -- cycle;
          \foreach \fins@v in {0.2,0.32,...,0.9}{%
            \draw[fins@c@belly, opacity=0.5, line width=0.5*\fins@lw]
              (-\fins@k*\fins@v*\fins@v,\fins@v*\fins@L) -- ++(70:0.12*\fins@L)
              (-\fins@k*\fins@v*\fins@v,\fins@v*\fins@L) -- ++(110:0.12*\fins@L);
          }%
        \end{scope}
        \draw[fins@c@belly, line width=0.8*\fins@lw] (0,0) .. controls (0,0.5*\fins@L) .. (-0.97*\fins@k,0.97*\fins@L);
        \path[fins outline] \fins@path;
      \end{scope}
    }%
    \fins@tube{(-0.32,0.02) .. controls (0,0.06) .. (0.32,0.0)}{finswood}{finswood!45!black}{0.07}%
    \foreach \fins@x in {-0.25,-0.1,0.08,0.22}{%
      \draw[finswood!50!black, line width=0.5*\fins@lw] (\fins@x,0) -- ++(-100:0.12);
    }%
  \fins@cclose
}
\newcommand\kelp[1][]{%
  \fins@cprepare{%
    \def\fins@height{5}%
    \colorlet{fins@c@body}{finskelp}\colorlet{fins@c@belly}{finskelplight}%
    \colorlet{fins@c@outline}{finskelp!40!black}%
  }{#1}%
  \fins@copen
    \pgfmathsetmacro\fins@lean{\fins@sway/40*\fins@height}%
    \def\fins@stipe{(0,0) .. controls (0.25,0.35*\fins@height) and (-0.25+0.3*\fins@lean,0.7*\fins@height) .. (\fins@lean,\fins@height)}%
    \pgfmathsetmacro\fins@nodes{int(\fins@height/0.42)}%
    \foreach \fins@k in {1,...,\fins@nodes}{%
      \pgfmathsetmacro\fins@t{(\fins@k-0.3)/\fins@nodes}%
      \pgfmathsetmacro\fins@nx{3*(1-\fins@t)^2*\fins@t*0.25+3*(1-\fins@t)*\fins@t^2*(-0.25+0.3*\fins@lean)+\fins@t^3*\fins@lean}%
      \pgfmathsetmacro\fins@ny{\fins@height*\fins@t}%
      \pgfmathsetmacro\fins@side{mod(\fins@k,2)==0 ? 1 : -1}%
      \pgfmathsetmacro\fins@L{0.75*(1-0.4*\fins@t)}%
      \begin{scope}[shift={(\fins@nx,\fins@ny)}, xscale=\fins@side, rotate=-35-\fins@side*\fins@sway*0.3]
        \def\fins@path{(0,0) .. controls (0.1,0.12) and (0.25*\fins@L,0.2) .. (0.5*\fins@L,0.15)
          .. controls (0.62*\fins@L,0.2) and (0.8*\fins@L,0.12) .. (\fins@L,0.05)
          .. controls (0.8*\fins@L,0.0) and (0.62*\fins@L,-0.05) .. (0.5*\fins@L,-0.02)
          .. controls (0.25*\fins@L,-0.06) and (0.1,-0.02) .. (0,0) -- cycle}%
        \filldraw[fill=fins@c@belly, draw=fins@c@outline, line width=0.5*\fins@lw] \fins@path;
        \draw[fins@c@body, line width=0.6*\fins@lw] (0.05,0.02) .. controls (0.5*\fins@L,0.07) .. (0.95*\fins@L,0.05);
        \filldraw[fill=fins@c@body, draw=fins@c@outline, line width=0.5*\fins@lw] (0.03,0.0) circle (0.05);
      \end{scope}
    }%
    \draw[fins@c@outline, line width=2.6*\fins@lw+1.4*\fins@lw, line cap=round] \fins@stipe;
    \draw[fins@c@body, line width=2.6*\fins@lw, line cap=round] \fins@stipe;
  \fins@cclose
}
\newcommand\mossball[1][]{%
  \fins@cprepare{%
    \def\fins@radius{0.45}%
    \colorlet{fins@c@body}{finsmoss}\colorlet{fins@c@belly}{finsmosslight}%
    \colorlet{fins@c@outline}{finsmoss!45!black}%
  }{#1}%
  \fins@copen
    \def\fins@path{(0,\fins@radius) circle (\fins@radius)}%
    \begin{scope}
      \fins@fluffy{clip}{\fins@path}%
      \fill[fins@c@body] (0,\fins@radius) circle (1.2*\fins@radius);
      \fill[fins@c@belly] (-0.12*\fins@radius,1.15*\fins@radius) circle (0.75*\fins@radius);
      \foreach \fins@i in {1,...,40}{%
        \fins@hash{\fins@i}{\fins@seed}\pgfmathsetmacro\fins@a{360*\fins@h}%
        \fins@hash{\fins@i+60}{\fins@seed}\pgfmathsetmacro\fins@r{\fins@radius*sqrt(\fins@h)}%
        \draw[fins@c@outline, opacity=0.35, line width=0.6*\fins@lw, line cap=round]
          ($(0,\fins@radius)+(\fins@a:\fins@r)$) -- ++(\fins@a+60:0.05);
      }%
    \end{scope}
    \fins@fluffy{fins outline}{\fins@path}%
    \def\fins@tmp{none}%
    \ifx\fins@face\fins@tmp\else
      \begin{scope}[shift={(0,0.95*\fins@radius)}, scale=\fins@radius/0.45]
        \fill[finspupil] (-0.13,0.04) circle (0.04) (0.13,0.04) circle (0.04);
        \fill[white] (-0.12,0.055) circle (0.013) (0.14,0.055) circle (0.013);
        \fill[finsheart!50!white, opacity=0.6] (-0.24,-0.04) ellipse (0.06 and 0.035) (0.24,-0.04) ellipse (0.06 and 0.035);
        \def\fins@tmp{sleepy}%
        \ifx\fins@face\fins@tmp
          \fill[fins@c@body] (-0.2,0.04) rectangle (0.2,0.1);
          \draw[fins face] (-0.17,0.04) -- (-0.09,0.04) (0.09,0.04) -- (0.17,0.04);
          \draw[fins face] (-0.03,-0.07) circle (0.02);
        \else
          \draw[fins face] (-0.05,-0.04) arc (180:360:0.025) arc (180:360:0.025);
        \fi
      \end{scope}
    \fi
  \fins@cclose
}

%% ------------------------------------------------------------------
%% Reef
%% ------------------------------------------------------------------
\newcommand\anemone[1][]{%
  \fins@cprepare{%
    \def\fins@height{1.2}\def\fins@count{22}%
    \colorlet{fins@c@body}{finsanemone}\colorlet{fins@c@belly}{finsanemonetentacle}%
    \colorlet{fins@c@accent}{finsanemonetip}\colorlet{fins@c@outline}{finsanemone!45!black}%
  }{#1}%
  \fins@copen
    \foreach \fins@pass in {0,1}{%
      \foreach \fins@i in {1,...,\fins@count}{%
        \pgfmathtruncatemacro\fins@odd{mod(\fins@i,2)}%
        \ifnum\fins@odd=\fins@pass
          \fins@hash{\fins@i}{\fins@seed}\let\fins@ha\fins@h
          \fins@hash{\fins@i+33}{\fins@seed}\let\fins@hb\fins@h
          \pgfmathsetmacro\fins@u{(\fins@i-0.5)/\fins@count}%
          \pgfmathsetmacro\fins@bx{-0.42+0.84*\fins@u}%
          \pgfmathsetmacro\fins@ang{90+75-150*\fins@u+(\fins@ha-0.5)*20}%
          \pgfmathsetmacro\fins@L{\fins@height*(0.6+0.35*\fins@hb)*(0.65+0.35*sin(\fins@ang))}%
          \pgfmathsetmacro\fins@tip{\fins@ang-\fins@sway-15*(\fins@ha-0.5)}%
          \ifnum\fins@pass=0 \colorlet{fins@c@leaf}{fins@c@belly!80!black}\else\colorlet{fins@c@leaf}{fins@c@belly}\fi
          \fins@tube{(\fins@bx,0.42) .. controls ($(\fins@bx,0.42)+(\fins@ang:0.5*\fins@L)$)
            and ($(\fins@bx,0.42)+(\fins@ang:0.75*\fins@L)+(\fins@tip:0.1)$) .. ($(\fins@bx,0.42)+(\fins@ang:0.8*\fins@L)+(\fins@tip:0.25*\fins@L)$)}%
            {fins@c@leaf}{fins@c@outline}{0.075}%
          \filldraw[fill=fins@c@accent, draw=fins@c@outline, line width=0.5*\fins@lw]
            ($(\fins@bx,0.42)+(\fins@ang:0.8*\fins@L)+(\fins@tip:0.25*\fins@L)$) circle (0.058);
        \fi
      }%
      \ifnum\fins@pass=0
        \def\fins@path{(-0.4,0) .. controls (-0.38,0.2) and (-0.48,0.35) .. (-0.46,0.44)
          .. controls (-0.2,0.52) and (0.2,0.52) .. (0.46,0.44)
          .. controls (0.48,0.35) and (0.38,0.2) .. (0.4,0) -- cycle}%
        \fins@cshade{\fins@path}{0.06}%
        \path[fins outline] \fins@path;
        \filldraw[fill=fins@c@body!70!white, draw=fins@c@outline, line width=0.6*\fins@lw] (0,0.46) ellipse (0.36 and 0.06);
      \fi
    }%
  \fins@cclose
}
\newcommand\braincoral[1][]{%
  \fins@cprepare{%
    \colorlet{fins@c@body}{finsbrain}\colorlet{fins@c@belly}{finsbrain!55!white}%
    \colorlet{fins@c@outline}{finsbrain!40!black}%
  }{#1}%
  \fins@copen
    \def\fins@path{(-1.0,0) .. controls (-1.02,0.55) and (-0.6,0.88) .. (0,0.88)
      .. controls (0.6,0.88) and (1.02,0.55) .. (1.0,0) -- cycle}%
    \fins@cshade{\fins@path}{0.1}%
    \begin{scope}[overlay]
      \clip \fins@path;
      \pgfmathsetlengthmacro\fins@sa{1.3pt*\fins@scale}%
      \pgfmathsetlengthmacro\fins@sl{6pt*\fins@scale}%
      \foreach \fins@r [count=\fins@k] in {0.25,0.4,...,1.1}{%
        \draw[fins@c@outline, opacity=0.55, line width=1.1*\fins@lw, line cap=round,
              decorate, decoration={snake, amplitude=\fins@sa, segment length=\fins@sl}]
          (\fins@r,0) arc (0:180:{\fins@r} and {0.82*\fins@r});
        \draw[white, opacity=0.35, line width=0.8*\fins@lw, line cap=round,
              decorate, decoration={snake, amplitude=\fins@sa, segment length=\fins@sl}]
          (\fins@r+0.06,0) arc (0:180:{\fins@r+0.06} and {0.82*\fins@r+0.05});
      }%
    \end{scope}
    \path[fins outline] \fins@path;
  \fins@cclose
}
% \fins@branch{x}{y}{angle}{length}{half width}{depth}{pass}
\def\fins@branch#1#2#3#4#5#6#7{%
  \begingroup
  \pgfmathsetmacro\fins@bx{#1+#4*cos(#3)}%
  \pgfmathsetmacro\fins@by{#2+#4*sin(#3)}%
  \pgfmathsetlengthmacro\fins@bw{2*#5*28.45274pt*\fins@scale}%
  \ifcase#7
    \draw[fins@c@outline, line width=\fins@bw+1.5*\fins@lw, line cap=round] (#1,#2) -- (\fins@bx,\fins@by);
  \or
    \draw[fins@c@body, line width=\fins@bw, line cap=round] (#1,#2) -- (\fins@bx,\fins@by);
  \or
    \ifnum#6=0 \fill[fins@c@accent] (\fins@bx,\fins@by) circle (0.9*#5);\fi
  \fi
  \ifnum#6>0
    \pgfmathtruncatemacro\fins@ai{#3+200}%
    \fins@hash{#6*7+\fins@seed}{\fins@ai}%
    \pgfmathsetmacro\fins@da{18+18*\fins@h}%
    \pgfmathsetmacro\fins@aL{#3+\fins@da}\pgfmathsetmacro\fins@aR{#3-\fins@da+6}%
    \pgfmathsetmacro\fins@nl{#4*0.74}\pgfmathsetmacro\fins@nw{#5*0.8}%
    \pgfmathtruncatemacro\fins@nd{#6-1}%
    \edef\fins@next{%
      \noexpand\fins@branch{\fins@bx}{\fins@by}{\fins@aL}{\fins@nl}{\fins@nw}{\fins@nd}{#7}%
      \noexpand\fins@branch{\fins@bx}{\fins@by}{\fins@aR}{\fins@nl}{\fins@nw}{\fins@nd}{#7}}%
    \fins@next
  \fi
  \endgroup
}
\newcommand\staghorn[1][]{%
  \fins@cprepare{%
    \def\fins@height{1}\def\fins@count{3}%
    \colorlet{fins@c@body}{finsstaghorn}\colorlet{fins@c@accent}{finsstaghorntip}%
    \colorlet{fins@c@outline}{finsstaghorn!45!black}%
  }{#1}%
  \fins@copen
    \foreach \fins@pass in {0,1,2}{%
      \fins@branch{-0.25}{0}{112}{0.55*\fins@height}{0.1}{\fins@count}{\fins@pass}%
      \fins@branch{0.05}{0}{84}{0.62*\fins@height}{0.11}{\fins@count}{\fins@pass}%
      \fins@branch{0.3}{0}{62}{0.5*\fins@height}{0.095}{\fins@count}{\fins@pass}%
    }%
  \fins@cclose
}
\newcommand\seashell[1][]{%
  \fins@cprepare{%
    \colorlet{fins@c@body}{finsshell}\colorlet{fins@c@belly}{white}%
    \colorlet{fins@c@pattern}{finsshellrib}\colorlet{fins@c@outline}{finsshellrib!45!black}%
  }{#1}%
  \fins@copen
    \filldraw[fill=fins@c@body!90!black, draw=fins@c@outline, line width=0.6*\fins@lw]
      (-0.05,0.02) -- (-0.26,0.06) -- (-0.22,0.2) -- (-0.03,0.16) -- cycle
      (0.05,0.02) -- (0.26,0.06) -- (0.22,0.2) -- (0.03,0.16) -- cycle;
    \def\fins@path{(0,0.02) -- ($(0,0.02)+(155:0.62)$) arc (155:25:0.62) -- cycle}%
    \fins@cshade{\fins@path}{0.06}%
    \begin{scope}[overlay]
      \clip \fins@path;
      \foreach \fins@a in {35,50,...,150}{%
        \fill[fins@c@pattern, opacity=0.8] (0,0.02) -- ($(0,0.02)+(\fins@a-3.5:0.7)$) -- ($(0,0.02)+(\fins@a+3.5:0.7)$) -- cycle;
      }%
      \foreach \fins@r in {0.25,0.4,0.52}{%
        \draw[fins@c@outline, opacity=0.25, line width=0.5*\fins@lw] (0,0.02) circle (\fins@r);
      }%
    \end{scope}
    \foreach \fins@a in {32,47,...,152}{%
      \filldraw[fill=fins@c@body, draw=fins@c@outline, line width=0.6*\fins@lw]
        ($(0,0.02)+(\fins@a:0.62)$) circle (0.05);
    }%
    \path[fins outline] \fins@path;
  \fins@cclose
}

%% ------------------------------------------------------------------
%% Ornaments
%% ------------------------------------------------------------------
\def\fins@bubblecolumn#1#2#3{% x, bottom y, height
  \pgfmathtruncatemacro\fins@nb{max(2,#3*3.6)}%
  \foreach \fins@i in {1,...,\fins@nb}{%
    \pgfmathsetmacro\fins@t{\fins@i/\fins@nb}%
    \fins@hash{\fins@i}{\fins@seed}%
    \pgfmathsetmacro\fins@bx{#1+(\fins@h-0.5)*0.16*(1+\fins@t)+0.05*sin(\fins@i*130)}%
    \pgfmathsetmacro\fins@by{#2+#3*\fins@t}%
    \fins@hash{\fins@i+50}{\fins@seed}%
    \pgfmathsetmacro\fins@br{(0.045+0.075*\fins@t)*(0.7+0.6*\fins@h)}%
    \fins@bubble{\fins@bx}{\fins@by}{\fins@br}%
  }%
}
\newcommand\bubbles[1][]{%
  \fins@cprepare{\def\fins@height{3}}{#1}%
  \fins@copen
    \fins@bubblecolumn{0}{0}{\fins@height}%
  \fins@cclose
}
\newcommand\airstone[1][]{%
  \fins@cprepare{%
    \def\fins@height{3}%
    \colorlet{fins@c@body}{finsrock!80!white}\colorlet{fins@c@belly}{white}%
    \colorlet{fins@c@outline}{finsrock!40!black}%
  }{#1}%
  \fins@copen
    \fins@tube{(0.12,0.1) .. controls (0.4,0.12) and (0.5,0.0) .. (0.9,0.02)}{finsbubble!60!finsrock}{finsrock!50!black}{0.04}%
    \def\fins@path{(-0.18,0) -- (-0.18,0.16) arc (180:0:0.18 and 0.05) -- (0.18,0) arc (0:-180:0.18 and 0.05) -- cycle}%
    \fins@cshade{\fins@path}{0.03}%
    \path[fins outline] \fins@path;
    \draw[fins@c@outline, line width=0.6*\fins@lw] (-0.18,0.16) arc (180:360:0.18 and 0.05);
    \foreach \fins@i in {1,...,8}{\fins@hash{\fins@i}{4}%
      \fill[fins@c@outline, opacity=0.35] (-0.15+0.3*\fins@h,0.04+0.1*\fins@h) circle (0.012);}%
    \fins@bubblecolumn{0}{0.28}{\fins@height}%
  \fins@cclose
}
\newcommand\treasurechest[1][]{%
  \fins@cprepare{%
    \colorlet{fins@c@body}{finschest}\colorlet{fins@c@belly}{finschest!60!white}%
    \colorlet{fins@c@outline}{finschest!40!black}\colorlet{fins@c@accent}{finsstar}%
    \colorlet{fins@c@pattern}{finsiron}%
  }{#1}%
  \fins@copen
    \iffins@open
      % the open lid, seen from inside
      \filldraw[fill=fins@c@body!55!black, draw=fins@c@outline, line width=\fins@lw, line join=round]
        (-0.7,0.62) -- (-0.6,1.22) .. controls (-0.2,1.3) and (0.2,1.3) .. (0.6,1.22) -- (0.7,0.62) -- cycle;
      \draw[fins@c@pattern, line width=2.2*\fins@lw] (-0.45,0.62) -- (-0.39,1.25) (0.45,0.62) -- (0.39,1.25);
      % gold
      \def\fins@path{(-0.66,0.6) .. controls (-0.55,0.82) and (-0.3,0.88) .. (-0.05,0.86)
        .. controls (0.2,0.92) and (0.5,0.85) .. (0.66,0.6) -- cycle}%
      \filldraw[fill=fins@c@accent, draw=fins@c@accent!50!black, line width=0.6*\fins@lw] \fins@path;
      \begin{scope}[overlay]
        \clip \fins@path;
        \foreach \fins@i in {1,...,26}{%
          \fins@hash{\fins@i}{\fins@seed}\pgfmathsetmacro\fins@px{-0.62+1.24*\fins@h}%
          \fins@hash{\fins@i+40}{\fins@seed}\pgfmathsetmacro\fins@py{0.6+0.28*\fins@h}%
          \filldraw[fill=fins@c@accent!85!white, draw=fins@c@accent!45!black, line width=0.45*\fins@lw]
            (\fins@px,\fins@py) ellipse (0.075 and 0.045);
        }%
      \end{scope}
      \foreach \fins@x/\fins@y/\fins@c in {-0.28/0.8/finsgem, 0.18/0.83/finsparty, 0.42/0.72/finsplant}{%
        \filldraw[fill=\fins@c, draw=\fins@c!45!black, line width=0.5*\fins@lw, line join=round]
          (\fins@x-0.06,\fins@y) -- (\fins@x,\fins@y+0.06) -- (\fins@x+0.06,\fins@y) -- (\fins@x,\fins@y-0.07) -- cycle;
        \fill[white, opacity=0.7] (\fins@x-0.02,\fins@y+0.015) circle (0.012);
      }%
      \filldraw[fill=white, draw=finsiron, line width=0.5*\fins@lw] (-0.5,0.66) .. controls (-0.52,0.9) and (-0.47,1.0) .. (-0.44,1.05)
        -- (-0.4,1.05) .. controls (-0.43,0.95) and (-0.44,0.85) .. (-0.42,0.66) -- cycle;
    \fi
    % the box
    \def\fins@path{(-0.7,0) rectangle (0.7,0.62)}%
    \fins@cshade{\fins@path}{0.05}%
    \begin{scope}[overlay]
      \clip \fins@path;
      \draw[fins@c@outline, opacity=0.45, line width=0.7*\fins@lw] (-0.7,0.21) -- (0.7,0.21) (-0.7,0.42) -- (0.7,0.42);
    \end{scope}
    \path[fins outline] \fins@path;
    \iffins@open\else
      \def\fins@path{(-0.72,0.6) -- (-0.72,0.78) .. controls (-0.7,1.02) and (0.7,1.02) .. (0.72,0.78) -- (0.72,0.6) -- cycle}%
      \fins@cshade{\fins@path}{0.05}%
      \path[fins outline] \fins@path;
      \draw[fins@c@pattern, line width=2.4*\fins@lw] (-0.45,0.6) -- (-0.45,0.95) (0.45,0.6) -- (0.45,0.95);
    \fi
    \foreach \fins@x in {-0.45,0.45}{%
      \filldraw[fill=fins@c@pattern, draw=fins@c@pattern!50!black, line width=0.5*\fins@lw]
        (\fins@x-0.06,0) rectangle (\fins@x+0.06,0.64);
      \fill[fins@c@pattern!50!white] (\fins@x,0.12) circle (0.018) (\fins@x,0.5) circle (0.018);
    }%
    \filldraw[fill=fins@c@accent, draw=fins@c@accent!45!black, line width=0.6*\fins@lw, rounded corners=1pt]
      (-0.1,0.38) rectangle (0.1,0.62);
    \fill[fins@c@accent!40!black] (0,0.48) circle (0.025) (-0.01,0.48) -- (0.01,0.48) -- (0.015,0.42) -- (-0.015,0.42) -- cycle;
    \ifnum\fins@bubbles>0
      \pgfmathsetmacro\fins@bh{0.6*\fins@bubbles}%
      \fins@bubblecolumn{0.1}{1.0}{\fins@bh}%
    \fi
  \fins@cclose
}
\newcommand\castle[1][]{%
  \fins@cprepare{%
    \colorlet{fins@c@body}{finscastle}\colorlet{fins@c@belly}{finscastle!55!white}%
    \colorlet{fins@c@outline}{finscastle!40!black}\colorlet{fins@c@accent}{finsheart}%
  }{#1}%
  \fins@copen
    \def\fins@block##1##2##3##4{% x1 x2 top, merlons
      \def\fins@path{(##1,0) -- (##1,##3)
        \foreach \fins@m in {0,...,##4}{
          -- ++(0,0.14) -- ++({(##2-(##1))/(2*##4+1)},0) -- ++(0,-0.14) -- ++({(##2-(##1))/(2*##4+1)},0)}
        -- (##2,##3+0.14) -- (##2,0) -- cycle}%
      \fins@cshade{\fins@path}{0.06}%
      \begin{scope}[overlay]
        \clip \fins@path;
        \draw[fins@c@outline, opacity=0.3, line width=0.5*\fins@lw]
          \foreach \fins@y in {0.18,0.36,...,2.2}{ (-2,\fins@y) -- (2,\fins@y) }
          \foreach \fins@y in {0.18,0.54,...,2.2}{
            \foreach \fins@x in {-1.3,-1.04,...,1.3}{ (\fins@x,\fins@y) -- ++(0,-0.18) }}
          \foreach \fins@y in {0.36,0.72,...,2.2}{
            \foreach \fins@x in {-1.17,-0.91,...,1.3}{ (\fins@x,\fins@y) -- ++(0,-0.18) }};
      \end{scope}
      \path[fins outline] \fins@path;
    }%
    \fins@block{-0.5}{0.5}{1.02}{2}%
    \fins@block{-1.0}{-0.45}{1.45}{1}%
    \fins@block{0.45}{1.0}{1.3}{1}%
    % flag
    \draw[fins@c@outline, line width=0.9*\fins@lw] (-0.72,1.59) -- (-0.72,2.05);
    \filldraw[fill=fins@c@accent, draw=fins@c@accent!45!black, line width=0.5*\fins@lw]
      (-0.72,2.05) .. controls (-0.6,2.0) and (-0.5,2.04) .. (-0.38,1.96) .. controls (-0.5,1.92) and (-0.6,1.86) .. (-0.72,1.88) -- cycle;
    % door and windows
    \filldraw[fill=finspupil!85!fins@c@body, draw=fins@c@outline, line width=0.8*\fins@lw]
      (-0.22,0) -- (-0.22,0.4) arc (180:0:0.22) -- (0.22,0) -- cycle;
    \foreach \fins@x/\fins@y in {-0.72/1.0, 0.72/0.86, -0.72/0.5, 0.0/0.82}{%
      \filldraw[fill=finspupil!85!fins@c@body, draw=fins@c@outline, line width=0.6*\fins@lw]
        (\fins@x-0.07,\fins@y-0.12) -- (\fins@x-0.07,\fins@y) arc (180:0:0.07) -- (\fins@x+0.07,\fins@y-0.12) -- cycle;
    }%
    \fins@fluffy{fill=finsmoss!80!fins@c@body, opacity=0.8}{(-1.0,0) -- (-1.0,0.2) .. controls (-0.8,0.32) and (-0.6,0.18) .. (-0.45,0.1) -- (-0.45,0) -- cycle}%
    \fins@fluffy{fill=finsmoss!80!fins@c@body, opacity=0.8}{(0.45,0) -- (0.45,0.12) .. controls (0.65,0.26) and (0.85,0.16) .. (1.0,0.24) -- (1.0,0) -- cycle}%
  \fins@cclose
}

%% ==================================================================
%% Environments: an aquarium and a fish bowl
%% ==================================================================
\newenvironment{aquarium}[1][]{%
  \begingroup
  \def\fins@width{14}\def\fins@height{8}%
  \pgfkeys{/fins/.cd,#1}%
  \fins@setwidths
  \pgfmathsetmacro\fins@W{\fins@width}%
  \pgfmathsetmacro\fins@H{\fins@height}%
  \pgfmathsetmacro\fins@WL{\fins@level*\fins@H}%
  \expandafter\fins@openscope\expandafter{\fins@at}%
  % air above the water, then the water
  \fill[finsair] (0,0) rectangle (\fins@W,\fins@H);
  \shade[top color=finswatertop!50!fins@c@water, bottom color=fins@c@water!85!black]
    (0,0) rectangle (\fins@W,\fins@WL);
  \begin{scope}[overlay]
    \clip (0,0) rectangle (\fins@W,\fins@WL);
    \iffins@rays
      \foreach \fins@i in {1,...,6}{%
        \fins@hash{\fins@i}{\fins@seed}%
        \pgfmathsetmacro\fins@rx{\fins@W*(\fins@i-0.6+0.5*\fins@h)/6}%
        \pgfmathsetmacro\fins@rw{0.25+0.5*\fins@h}%
        \fill[white, opacity=0.09]
          (\fins@rx,\fins@WL) -- (\fins@rx+\fins@rw,\fins@WL)
          -- (\fins@rx+\fins@rw+0.5*\fins@WL*0.35+0.6,0) -- (\fins@rx+0.5*\fins@WL*0.35-0.2,0) -- cycle;
      }%
    \fi
    \iffins@backdrop
      \fins@wave{0}{\fins@W}{\fins@W/1.6}{\fins@subh+1}{0.5}{\fins@seed+3}%
      \edef\fins@path{plot[smooth, tension=0.8] coordinates {\fins@wavelist} -- (\fins@W,0) -- (0,0) -- cycle}%
      \fill[fins@c@water!80!black, opacity=0.18] \fins@path;
      \fins@wave{0}{\fins@W}{\fins@W/1.1}{\fins@subh+0.55}{0.3}{\fins@seed+5}%
      \edef\fins@path{plot[smooth, tension=0.8] coordinates {\fins@wavelist} -- (\fins@W,0) -- (0,0) -- cycle}%
      \fill[fins@c@water!60!black, opacity=0.12] \fins@path;
    \fi
  \end{scope}
  % the substrate, back part
  \ifx\fins@substrate\fins@none\else
    \fins@substrateband{\fins@subh}{0.12}{0}%
  \fi
  \begin{scope}[overlay]
  \clip (0,0) rectangle (\fins@W,\fins@H);
}{%
  % front lip of the substrate buries the bases of things set in front
  \ifx\fins@substrate\fins@none\else
    \fins@substrateband{0.5*\fins@subh}{0.06}{1}%
  \fi
  \end{scope}%
  % surface
  \fins@wave{0}{\fins@W}{\fins@W/0.3}{\fins@WL}{0.025}{\fins@seed+11}%
  \edef\fins@edge{plot[smooth, tension=0.7] coordinates {\fins@wavelist}}%
  \fill[white, opacity=0.35] \fins@edge -- (\fins@W,\fins@WL-0.12) -- (0,\fins@WL-0.12) -- cycle;
  \draw[white, line width=1.4*\fins@lw] \fins@edge;
  \iffins@glass
    \fill[white, opacity=0.12] (0.5,0.3) -- (1.3,0.3) -- (2.6,\fins@H-0.3) -- (1.8,\fins@H-0.3) -- cycle;
    \fill[white, opacity=0.1] (1.6,0.3) -- (1.85,0.3) -- (3.15,\fins@H-0.3) -- (2.9,\fins@H-0.3) -- cycle;
    \fill[white, opacity=0.08] (\fins@W-1.3,0.3) -- (\fins@W-1.0,0.3) -- (\fins@W-0.4,\fins@H-0.3) -- (\fins@W-0.7,\fins@H-0.3) -- cycle;
  \fi
  % frame
  \draw[fins@c@frame!50!white, line width=2*\fins@lw] (0,0) -- (0,\fins@H) (\fins@W,0) -- (\fins@W,\fins@H);
  \filldraw[fill=fins@c@frame, draw=fins@c@frame!60!black, line width=\fins@lw, rounded corners=2pt]
    (-0.15,\fins@H-0.04) rectangle (\fins@W+0.15,\fins@H+0.24);
  \fill[white, opacity=0.18, rounded corners=1pt] (0,\fins@H+0.14) rectangle (\fins@W,\fins@H+0.19);
  \filldraw[fill=fins@c@frame, draw=fins@c@frame!60!black, line width=\fins@lw, rounded corners=2pt]
    (-0.15,-0.32) rectangle (\fins@W+0.15,0.04);
  \end{scope}%
  \endgroup
}
% \fins@wave{x0}{x1}{points}{y}{amplitude}{seed} puts a list of points
% for `plot[smooth] coordinates' into \fins@wavelist (no trigonometry,
% so it is quick).
\def\fins@wave#1#2#3#4#5#6{%
  \pgfmathsetmacro\fins@wx{#1}\pgfmathsetmacro\fins@ww{#2-(#1)}%
  \pgfmathsetmacro\fins@wy{#4}\pgfmathsetmacro\fins@wa{#5}%
  \pgfmathtruncatemacro\fins@wn{max(2,#3)}%
  \pgfmathtruncatemacro\fins@wseed{#6}%
  \gdef\fins@wavelist{}%
  \foreach \fins@i in {0,...,\fins@wn}{%
    \fins@ihash{\fins@i}{\fins@wseed}%
    \xdef\fins@wavelist{\fins@wavelist
      (\the\dimexpr\fins@wx cm+\fins@ww cm*\fins@i/\fins@wn\relax,
       \the\dimexpr\fins@wy cm+\fins@wa cm*(\fins@hC-498)/498\relax)}%
  }%
}
% Pebbles are gathered into one path per colour (much faster than one
% path per pebble).  Rows #1..#2, #3 = seed offset.  The look comes from
% \fins@pebblestyle{x step}{row step}{x radius}{x radius spread (sp)}%
%                  {y radius}{x jitter (sp)}{y jitter (sp)}{palette}{edge}{shine}
\newcount\fins@cc
\def\fins@pebblestyle#1#2#3#4#5#6#7#8#9{%
  \def\fins@pdx{#1}\def\fins@pdy{#2}\def\fins@prx{#3}\def\fins@prxj{#4}%
  \def\fins@pry{#5}\def\fins@pjx{#6}\def\fins@pjy{#7}\def\fins@ppal{#8}\def\fins@pedge{#9}%
  \fins@pebbleshine
}
\def\fins@pebbleshine#1{\def\fins@pshine{#1}}
% A substrate is thousands of granules, so they are written straight to
% the output with pgf's system-layer path commands, skipping pgf's soft
% path (which grows quadratically) and its transformations: the current
% transformation is applied here by hand.  One pass per colour.
\newif\iffins@any
\newdimen\fins@qx \newdimen\fins@qy \newdimen\fins@qa \newdimen\fins@qb
\newdimen\fins@qka \newdimen\fins@qkb \newdimen\fins@qux \newdimen\fins@quy
\def\fins@qellipse{% centre \fins@qx,\fins@qy; radii \fins@qa,\fins@qb (canvas)
  \fins@qka=0.5523\fins@qa \fins@qkb=0.5523\fins@qb
  \edef\fins@qcmd{%
    \noexpand\pgfsys@moveto{\the\dimexpr\fins@qx+\fins@qa\relax}{\the\fins@qy}%
    \noexpand\pgfsys@curveto
      {\the\dimexpr\fins@qx+\fins@qa\relax}{\the\dimexpr\fins@qy+\fins@qkb\relax}%
      {\the\dimexpr\fins@qx+\fins@qka\relax}{\the\dimexpr\fins@qy+\fins@qb\relax}%
      {\the\fins@qx}{\the\dimexpr\fins@qy+\fins@qb\relax}%
    \noexpand\pgfsys@curveto
      {\the\dimexpr\fins@qx-\fins@qka\relax}{\the\dimexpr\fins@qy+\fins@qb\relax}%
      {\the\dimexpr\fins@qx-\fins@qa\relax}{\the\dimexpr\fins@qy+\fins@qkb\relax}%
      {\the\dimexpr\fins@qx-\fins@qa\relax}{\the\fins@qy}%
    \noexpand\pgfsys@curveto
      {\the\dimexpr\fins@qx-\fins@qa\relax}{\the\dimexpr\fins@qy-\fins@qkb\relax}%
      {\the\dimexpr\fins@qx-\fins@qka\relax}{\the\dimexpr\fins@qy-\fins@qb\relax}%
      {\the\fins@qx}{\the\dimexpr\fins@qy-\fins@qb\relax}%
    \noexpand\pgfsys@curveto
      {\the\dimexpr\fins@qx+\fins@qka\relax}{\the\dimexpr\fins@qy-\fins@qb\relax}%
      {\the\dimexpr\fins@qx+\fins@qa\relax}{\the\dimexpr\fins@qy-\fins@qkb\relax}%
      {\the\dimexpr\fins@qx+\fins@qa\relax}{\the\fins@qy}%
    \noexpand\pgfsys@closepath}%
  \fins@qcmd\global\fins@anytrue
}
% \fins@rgbof{<colour>}{<macro>}: <macro> becomes {r}{g}{b}
\def\fins@rgbof#1#2{%
  \extractcolorspec{#1}\fins@spec
  \expandafter\convertcolorspec\fins@spec{rgb}\fins@spec
  \expandafter\fins@rgbsplit\fins@spec\relax#2%
}
\def\fins@rgbsplit#1,#2,#3\relax#4{\def#4{{#1}{#2}{#3}}}
\def\fins@pebbles#1#2#3{% first row, last row, seed offset
  \pgfgettransformentries{\fins@ta}{\fins@tb}{\fins@tc}{\fins@td}{\fins@te}{\fins@tf}%
  \pgfmathtruncatemacro\fins@cols{\fins@W/(\fins@pdx/1cm)}%
  \edef\fins@pseed{\number\numexpr\fins@seed+#3\relax}%
  \ifnum\fins@pshine>0 \fins@ellipsepebbles{#1}{#2}\else\fins@pillpebbles{#1}{#2}\fi
}
% Small granules: each is a short line with round caps, stroked twice
% (a dark edge, then its colour), all in one pass.
\newdimen\fins@qw \newdimen\fins@qwe
\def\fins@pillpebbles#1#2{%
  \foreach \fins@k in {0,...,4}{%
    \csname fins@pal@\fins@ppal\endcsname\fins@k
    \expandafter\fins@rgbof\expandafter{fins@c@tmp}\fins@rgb
    \expandafter\global\expandafter\let\csname fins@rgb\fins@k\endcsname\fins@rgb
  }%
  \fins@rgbof{\fins@pedge}\fins@rgbedge
  \fins@qb=\fins@pry \fins@qb=\fins@td\fins@qb \ifdim\fins@qb<0pt \fins@qb=-\fins@qb\fi
  \fins@qw=2\fins@qb
  \pgfmathsetlength\fins@qwe{\fins@qw+0.7*\fins@lw}%
  \edef\fins@sw{\the\fins@qw}\edef\fins@swe{\the\fins@qwe}%
  \begin{pgfscope}
    \pgfsetroundcap
    \foreach \fins@r in {#1,...,#2}{%
      \ifodd\fins@r\def\fins@odd{1}\else\def\fins@odd{0}\fi
      \fins@cc=0 \fins@pillrow
    }%
  \end{pgfscope}
}
\def\fins@pillrow{%
  \ifnum\fins@cc>\fins@cols\else
    \fins@ihash{\fins@cc+137*\fins@r}{\fins@pseed}%
    \count@=\numexpr\fins@hC-(\fins@hC/5)*5\relax
    \ifnum\count@<0 \advance\count@ 5 \fi
    \fins@qux=\dimexpr\fins@pdx*\fins@cc+\fins@pdx*\fins@odd/2+\fins@pjx sp*(\fins@hC-498)\relax
    \fins@quy=\dimexpr\fins@pdy*\fins@r+\fins@pjy sp*\fins@hC\relax
    \fins@qa=\dimexpr\fins@prx+\fins@prxj sp*\fins@hC-\fins@pry\relax
    \ifdim\fins@qa<0pt \fins@qa=0pt \fi
    \fins@qx=\dimexpr\fins@ta\fins@qux+\fins@tc\fins@quy+\fins@te\relax
    \fins@qy=\dimexpr\fins@tb\fins@qux+\fins@td\fins@quy+\fins@tf\relax
    \fins@qa=\fins@ta\fins@qa \ifdim\fins@qa<0pt \fins@qa=-\fins@qa\fi
    \edef\fins@qcmd{%
      \noexpand\pgfsys@setlinewidth{\fins@swe}%
      \noexpand\pgfsys@color@rgb@stroke\fins@rgbedge
      \noexpand\pgfsys@moveto{\the\dimexpr\fins@qx-\fins@qa\relax}{\the\fins@qy}%
      \noexpand\pgfsys@lineto{\the\dimexpr\fins@qx+\fins@qa\relax}{\the\fins@qy}%
      \noexpand\pgfsys@stroke
      \noexpand\pgfsys@setlinewidth{\fins@sw}%
      \noexpand\pgfsys@color@rgb@stroke\csname fins@rgb\the\count@\endcsname
      \noexpand\pgfsys@moveto{\the\dimexpr\fins@qx-\fins@qa\relax}{\the\fins@qy}%
      \noexpand\pgfsys@lineto{\the\dimexpr\fins@qx+\fins@qa\relax}{\the\fins@qy}%
      \noexpand\pgfsys@stroke}%
    \fins@qcmd
    \advance\fins@cc 1
    \expandafter\fins@pillrow
  \fi
}
% Big pebbles: real ellipses with a highlight, one pass per colour.
\def\fins@ellipsepebbles#1#2{%
  \foreach \fins@r in {#1,...,#2}{%
    \ifodd\fins@r\def\fins@odd{1}\else\def\fins@odd{0}\fi
    \foreach \fins@k in {0,...,4}{%
      \csname fins@pal@\fins@ppal\endcsname\fins@k
      \begin{pgfscope}
        \pgfsetfillcolor{fins@c@tmp}\pgfsetstrokecolor{\fins@pedge}%
        \pgfsetlinewidth{0.35*\fins@lw}%
        \def\fins@pass{\fins@k}\fins@cc=0 \global\fins@anyfalse\fins@pebblerow
        \iffins@any\pgfsys@fillstroke\fi
      \end{pgfscope}
    }%
    \ifnum\fins@pshine>0
      \begin{pgfscope}
        \pgfsetfillcolor{white}\pgfsetfillopacity{0.35}%
        \def\fins@pass{5}\fins@cc=0 \global\fins@anyfalse\fins@pebblerow
        \iffins@any\pgfsys@fill\fi
      \end{pgfscope}
    \fi
  }%
}
\def\fins@pebblerow{%
  \ifnum\fins@cc>\fins@cols\else
    \fins@ihash{\fins@cc+137*\fins@r}{\fins@pseed}%
    \count@=\numexpr\fins@hC-(\fins@hC/5)*5\relax
    \ifnum\count@<0 \advance\count@ 5 \fi
    \ifnum\fins@pass=5 \count@=5 \fi
    \ifnum\count@=\fins@pass\relax
      % user coordinates of the centre and the radii
      \fins@qux=\dimexpr\fins@pdx*\fins@cc+\fins@pdx*\fins@odd/2+\fins@pjx sp*(\fins@hC-498)\relax
      \fins@quy=\dimexpr\fins@pdy*\fins@r+\fins@pjy sp*\fins@hC\relax
      \fins@qa=\dimexpr\fins@prx+\fins@prxj sp*\fins@hC\relax
      \fins@qb=\dimexpr\fins@pry\relax
      \ifnum\fins@pass=5
        \advance\fins@qux by -0.4\fins@qa \advance\fins@quy by 0.4\fins@qb
        \fins@qa=0.3\fins@qa \fins@qb=0.3\fins@qb
      \fi
      % to canvas coordinates
      \fins@qx=\dimexpr\fins@ta\fins@qux+\fins@tc\fins@quy+\fins@te\relax
      \fins@qy=\dimexpr\fins@tb\fins@qux+\fins@td\fins@quy+\fins@tf\relax
      \fins@qa=\fins@ta\fins@qa \fins@qb=\fins@td\fins@qb
      \ifdim\fins@qa<0pt \fins@qa=-\fins@qa\fi \ifdim\fins@qb<0pt \fins@qb=-\fins@qb\fi
      \fins@qellipse
    \fi
    \advance\fins@cc 1
    \expandafter\fins@pebblerow
  \fi
}
% palettes: \fins@pal@<name><n> sets fins@c@tmp to colour n (0..4)
\def\fins@pal@gravel#1{%
  \colorlet{fins@c@tmp}{\ifcase#1 finsgravelA\or finsgravelB\or finsgravelC\or finsgravelD\else finsgravelE\fi}}
\def\fins@pal@soil#1{%
  \colorlet{fins@c@tmp}{\ifcase#1 finssoilA\or finssoilB\or finssoilC\or finssoilD\else finssoilE\fi}}
\def\fins@pal@pebbles#1{%
  \colorlet{fins@c@tmp}{\ifcase#1 finspebbleA\or finspebbleB\or finspebbleC\or finspebbleD\else finsgravelC\fi}}
\def\fins@pal@coral#1{%
  \colorlet{fins@c@tmp}{\ifcase#1 finscoralA\or finscoralB\or finscoralC\or finscoralD\else finscoralE\fi}}
\let\fins@gravelcolour\fins@pal@gravel
% how each loose substrate looks: base colour, then \fins@pebblestyle
\def\fins@sub@gravel{\def\fins@pbase{finsgravelA!80!black}%
  \fins@pebblestyle{0.14cm}{0.1cm}{0.06cm}{47}{0.05cm}{94}{37}{gravel}{black!45}{0}}
\def\fins@sub@soil{\def\fins@pbase{finssoilE!70!black}%
  \fins@pebblestyle{0.085cm}{0.06cm}{0.03cm}{45}{0.028cm}{110}{55}{soil}{finssoilE!50!black}{0}}
\def\fins@sub@pebbles{\def\fins@pbase{finsgravelB!70!black}%
  \fins@pebblestyle{0.4cm}{0.22cm}{0.17cm}{110}{0.11cm}{220}{80}{pebbles}{black!50}{1}}
\def\fins@sub@coral{\def\fins@pbase{finscoralB!85!black}%
  \fins@pebblestyle{0.1cm}{0.07cm}{0.04cm}{40}{0.032cm}{80}{40}{coral}{finscoralB!50!black}{0}}
% \fins@substrateband{top}{wave}{part}: part 0 = back, 1 = front lip,
% 2 = the only band (in the fish bowl)
\def\fins@substrateband#1#2#3{%
  \pgfmathsetmacro\fins@st{#1}%
  \fins@wave{0}{\fins@W}{\fins@W/0.8}{\fins@st}{#2}{\fins@seed+7*#3}%
  \edef\fins@path{plot[smooth, tension=0.6] coordinates {\fins@wavelist}
    -- (\fins@W,0) -- (0,0) -- cycle}%
  \edef\fins@edge{plot[smooth, tension=0.6] coordinates {\fins@wavelist}}%
  \ifcsname fins@sub@\fins@substrate\endcsname
    \csname fins@sub@\fins@substrate\endcsname
    \fill[\fins@pbase] \fins@path;
    \begin{scope}[overlay]
      \clip \fins@path;
      \pgfmathtruncatemacro\fins@rows{(\fins@st+0.2)/(\fins@pdy/1cm)}%
      % rows hidden behind the front lip are not drawn
      \ifnum#3=0 \pgfmathtruncatemacro\fins@first{max(0,(0.5*\fins@subh-0.15)/(\fins@pdy/1cm))}%
      \else\def\fins@first{0}\fi
      \fins@pebbles{\fins@first}{\fins@rows}{#3}%
      \ifnum#3=1 \fill[black, opacity=0.08] \fins@path;\fi
    \end{scope}
  \else
    \def\fins@tmp{sand}%
    \ifx\fins@substrate\fins@tmp\else
      \PackageError{tikzfins}{Unknown substrate `\fins@substrate'}
        {Substrates: sand, gravel, soil, pebbles, coral, none.}%
    \fi
    \ifnum#3=1 \colorlet{fins@c@tmp}{fins@c@sand!92!black}\else\colorlet{fins@c@tmp}{fins@c@sand}\fi
    \fill[fins@c@tmp] \fins@path;
    \begin{scope}[overlay]
      \clip \fins@path;
      \pgfmathtruncatemacro\fins@nd{\fins@W*\fins@st*14}%
      \pgfmathsetmacro\fins@sth{\fins@st+0.2}%
      \gdef\fins@specks{}%
      \foreach \fins@i in {1,...,\fins@nd}{%
        \fins@ihash{\fins@i}{\fins@seed+#3}\let\fins@hX\fins@hC
        \fins@ihash{\fins@i+501}{\fins@seed+#3}%
        \xdef\fins@specks{\fins@specks
          (\the\dimexpr\fins@W cm*\fins@hX/997\relax,\the\dimexpr\fins@sth cm*\fins@hC/997\relax)
          circle [radius=0.014cm]}%
      }%
      \fill[fins@c@sand!60!black, opacity=0.35] \fins@specks;
      \begin{scope}[yshift=-0.04cm]
        \draw[fins@c@sand!60!white, line width=1.4*\fins@lw] \fins@edge;
      \end{scope}
    \end{scope}
  \fi
  \draw[black, opacity=0.25, line width=0.6*\fins@lw] \fins@edge;
}

\newenvironment{fishbowl}[1][]{%
  \begingroup
  \def\fins@level{0.82}\def\fins@substrate{gravel}%
  \pgfkeys{/fins/.cd,#1}%
  \fins@setwidths
  \pgfmathsetmacro\fins@R{\fins@radius}%
  \pgfmathsetmacro\fins@WL{\fins@R*(2*\fins@level-1)}%
  \expandafter\fins@openscope\expandafter{\fins@at}%
  \def\fins@bowl{(131.4:\fins@R) arc (131.4:408.6:\fins@R) -- cycle}%
  \fill[finsair, opacity=0.6] \fins@bowl;
  \begin{scope}[overlay]
    \clip \fins@bowl;
    \fins@wave{-\fins@R}{\fins@R}{2*\fins@R/0.25}{\fins@WL}{0.02}{\fins@seed+11}%
    \global\let\fins@bowlwave\fins@wavelist
    \edef\fins@edge{plot[smooth, tension=0.7] coordinates {\fins@bowlwave}}%
    \shade[top color=finswatertop!60!fins@c@water, bottom color=fins@c@water!90!black]
      \fins@edge -- (\fins@R,-1.1*\fins@R) -- (-\fins@R,-1.1*\fins@R) -- cycle;
    \ifx\fins@substrate\fins@none\else
      \begin{scope}[shift={(-\fins@R,-\fins@R)}]
        \pgfmathsetmacro\fins@W{2*\fins@R}\def\fins@subh{1}%
        \fins@substrateband{0.27*\fins@R}{0.03}{2}%
      \end{scope}
    \fi
  \end{scope}
  \begin{scope}[overlay]
  \clip \fins@bowl;
}{%
  \end{scope}%
  \begin{scope}[overlay]
    \clip \fins@bowl;
    \edef\fins@edge{plot[smooth, tension=0.7] coordinates {\fins@bowlwave}}%
    \draw[white, line width=1.2*\fins@lw] \fins@edge;
  \end{scope}
  \begin{scope}[overlay]
    \clip \fins@bowl;
    \draw[white, opacity=0.5, line width=5*\fins@lw, line cap=round]
      (200:0.82*\fins@R) arc (200:150:0.82*\fins@R);
    \draw[white, opacity=0.4, line width=3*\fins@lw, line cap=round]
      (215:0.82*\fins@R) arc (215:208:0.82*\fins@R);
    \draw[white, opacity=0.25, line width=8*\fins@lw, line cap=round]
      (-30:0.86*\fins@R) arc (-30:10:0.86*\fins@R);
  \end{scope}
  \draw[finsbubbleline!80!black, line width=1.2*\fins@lw] \fins@bowl;
  \filldraw[fill=finsair, draw=finsbubbleline!80!black, line width=1.2*\fins@lw]
    (0,0.75*\fins@R) ellipse ({0.7*\fins@R} and {0.07*\fins@R});
  \draw[white, line width=1.2*\fins@lw] ($(0,0.75*\fins@R)+(160:{0.6*\fins@R} and {0.04*\fins@R})$) arc (160:110:{0.6*\fins@R} and {0.04*\fins@R});
  \end{scope}%
  \endgroup
}

\endinput
