Exporting animation created with animate package

1 Animated SVG (animate [2018/11/20])

  • suitable for inclusion in Web pages (or viewed standalone, also on mobile devices)
  • freely scalable (vectorial graphics)
  • relies on M. Gieseking's dvisvgm output driver/utility (available in TeXLive and MikTeX)

  • compile with

    latex myAnim.tex % or lualatex --output-format=dvi or xelatex --no-pdf
    dvisvgm --exact --font-format=woff --zoom=-1 myAnim.dvi % or myAnim.xdv
    

myAnim.tex:

    \documentclass[dvisvgm,12pt]{article}
    \usepackage{animate}
    \pagestyle{empty}

    \begin{document}\Huge
    \begin{center}

      \begin{animateinline}[controls,buttonsize=0.5em,autoplay,loop]{2}
        \multiframe{10}{i=0+1}{
          \framebox[1em]{\i}
        }
        \newframe
          \framebox[1em]{A}
        \newframe
          \framebox[1em]{B}
        \newframe
          \framebox[1em]{C}
        \newframe
          \framebox[1em]{D}
        \newframe
          \framebox[1em]{E}
        \newframe
          \framebox[1em]{F}
      \end{animateinline}

    \end{center}
    \end{document}
  • embed into HTML with the <object> tag

    <object type="image/svg+xml" data="myAnim.svg">
      <!-- fallback & search engine indexing -->
      <img src="myAnim.svg" />
    </object>
    
  • The Chromium Web browser and those derived from it (Chrome, Opera, ...) have by far the best rendering performance, as can be tested with the Lorenz attractor example.

2 Export to multipage PDF (animate [2018/08/22])

As of version [2018/08/22], animate has the package option export, to be used together with the standalone document class, as in:

\documentclass[export]{standalone}
\usepackage{animate}

or

\documentclass{standalone}
\usepackage[export]{animate}

Animation frames are output as individual pages of a multipage document, suitable for conversion to other file formats, such as animated GIF, using external programs, such as convert from ImageMagick.org:

convert -density 300 -delay 4 -loop 0 -alpha remove multipage.pdf animated.gif

creates an animated GIF at 100/4=25 frames per second.

Tags:

Animate