I want to achieve a simple "fly-in"-animation with LaTeX by utilizing the animate-package. My idea was to insert an \hspace with decreasing length-argument. However, there is no animation at all.

MWE (adapted from http://texample.net/tikz/examples/animated-definite-integral/):


\usepackage{animate, ifthen}



            \whiledo{\them < 21} {  % Execute 21 times
                \hspace{\dummy} Hello.
                \addtolength{\dummy}{-.4cm} % Decrease \dummy
                \ifthenelse{\them < 21} {
                    \newframe % Create new frame, if condition satisfied
                    \end{animateinline}\relax % Otherwise end environment

Maybe i should just use TikZ to modify coordinates/parameters like this, but i initially thought, this should work and would be a more minimal way to achieve my goals.

Why isn't this working? What would be a better approach if mine was wrong?

1 Answer 1


Using \whiledo for building loops around parameterized animation frames is deprecated. It may lead to unexpected results, because \newframe embedded into its loop body may hide local assignments of dimensions and counters.

Instead, use pkg animate's built-in command \multiframe:



  \begin{frame}{Fly-in example}

enter image description here

  • Thank you very much! That's what i hoped to achieve. Also thanks for the pointer of \whiledo being deprecated. I didn't know that!
    – Tim Hilt
    Feb 10, 2020 at 11:45
  • @Tim I added a bit of explanation.
    – AlexG
    Feb 10, 2020 at 12:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .