[Tex/LaTex] Animation in beamer

beamer

I was wondering if it is possible to make an animation in beamer. I normally work on graph theory. By a graph I mean a set of vertices and some edges joining them.

I wish to make an animation showing an isomorphism from one graph to the other. I could draw graphs using tikz package. But I don't know how to make the motion. So what I really want is to make an animation showing one point smoothly move to another point.

For example, I want something as below happen: enter image description here

Best Answer

I don't use beamer but one can start with that :

enter image description here

\documentclass[margin=5pt]{standalone}
\usepackage{tikz,animate}
\usepackage[active,tightpage]{preview}
\usetikzlibrary{calc}

\xdef\C{8}
\xdef\H{4.5}

\begin{document}

\foreach \nxb in {0,.05,...,1,1,.95,...,0,0} {%
\begin{preview}
%\begin{animateinline}[controls]{10}
%   \multiframe{11}{nxb=0+.1}{%

    \begin{tikzpicture}

    \draw (-1,-.5) rectangle (2*\H,2*\H-.5) ;

    \coordinate (C6) at (0,0) ;
    \coordinate (C4) at (\C,0) ;
    \coordinate (C1) at (0,\C) ;
    \coordinate (C3) at (\C,\C) ;
    \coordinate (C2) at ($(C1)!.5!(C3)$) ;
    \coordinate (C5) at ($(C6)!.5!(C4)$) ;
    \coordinate (C7) at ($(C6)!.5!(C3)$) ;

    \coordinate (H5) at ($(C1)!.5!(C4)$) ;
    \begin{scope}[shift=(H5)]
    \coordinate (H6) at (0:\H) ;
    \coordinate (H7) at (60:\H) ;
    \coordinate (H4) at (120:\H) ;
    \coordinate (H3) at (180:\H) ;
    \coordinate (H2) at (240:\H) ;
    \coordinate (H1) at (300:\H) ;
    \end{scope}

    \foreach \i in {1,...,7} {%
        \fill ($(H\i)!\nxb!(C\i)$) circle (2pt) coordinate (M\i) ; }
    \draw (M1)--(M2)--(M3)--(M4)--(M5)--(M6)--(M7)--(M4)
        (M6)--(M1)--(M5) ;

    \end{tikzpicture}
    %}
%\end{animateinline}
\end{preview}}
\end{document}
Related Question