Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want some nice reflections in my slides. Something like the ones seen in Jobs Keynotes.

Suppose you have multiple elements in the tikz picture and you want to reflect the whole thing with fading.

How can I achieve this using pgf/tikz?

share|improve this question

1 Answer 1

up vote 16 down vote accepted

I don't think that TikZ has support for copying contents. So the best idea I have is creating a command for the contents and then using that twice—the second time with appropriate transformations and fading applied. Here is a proof of concept:

\documentclass{article}
\pdfpageattr{/Group <</S /Transparency /I true /CS /DeviceRGB>>} 
\usepackage{tikz}
\usetikzlibrary{positioning,fadings}


\begin{document}
\newcommand\tikzcontents{
    \fill[red] (-1,-2) rectangle (1,0.5);
    \node (a) {first line};
    \node[below=of a] (b) {second line}; 
}

\begin{tikzpicture}
    \tikzcontents
    \begin{scope}[yshift=-4.5cm,yscale=-1,transform canvas,transform shape]
        \path[scope fading=south] (-1,-4) rectangle (1,0.5);
        \tikzcontents
    \end{scope}
\end{tikzpicture}
\end{document}

proof of concept

Be aware that not all pdf viewers have support for fadings. For example, Evince won't display them properly. The \pdfpageattr line is to work around a bug in Acrobat Reader (see “Using opacity in TikZ causes strange rendering in Acrobat”).

share|improve this answer
1  
Compare also the title page of the current TikZ manual. –  Caramdir Feb 12 '11 at 22:07
2  
The 2.x TikZ/PGF has support of copying content, e.g. in the spy library. However, I don't think it is much different to the technique you are using. –  Martin Scharrer Feb 12 '11 at 22:11
    
And works with overlays too! –  baol Feb 13 '11 at 9:18
1  
An alternative solution using spy would be a great addition! –  baol Feb 13 '11 at 9:24
    
@baol: The spy library is for spyglass effects, i.e. some area is zoomed out. I just mentioned it as example that TikZ can copy content. I don't think it supports shadings, at least not out of the box. –  Martin Scharrer Feb 13 '11 at 15:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.