29

If possible, can someone help me to animated this figure with Tikz in Beamer?

I updated starting by

1 : ( Yamada-watanab )
2: (Existence faible)
3: (unicite trajectorielle)
4: Tow edges frome  (Existence faible)  (unicite trajectorielle)
5: one Edge from  ( Yamada-watanab ) To (Existence Forte)
6: one Edge from (Existence Forte) to (Defintion) (left one )
7: one Edge from (defintion) (left one) To (Existence faible)
8: One Edge from (unicité trajectorielle) To (Defintion) ( right one)
8: One Edge from (Defintion) ( right one) To (unicité en loi)
9: (unicité en loi)
10: (Engelbert-Cherny) 
11: Tow Edge from (Existence Forte) and (Unicité en loi) To (Engelbert-Cherny)
12: One Edge from (Engelbert-Cherny) To (Unicté trajectorielle)

I tries to use package animated but failed:

\documentclass[leqno,mathserif]{beamer}  
\usepackage{graphics,bm}
\usetheme{Luebeck} 
\setbeamercovered{transparent}
\usepackage[utf8]{inputenc}  
\usepackage[T1]{fontenc}
\usepackage[english,french]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning} 
\usetikzlibrary{matrix}
\begin{document}

    \begin{frame}
        \begin{figure}
            \begin{tikzpicture}
                \matrix (magic) [matrix of nodes,ampersand replacement=\&, column sep=7mm, row sep=5mm]{
                    \node (se) [draw,shape=rectangle] {Existence Forte}; \&
                    \node (yw) [draw,shape=circle] {Yamada-watanab}; \&
                    \node (ul) [draw,shape=rectangle] {Unicité en Loi}; \\
                    \node (d1) [draw,shape=circle] {Définition}; \& 
                    \&   
                    \node (d2) [draw, shape=circle] {Définition}; \\
                    \node (we) [draw, shape=rectangle] {Existence Faible}; \&
                    \node (ec) [draw, shape=circle] {Engelbert-Cherny}; \& 
                    \node (pu) [draw, shape=rectangle] {Unicité Trajectorielle}; \\
                };
                \draw[->, thick] (se) -- (d1); \draw[->, thick] (d1) -- (we);
                \draw[->, thick] (we) -- (yw); \draw[->, thick] (yw) -- (se);
                \draw[->, thick] (se) -- (ec); \draw[->, thick] (ul) -- (ec);
                \draw[->, thick] (ec) -- (pu); \draw[->, thick] (pu) -- (yw);
                \draw[->, thick] (pu) -- (d2); \draw[->, thick] (d2) -- (ul);
            \end{tikzpicture}
        \end{figure}
    \end{frame} \end{document}

4
  • 1
    I am not sure I understand your specifications. Shall each number be a consecutive animation step? Shall the objects from previous animation steps be hidden again? What exactly does "to give" mean?
    – Daniel
    Oct 2, 2013 at 20:13
  • 1
    Furthermore: What should happen to the edges. Shall they appear only if both, starting and ending node, are visible?
    – Daniel
    Oct 2, 2013 at 20:17
  • 2
    To get yourself started: Take a look at the visible on style defined in this answer
    – Daniel
    Oct 2, 2013 at 20:21
  • @Daniel thanks for ur time so I'll redefine specifications this time with edges
    – Educ
    Oct 2, 2013 at 21:18

1 Answer 1

50

If by "animated" you mean creating overlays, then a straight application of Daniel's visible on key would solve the problem.

Step 1. Put the following in the preamble:

\tikzset{
  invisible/.style={opacity=0},
  visible on/.style={alt={#1{}{invisible}}},
  alt/.code args={<#1>#2#3}{%
    \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
  },
}

Step 2. Use the [visible on=<num->] to control the part of drawing you want to show on a particular slide. For example,

\node (se) [draw,shape=rectangle,visible on=<5->] {Existence Forte};

means node (se) will be shown from the fifth slide onwards.

The following should produce an overlay effect you wanted:

\begin{tikzpicture}
    \matrix (magic) [matrix of nodes,ampersand replacement=\&, column sep=7mm, row sep=5mm]{
        \node (se) [draw,shape=rectangle,visible on=<5->] {Existence Forte}; \&
        \node (yw) [draw,shape=circle,visible on=<1->] {Yamada-watanab}; \&
        \node (ul) [draw,shape=rectangle,visible on=<9->] {Unicité en Loi}; \\
        \node (d1) [draw,shape=circle,visible on=<6->] {Définition}; \& 
        \&   
        \node (d2) [draw, shape=circle,visible on=<8->] {Définition}; \\
        \node (we) [draw, shape=rectangle,visible on=<2->] {Existence Faible}; \&
        \node (ec) [draw, shape=circle,visible on=<10->] {Engelbert-Cherny}; \& 
        \node (pu) [draw, shape=rectangle,visible on=<3->] {Unicité Trajectorielle}; \\
    };
    \draw[->, thick,visible on=<6->] (se) -- (d1); \draw[->, thick,visible on=<7->]  -- (we);
    \draw[->, thick,visible on=<4->] (we) -- (yw); \draw[->, thick,visible on=<5->] (yw) -- (se);
    \draw[->, thick,visible on=<11->] (se) -- (ec); \draw[->, thick,visible on=<11->] (ul) -- (ec);
    \draw[->, thick,visible on=<12->] (ec) -- (pu); \draw[->, thick,visible on=<4->] (pu) -- (yw);
    \draw[->, thick,visible on=<8->] (pu) -- (d2); \draw[->, thick,visible on=<9->] (d2) -- (ul);
\end{tikzpicture}

enter image description here

6
  • Would you please post the full MWE on pastebin? additionally, how can I export the beamer presentation to gif? Thanks in advance
    – Diaa
    Oct 4, 2019 at 23:17
  • 1
    Daniel code is here: tex.stackexchange.com/a/55849/138900
    – AndréC
    Oct 30, 2019 at 21:32
  • 1
    If the nodes in the animation have labels, one maybe include prefix after command={\pgfextra{\tikzset{every label/.style={opacity=0}}}} in the definition of invisible to have the text hidden as well.
    – kmundnic
    Jan 3, 2020 at 19:35
  • How can I make sure that the tikzpicture has the full size of the final picture from beginning on? Jun 27, 2020 at 13:42
  • @kmundnic your comment would have the next that I'd ask. But where exactly do I need to put this? Jun 27, 2020 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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