I would like to make an animation using beamer. A picture should replace another during the transition. I have a problem that the text will move its position during this animation. I have tried \only and \onslide but the question is not solved.
\begin{frame}{}
\onslide<1->{some text }
\onlide<1>{
\begin{figure}[H]
\centering
\includegraphics[width=4in]{Figures/fig1.pdf}
\label{fig2}
\end{figure}
}
\onslide<2->{
\begin{figure}[H]
\centering
\includegraphics[,width=4in]{Figures/fig2.pdf}
\label{fig2}
\end{figure}
}
\end{frame}
The position of "some text" moves during animation.
your code has many unprotected line endings (missing % at the end of lines) that act like a space
onlide should be onslide
\onslide<> makes the content just invisible, but still reserves space. You want to use \only instead
floating specifier such as [H] don't make sense in a documentclass without floating mechanism
\centering is unnecessary, beamer figures are centred by default
you must not use the same lable multiple times
\includeggraphics is overlay aware, just use that and avoid all the other pitfalls:
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{figure}
\includegraphics<+>[width=4in]{example-image}
\includegraphics<+>[width=4in]{example-image-duck}
\end{figure}
\end{frame}
\end{document}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With