[Tex/LaTex] Beamer: display previous graphics (in an overlay) in a lighter color

beameroverlays

With Inkscape (software to create vector images) I created a file with several layers. Thanks to a very useful script (beamerscape), these layers are then saved as separate PDF files. Next, using overlay, the layers step-by-step appear as overlaying graphics in the presentation, like this:

\documentclass{beamer}

\usepackage[absolute,overlay]{textpos}
\textblockorigin{0mm}{0mm}

\begin{document}

\begin{frame}[t]{Some title...}
Some text...
\transdissolve<3,5,7>

% Layer "1<1-2,8>"
\pgfdeclareimage[width=\paperwidth]{Layer1}{Figures/Layer1}
\begin{textblock}{1}(0,0)
\pgfuseimage<1-2,8>{Layer1}
\end{textblock}

% Layer "2<2-4,8>"
\pgfdeclareimage[width=\paperwidth]{Layer2}{Figures/Layer2}
\begin{textblock}{1}(0,0)
\pgfuseimage<2-4,8>{Layer2}
\end{textblock}

% Layer "3<4-6,8>"
\pgfdeclareimage[width=\paperwidth]{Layer3}{Figures/Layer3}
\begin{textblock}{1}(0,0)
\pgfuseimage<4-6,8>{Layer3}
\end{textblock}

% Layer "4<6-7,8>"
\pgfdeclareimage[width=\paperwidth]{Layer4}{Figures/Layer4}
\begin{textblock}{1}(0,0)
\pgfuseimage<6-7,8>{Layer4}
\end{textblock}

\end{frame}

\end{document}

As you can see, the first layer only appears in steps 1 and 2 (the transdissolve effect isn't necessary of course). What I would like is that in step 2, so after step 1, this first layer is displayed in a lighter color (so a little transparent, like the \uncover command can do with for instance lists or equations).

Likewise, the second layer should appear in step 2 just as it is, and then in step 3 and 4 (or perhaps only step 4) fade to a lighter color.

As example for the graphics, imagine layer 1 as a full circle, and layer 2 as a part of this full circle. When layer 2 overlaps layer 1 (as would be the case in step 2 in this example), you won't notice the transition to step 2 because this "part of a circle" is just displayed on top of the complete circle.

It is, by the way, not a solution to display layer 1 just in step 1 (and then display only layer 2 in step 2) — I really want to display the full circle, layer 1, in a lighter color in step 2, with layer 2 (part of the circle) on top of it.

Best Answer

You can obtain the effect you want as follows:

\documentclass{beamer}

\usepackage{tikz}

\usepackage[absolute,overlay]{textpos}
\textblockorigin{0mm}{0mm}

\begin{document}

\begin{frame}[t]

\pgfdeclareimage[interpolate=true,height=\textheight]{layer1}{circle}
\pgfdeclareimage[height=\textheight]{layer2}{square}

\begin{textblock}{1}(0,0)
  \begin{tikzpicture}
    \only<1>{\node[opacity=1]{\pgfuseimage{layer1}}};
    \only<2->{\node[opacity=0.5]{\pgfuseimage{layer1}}};
  \end{tikzpicture}
\end{textblock}

\begin{textblock}{1}(0,0)
  \begin{tikzpicture}
    \only<2>{\node[opacity=1]{\pgfuseimage{layer2}}};
    \only<3->{\node[opacity=0.5]{\pgfuseimage{layer2}}};
  \end{tikzpicture}
\end{textblock}

\end{frame}

\end{document}

This displays a circle in the first slide, and in the second a square in full opacity circumscribed in the circle which is 50% transparent.