Here is a question about how to display fireworks and I like the answer of cmhughes very much. It generates 20 frames and then use them to generate a gif file. But I would like the 20 frames to be displayed in only one frame. I know I should use the animate package, but I am new to the package and I do not know how to associate it with the tikz package. Here is the code, but it does not work. Anyone can help? Thanks in advance and happy new year.
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,decorations.shapes}
\usepackage{animate}
\usepackage{ifthen}
\begin{document}
\begin{frame}
\begin{animateinline}[poster=first, controls]{8}%
\multiframe{21}{radius=1+1}{%
\begin{tikzpicture}
% background rectangle
\filldraw[black] (-3,-3) rectangle (5,3);
% skyline
\filldraw[black!80!blue](-3,-3)--(-3,-2)--(-2.5,-2)--(-2.5,-1)--(-2.25,-1)--(-2.25,-2)--(-2,-2) --(-2,-1)--(-1.75,-0.75)--(-1.5,-1) --(-1.5,-2)--(-1.1,-2)--(-1.1,0)--(-0.5,0)--(-0.5,-2) --(0,-2)--(0,-1.5)--(1,-1.5)--(1.25,-0.5)--(1.5,-1.5)--(1.5,-2) --(2,-2)--(2,0)--(2.5,0)--(2.5,-2) --(3,-2)--(3,-1)--(4,-1)--(4,-2)--(5,-2)--(5,-3)--cycle;
% moon- what a hack!
\filldraw[white] (4,2.5) arc (90:-90:20pt);
\filldraw[black] (3.8,2.5) arc (90:-90:20pt);
% fireworks
\pgfmathparse{100-(\radius-1)*10};
% red firework
\ifnum\radius<11
\draw[decorate,decoration={crosses},red!\pgfmathresult!black] (0,0) circle (\radius ex);
\fi
% orange firework
\pgfmathparse{100-(\radius-6)*10};
\ifnum\radius>5
\ifnum\radius<16
\draw[decorate,decoration={crosses},orange!\pgfmathresult!black] (1,1) circle ( \radius ex-5ex);
\fi
\fi
% yellow firework
\pgfmathparse{100-(\radius-11)*10};
\ifnum\radius>10
\draw[decorate,decoration={crosses},yellow!\pgfmathresult!black] (2.5,1) circle (\radius ex-10ex);
\fi
\end{tikzpicture}
}
\end{animateinline}
\end{frame}
\end{document}
Edit: The above code is obtained by copying the code of cmhughes (Here) into the code in the example (Here), but it does not work when compiling.