6

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

9

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}
  • two things I am not sure. 1. How can you convert it to the gif file? When I compiled your codes I got a pdf file and it shows me the consecutive slides. 2. How do you embed this into beamer? Thanks – Easy May 25 '14 at 13:29
  • To made the animated gif you see an this page, I used a step of .01 instead of .05 and imported the pdf file in gimp as calques not as images with 300 ppp, then exported it as gif, et voilà. I don't use beamer at all, maybe I will soon, but now I can't help you with this. – Tarass May 25 '14 at 14:50
  • 1
    @Easy: It's not possible to include animated gif files in beamer. You can include animations but not gif. – Ignasi May 25 '14 at 21:04

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.