I was trying to create an animation to illustrate a simple 2D convolution using tikz and the animate package. I tried the code below but I am getting the following errors:
- Package animate Error: Contents of first frame must not have zero width.
- Package animate Error: Contents of first frame must not have zero height.
- pdfTeX error (ext1): \pdfxform cannot be used with a void box.
I checked the package manual and StackExchange and some other on-line sites but could not find and explanation why there are these errors. Has it to do with the \foreach loops? I managed to create the animation with \multiframe but I cannot control the 2 variables independently and the animation follows a diagonal direction instead of the convolution sequence required. From my previous experience, I suspect of some dumbness in my approach, and I count on this excellent community to help me! Thanks in advance for all help.
\documentclass{article}
\usepackage{tikz}
\usepackage{animate}
\begin{document}
\begin{animateinline}[poster=first, controls] {20}
\foreach \Ry in {9,8,...,0}
{
\foreach \Rx in {0,1,...,9}
{
\begin{tikzpicture} [scale=1]
\useasboundingbox (0,0) rectangle (10,10);
\fill [gray!60] (0,0) rectangle (10,10);
\fill [red!50] (\Rx,\Ry) rectangle ++(1,1);
\end{tikzpicture}
\newframe%
}
}
\end{animateinline}
\end{document}
