desvaneciendo una línea en tikz

desvaneciendo una línea en tikz

Estoy empezando con el siguiente código:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta, matrix}

\begin{document}

\begin{tikzpicture}[description/.style={fill=white,inner sep=1.5pt}]
  \matrix (m) [%
    matrix of math nodes,
    row sep=8em, column sep=8em,
    text height=1.5ex,
    text depth=0.25ex
  ]{
    (a \rightarrow t) \rightarrow t & a & (a \rightarrow S b) \rightarrow S b
    \\
    & S a &
    \\
  };
  \path[-stealth,font=\scriptsize, red]
    (m-1-2) edge node[description] {LIFT$_t$} (m-1-1)
    (m-2-2) edge node[sloped,description] {A} (m-1-1);
  \path[-stealth,font=\scriptsize, blue]
    (m-1-2) edge node[description] {LIFT$_{S b}$} (m-1-3)
    (m-2-2) edge node[sloped,description] {BIND} (m-1-3);
  \path[-stealth,font=\scriptsize, magenta]
    (m-1-2) edge node[description] {$\eta$} (m-2-2);
  \path[-stealth,font=\scriptsize%, left color=red, right color=blue
    ]
    (m-1-1) edge[bend left=25] node[pos=.75,sloped,description]
    {Cresti's [+WH]} (m-1-3);
\end{tikzpicture}

\end{document}

Estoy interesado en sombrear la línea curva (la final \pathen el ejemplo), de rojo a magenta y azul (he incluido las otras \pathpara que puedas ver por qué podría interesarme esto).

La parte comentada muestra mi mejor suposición sobre cómo funcionaría esto, pero por supuesto no es así. Pasé algún tiempo explorando TeX.SX y vi algunas soluciones que parecen relacionadas, pero nada que parezca abordar esto directamente.

Respuesta1

Quizás hablé demasiado pronto.

La solución de Mark Wibrowparece aplicarse.

La salida

ingrese la descripción de la imagen aquí

Se aplicó el código de Mark.

\documentclass[border=0.125cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{fadings,decorations.pathmorphing,arrows.meta,matrix,calc}


\makeatletter
% Code by Mark Wibrow 
% https://tex.stackexchange.com/a/137438/116936
% solution 2
\newif\iftikz@shading@path

\tikzset{
    % There are three circumstances in which the fading sep is needed:
    % 1. Arrows which do not update the bounding box (which is most of them).
    % 2. Line caps/joins and mitres that extend outside the natural bounding 
    %    box of the path (these are not calculated by PGF).
    % 3. Other reasons that haven't been anticipated.
    fading xsep/.store in=\pgfpathfadingxsep,
    fading ysep/.store in=\pgfpathfadingysep,
    fading sep/.style={fading xsep=#1, fading ysep=#1},
    fading sep=0.0cm,
    shading path/.code={%
        % Prevent this stuff happning recursively.
        \iftikz@shading@path%
        \else%
            \tikz@shading@pathtrue%
            % \tikz@addmode installs the `modes' (e.g., fill, draw, shade) 
            % to be applied to the path. It isn't usualy for doing more
            % changes to the path's construction.
            \tikz@addmode{%
                \pgfgetpath\pgf@currentfadingpath%
                % Get the boudning box of the current path size including the fading sep
                \pgfextract@process\pgf@fadingpath@southwest{\pgfpointadd{\pgfqpoint{\pgf@pathminx}{\pgf@pathminy}}%
                    {\pgfpoint{-\pgfpathfadingxsep}{-\pgfpathfadingysep}}}%%
                \pgfextract@process\pgf@fadingpath@northeast{\pgfpointadd{\pgfqpoint{\pgf@pathmaxx}{\pgf@pathmaxy}}%
                    {\pgfpoint{\pgfpathfadingxsep}{\pgfpathfadingysep}}}%
                % Clear the path
                \pgfsetpath\pgfutil@empty%                          
                % Interrupt the path and picture to create a fading.
                \pgfinterruptpath%
                \pgfinterruptpicture%
                    \begin{tikzfadingfrompicture}[name=.]
                        \path [shade=none,fill=none, #1] \pgfextra{%
                            % Set the softpath. Any transformations in #1 will have no effect.
                            % This will *not* update the bounding box...
                            \pgfsetpath\pgf@currentfadingpath%
                            % ...so it is done manually.
                            \pgf@fadingpath@southwest
                            \expandafter\pgf@protocolsizes{\the\pgf@x}{\the\pgf@y}%
                            \pgf@fadingpath@northeast%
                            \expandafter\pgf@protocolsizes{\the\pgf@x}{\the\pgf@y}%
                        };
                        % Now get the bounding of the picture.
                        \xdef\pgf@fadingboundingbox@southwest{\noexpand\pgfqpoint{\the\pgf@picminx}{\the\pgf@picminy}}%
                        \xdef\pgf@fadingboundingbox@northeast{\noexpand\pgfqpoint{\the\pgf@picmaxx}{\the\pgf@picmaxy}}%
                        %
                    \end{tikzfadingfrompicture}%
                \endpgfinterruptpicture%
                \endpgfinterruptpath%
                % Install a rectangle that covers the shaded/faded path picture.                                
                \pgfpathrectanglecorners{\pgf@fadingboundingbox@southwest}{\pgf@fadingboundingbox@northeast}%
                % Make the fading happen.
                \def\tikz@path@fading{.}%
                \tikz@mode@fade@pathtrue%
                \tikz@fade@adjustfalse%10pt
                % Shift the fading to the mid point of the rectangle
                \pgfpointscale{0.5}{\pgfpointadd{\pgf@fadingboundingbox@southwest}{\pgf@fadingboundingbox@northeast}}%
                \edef\tikz@fade@transform{shift={(\the\pgf@x,\the\pgf@y)}}%
            }%
        \fi%
    }
}

\begin{document}
\begin{tikzpicture}[description/.style={fill=white,inner sep=1.5pt}]
  \matrix (m) 
    [%
      matrix of math nodes,
      row sep=8em, column sep=8em,
      text height=1.5ex,
      text depth=0.25ex
    ]
    {
    (a \rightarrow t) \rightarrow t & a   & (a \rightarrow S b) \rightarrow S b \\
                                    & S a &                                     \\
  };
  \path[-stealth,font=\scriptsize, red]
    (m-1-2) edge node[description] {LIFT$_t$} (m-1-1)
    (m-2-2) edge node[sloped,description] {A} (m-1-1);
  \path[-stealth,font=\scriptsize, blue]
    (m-1-2) edge node[description] {LIFT$_{S b}$} (m-1-3)
    (m-2-2) edge node[sloped,description] {BIND} (m-1-3);
  \path[-stealth,font=\scriptsize, magenta]
    (m-1-2) edge node[description] {$\eta$} (m-2-2);
    \def\height{2}
  \path
    [
    left color=red,
    right color=blue,
    shading path={draw=transparent!0,stealth-stealth,},
    ]
    (m-1-1) .. controls ($(m-1-1)!.3!(m-1-3)+(0,\height)$) and ($(m-1-1)!.7!(m-1-3)+(0,\height)$) .. (m-1-3) ;
    %and now for the label
    \path (m-1-1) .. controls ($(m-1-1)!.3!(m-1-3)+(0,\height)$) and ($(m-1-1)!.7!(m-1-3)+(0,\height)$) .. (m-1-3) node [pos=.7,sloped, fill = white, font=\scriptsize, yshift=-1pt ] {Cresti's [+WH]} ; 
\end{tikzpicture}
\end{document}

información relacionada