With PGF/TikZ one can produce fadings, like

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\fill[green,path fading=south] (90:4) -- (210:4) -- (-30:4) -- cycle;
\end{tikzpicture}
\end{document}


Now I would like to rotate this picture by 120°, so that the fading starts at the left corner. TikZ has a fading angle key, so that I thought the following should work:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\end{tikzpicture}
\end{document}


To my surprise, this produces the following picture:

Note that the fading doesn't start immediately at the corner and doesn't fade all the way to white (the upper vertex is at 25% saturation and the right one at 33%).

What is going on here and how can I produce the correct rotated picture?

-

The thing to remember about fadings is that they work by putting a rectangle behind the object, fading the rectangle and then clipping to the object. If you fade a rectangle with fade angle=120 then you'll see that it does get to white, but only in the upper right corner of the rectangle, which isn't seen by the triangle.

One way to get the fading to rotate correctly is to apply a canvas transformation. Of course, this can get a bit tricky working out all the coordinates! But as you can see below, this does work.

The images below are:

1. The triangle rotated using a coordinate transformation (this one is first so I don't have to worry about the origin of rotation!) so the special options are transform canvas={rotate=120},path fading=south.
2. The result of putting just rotate=120: viz, the triangle is rotated but the fading isn't.
3. The original: path fading=south
4. The rotated fading: path fading=south,fading angle=120
5. The rectangular version of that, showing that the fading does fade to white

-