Okay, so I have tried to go over this package: http://mirror.its.dal.ca/ctan/macros/latex/contrib/animate/animate.pdf

And I'm having a hard time trying to understand it. So right now, I just tried to start off simple to basically self-teach myself how to animate a ball that rolls from one end of the line to the other.

I'll present my drawing code for the line and ball:




    \filldraw[very thick, fill=red!50] (0,0) circle [radius=10cm];
    \draw (-10,-10) -- (110,-10);

All I want to do is translate the circle from (0,0) to (100,0). Just trying to figure out how to do something as simple as that seems rather difficult from the animate package.

Basically, I have two questions, in a way:

  • Is there a nice simple code for something like this?

  • Are there some really simple examples on this package or some nicer and simpler documentation?


All you need to do is to parameterize the x-position of the ball, put a loop around the tikzpicture and place everything into an animateinline environment:




\begin{animateinline}[controls]{30} % 30 frames per second
  \multiframe{101}{iPosition=0+1}{ % iPosition=0...100
      \filldraw[very thick, fill=red!50] (\iPosition,0) circle [radius=10];
      \draw (-10,-10) -- (110,-10);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.