Why \uncover<2->
and \visible<2->
do not work I don’t know, but here are two work-arounds:
Work-Around 1: \alt
+ \pgfkeysalso
There are two /.style
s and one /.code
, to help with beamer
:
invisible/.style={opacity=0,text opacity=0}
This style is not very beamer
special because it sets only every opacity (draw, fill, text) to zero, which means: It is there, but you cannot see it. It occupies the same space, much like \phantom
.
alt/.code args={<#1>#2#3}{\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}}
This code handler uses two things:
- The
\alt<overlay>{arg1}{arg2}
macro provided by beamer
that executes arg1
when on overlay
, otherwise arg2
; and
\pgfkeysalso
which adds TikZ keys to a path without changing it otherwise. This is similar to adding [some keys=values]
to a path.
visible on/.style={alt={#1{}{invisible}}}
This style is rather a shortcut to alt
. It does nothing to a path on <#1>
but hides in otherwise.
If you want to use overlay specification with a ,
, e.g. <2,4>
, you have to enclose it in { }
: visible on={<2,4>}
. (For that same reason are the alt
arguments enclosed in braces.)
Code
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shadows,spy,shapes.symbols}
\tikzset{
invisible/.style={opacity=0,text opacity=0},
visible on/.style={alt={#1{}{invisible}}},
alt/.code args={<#1>#2#3}{%
\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
},
}
\begin{document}
\begin{frame}
Space
\begin{center}
\begin{tikzpicture}[spy scope={magnification=1.5, size=2cm},every spy in node/.style={remember picture,overlay,magnifying glass,circular drop shadow,fill=white,draw,ultra thick, cap=round}]
\node[rectangle, draw, minimum width=1cm, minimum height=1cm] (N) {};
\spy[visible on=<2->] on (N) in node;
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
Work-Around 2: overlay
The TikZ key overlay
prevents the update of the bounding box. The content is simply overlayed on the page with no respect for everything.
This does work in this case …
Code
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shadows,spy,shapes.symbols}
\begin{document}
\begin{frame}
Space
\begin{center}
\begin{tikzpicture}[spy scope={magnification=1.5, size=2cm},every spy in node/.style={remember picture,overlay,magnifying glass,circular drop shadow,fill=white,draw,ultra thick, cap=round}]
\node[rectangle, draw, minimum width=1cm, minimum height=1cm] (N) {};
\only<2->{\spy[overlay] on (N) in node;}
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
Best Answer
In this solution I applied the Daniel's method shown in Mindmap tikzpicture in beamer (reveal step by step): it has several advantages and it is very simple to be used.
In the following code, with respect to the MWE provided, I shifted in the preamble the style definitions:
What you simply have to do, once inserted in the preamble the Daniel's code, is to define in which time instant you want to display nodes; the method is to add in
child
optionsvisible on=<...>
.Finally, what you get are those three frames: