Following Issue with fade-no-fill.sty, I wanted to try implementing @hpekristiansen solution. I’m giving a more complete code here because I have text nodes on the paths actually.
\documentclass[tikz]{standalone}
\usetikzlibrary{shapes, fadings}
\begin{document}
\begin{tikzpicture}
\node [red,draw,thick,ellipse] (S) at (-3,0) {Solide};
\node [blue,draw,thick,ellipse] (L) at (3,0) {Liquide};
\node [green,draw,thick,ellipse] (G) at (0,{3*sqrt(3)}) {Gaz};
\draw [thick,-latex,red,path fading=north,postaction={draw,green,path fading=south}] (S) to[bend left] node [midway,above,sloped,black] {Sublimation} (G);
\draw [thick,-latex,green,path fading=south,postaction={draw,blue,path fading=north}] (G) to[bend left] node [midway,above,sloped,black] {Liquéfaction} (L);
\draw [thick,-latex,blue,path fading=west,postaction={draw,red,path fading=east}] (L) to[bend left] node [midway,below,sloped,black] {Solidification} (S);
\draw [thick,-latex,red,path fading=east,postaction={draw,blue,path fading=west}] (S) to node [midway,above,sloped,black] {Fusion} (L);
\draw [thick,-latex,blue,path fading=north,postaction={draw,green,path fading=south}] (L) to node [midway,below,sloped,black] {Vaporisation} (G);
\draw [thick,-latex,green,path fading=south,postaction={draw,red,path fading=north}] (G) to node [midway,below,sloped,black] {Condensation} (S);
\end{tikzpicture}
\end{document}
Output (in a correct PDF viewer, see comments under https://tex.stackexchange.com/a/615816/56823) is as follow:
I have two issues with it:
- Clipping on the horizontal line. @hpekristiansen mentionned this issue and a workaround (also in Fading arrows in TikZ), but actually clipping is not limited to the arrow : the text node also is clipped! I could of course also redraw it, but this is far from ideal. Note that using
arrows.meta
and substituting-latex
for-Latex
does not fixes the issue here (but is a fine change if required for a proper solution). - Fading on text nodes. I’ve tried adding
path fading=none
to the nodes options, but for no results. I can of course draw the text nodes separately, but again this is far from ideal.
Best Answer
I'm not sure how much of a "hack" this counts as, but as is often the case much of the hackery can be hidden in styles so that it doesn't feel too bad.
The two issues are addressed as follows:
So that the nodes are not affected by the fading, but are still defined on the relevant path, then the fading is implemented in two postactions (the choice of postaction is arbitrary - it could be two preactions, or one pre and one post). The path itself is not drawn. To make this a bit slicker, I've defined a style
path bifading
that takes two directions and two styles (in this, the styles are just colours but they could be more general).To ensure that the arrowheads are visible, I define a key that extends the bounding box. Specifically, at the end of the path then this key simulates adding a point that is positioned at the point
(-5pt,5pt)
relative to the end of the path and rotated so that the x direction points along the path and the y direction is normal to the path. Note that this does not actually extend the path, it just extends the bounding box. The transformation to this coordinate system is achieved by way of myspath3
library.As @hpekristiansen suggests in the comments, the angle of the fading can be figured out from the path's endpoints. There's a bit of work to be done to make the path accessible in the postaction, but it's doable.