I have to position different figures in exact overlapping positions where each figure is on a different frame. Besides figures, there is some text too with each figure and therefore this answer does not work because there is text too.
The problem is that the figures do not position correctly if the text exists. Like in the following MWE the sixth frame has some text "hello" and due to this the position of B offsets from all other perfectly overlapping figures.
I guess there needs to be some absolute positioning required to position the sixth figure correctly but I do not know how to capture the position coordinates of the figure just before it in order to define the position of the displaced figure. Sorry, I am a novice in the beautiful world of TeX. :)
Any leads would be helpful. Thank you.
\documentclass{beamer}
\usepackage{tikz}
\usepackage{capt-of}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}
\node<1> (img1) {\includegraphics[width=.5\linewidth]{example-image-a}};
\node<2> (img2) {\includegraphics[width=.5\linewidth]{example-image-b}};
\node<3> (img3) {\includegraphics[width=.5\linewidth]{example-image-c}};
\end{tikzpicture}
\end{center}
\end{frame}
\begin{frame}
\begin{center}
\begin{tikzpicture}
\node<1> (img1) {\includegraphics[width=.5\linewidth]{example-image-a}};
% \node<2> (img2) {\includegraphics[width=.5\linewidth]{example-image-b}};
% \node<3> (img3) {\includegraphics[width=.5\linewidth]{example-image-c}};
\end{tikzpicture}
\end{center}
\end{frame}
\begin{frame}
hello
\begin{center}
\begin{tikzpicture}
% \node<1> (img1) {\includegraphics[width=.5\linewidth]{example-image-a}};
\node<1> (img2) {\includegraphics[width=.5\linewidth]{example-image-b}};
% \node<3> (img3) {\includegraphics[width=.5\linewidth]{example-image-c}};
\end{tikzpicture}
\captionof{figure}{A caption.}
\end{center}
\end{frame}
\begin{frame}
\begin{center}
\begin{tikzpicture}
% \node<1> (img1) {\includegraphics[width=.5\linewidth]{example-image-a}};
% \node<2> (img2) {\includegraphics[width=.5\linewidth]{example-image-b}};
\node<1> (img3) {\includegraphics[width=.5\linewidth]{example-image-c}};
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}


\begin{center}hello\end{center}. – Tom Jun 08 '22 at 05:06