
I propose a solution (or at least the beginning of a solution) based on @Alain Matthes's answer. Looking at the image above, we see, on the left, a case when the solution works (a simple to[] operation) and a case when it doesn't (an arc operation). The lower-right curve is the original curve from Alain's answer with width factor = 1 (for reference).
I introduce a decoration that puts together Alain's and a show path construction that introduces the arrow tip. There are three arguments:
the width factor and the colors, start color and end color (already present in the previous answer).
Note that the resulting curve is slightly longer; the yellow curve drawn over the lower-left curve in the image shows the original path.
Remark 1. You can modify the relationship between the widths of the curve and arrow at their meeting point by modifying the constants in the definitions of \w and \d.
Remark 2. I think Alain's decoration could be modified in a more intelligent way to produce the result you are looking for, but I don't know how (I don't know how to use pgf commands).
The code
\documentclass[11pt, border=.5cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{math, arrows.meta}
\usetikzlibrary{decorations.pathreplacing}
%%% Alain Matthes's decoration
\pgfkeys{/pgf/decoration/.cd,
width factor/.store in =\wfactor,
start color/.store in =\startcolor,
end color/.store in =\endcolor
}
\makeatletter
\pgfdeclaredecoration{width and color change}{initial}{
\state{initial}[width=0pt, next state=line, persistent precomputation={%
\pgfmathdivide{50}{\pgfdecoratedpathlength}%
\let\increment=\pgfmathresult%
\def\x{0}%
}]{}
\state{line}[width=.5pt, persistent postcomputation={%
\pgfmathadd@{\x}{\increment}%
\let\x=\pgfmathresult%
}]{%
\pgfsetlinewidth{\wfactor\x/500.075pt+\pgflinewidth}%
\pgfsetarrows{-}%
\pgfpathmoveto{\pgfpointorigin}%
\pgfpathlineto{\pgfqpoint{.75pt}{0pt}}%
\pgfsetstrokecolor{\endcolor!\x!\startcolor}%
\pgfusepath{stroke}%
}
\state{final}{%
\pgfsetlinewidth{\pgflinewidth}%
\pgfpathmoveto{\pgfpointorigin}%
\color{\endcolor!\x!\startcolor}%
\pgfusepath{stroke}%
}
}
\makeatother
\begin{document}
\tikzset{
tmp/.style n args={3}{
postaction={
decoration={
width and color change,
width factor=#1,
start color=#2,
end color=#3
}, decorate
},
preaction={
decoration={
show path construction,
curveto code={
\tikzmath{
real \w, \d;
\w = {#160};
\d = {#190};
}
\draw[#3,
arrows={-Stealth[width=\w pt, length=\d pt]}]
(\tikzinputsegmentfirst) .. controls
(\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)
..(\tikzinputsegmentlast) -- ([turn]0: \w pt);
}
}, decorate
}
}
}
\begin{tikzpicture}
\draw[tmp={.4}{blue}{gray}] (0, 0) to[out=0, in=150] ++(6, 2);
\draw[tmp={.4}{blue}{gray}] (0, -1) to[out=0, in=150] ++(6, 2);
\draw[yellow, thin] (0, -1) to[out=0, in=150] ++(6, 2);
\path[tmp={.4}{yellow}{red}] (14, -1) arc (0: 120: 4);
\draw[line width=.4pt, decoration={width and color change,
width factor=1, start color=yellow, end color=red},
decorate] (14, -3) arc (0:120:4cm);
\end{tikzpicture}
\end{document}
bendinglibrary solves this issue. See also here: https://tex.stackexchange.com/a/273201/118712 – Markus G. Jun 07 '21 at 12:02