« Return to Thread: [animate.sty] simple example

Re: [animate.sty] simple example

by Kjell Magne Fauske :: Rate this Message:

Reply to Author | View in Thread

On Feb 9, 2008 8:42 PM, Patrick Drechsler <patrick@...> wrote:

> Hi,
>
> I just discovered the new version of animate.sty[1]. Has anybody used
> this successfully with beamer and tikz?
>
> If so, could you be so kind to share a very minimal usage example?
>
> Regards
>
> Patrick
>

You can find an example by Brian S. Marks here:
http://www.fauskes.net/pgftikzexamples/animated-distributions/

The example uses animateinline environment. For most uses I find it
more convenient to generate the animation as a standalone PDF where
each page is a frame in the animation. Here is a simple example:

setanim.tex
-----------------

\documentclass{beamer}
\usepackage{tikz}

%%%<
\usepackage{verbatim}
\usepackage[active,floats,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
%%%>

\begin{document}
\def\boundb{(-2,2) rectangle (4,-2)}
\foreach \xb in {0,0.1,...,2.1}{
    \def\setA{(0,0) circle (1)}
    \def\setB{(\xb,0) circle (1)}

    \begin{tikzpicture}
    \draw \boundb;
    % intersection
    \begin{scope}
    \clip \setA;
    \fill[black!20] \setB;
    \end{scope}
     \begin{scope}[even odd rule]% first circle without the second
        \clip \setB \boundb;
        \fill[red!20] \setA;
     \end{scope}
    \begin{scope}[even odd rule]% first circle without the second
        \clip \setA \boundb;
        \fill[blue!20] \setB;
     \end{scope}
    \draw \setA;
    \draw \setB;
    \node at (-1,0) [left] {$A$};
    \node at (\xb+1,0) [right] {$B$};

    \node at (4,2) [below left] {$A\cap B$};

    \end{tikzpicture}
}
\end{document}

-------
The above code creates a simple animation. Note the use of the
preview[1] package to crop the pages. To include the animation in a
Beamer presentation I use the following code:

[1] http://www.ctan.org/tex-archive/help/Catalogue/entries/preview.html

------

\documentclass{beamer}
\usepackage{animate}
\usepackage{tikz}
\begin{document}

\begin{frame}
\frametitle{Sets}
\begin{center}
\animategraphics[palindrome]{12}{setanim}{}{}
\end{center}
\end{frame}
\end{document}

--------

Note that I use pdflatex to create the above files.

Hope this helps!

- Kjell Magne Fauske

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Latex-beamer-users mailing list
Latex-beamer-users@...
https://lists.sourceforge.net/lists/listinfo/latex-beamer-users

 « Return to Thread: [animate.sty] simple example