4

I am trying to create an animation that gives a visual notion of a perpetual forward motion in time. What I would like to create is:

  1. An arrow starts moving towards the right of the x axis.
  2. Below the x axis, the time tick values are shown, lets say from 1 to 10.
  3. The arrow grows in length from 1 to 10.
  4. After it reaches the length of 10 in its x coordinate, the labels (x axis) keep on incrementing, but the arrow length doesn't need to change (thus remain 10 units).

I am new to TikZ/beamer, I tried various approaches, but could not get much close to the desired goal. What I have currently is something like this:

\documentclass{beamer}
\usepackage{color}
\usepackage{tikz}
\usepackage{hyperref}
\usepackage{animate}
\usetheme{Warsaw}
\usecolortheme{whale}
\begin{frame}{Progress in Time}
\begin{animateinline}[
 begin={ % header of each frame
 \begin{tikzpicture}
 [line width=1pt]
 \path[clip] (0,-3) rectangle (11,6);
 },
 end={\end{tikzpicture}},autoplay]{3}
 \multiframe{10}{iCount=1+1}{
 \node (s) at (1,0.5) [] [label=below:$\iCount$] {};
 \node (r) at (8,0.5) [] {};
 \pgfmathsetmacro{\sup}{\iCount + 1}
 \pgfmathsetmacro{\incr}{\iCount/10}
 \node at (3,0.5) [] [label=below:$\sup$] {};
 \path (s) -- (r) node[pos=\incr,coordinate] (p) {};
 \draw[->] (s) -- (p);

 } % end of multiframe
\end{animateinline}
\end{frame}
4

Code (animate)

\documentclass{beamer}
\usepackage{tikz,animate}
\usetheme{Warsaw} \usecolortheme{whale}
\begin{document}
\begin{frame}{Progress in Time}
\begin{animateinline}[
  begin={%
    \tikzpicture[line width=1pt]
    \node[below] at (10,0) {\phantom{00}};
    \coordinate (start) at (0,0) ++ (up:.25cm);
  },
  end=\endtikzpicture,
  autoplay,
  palindrome
] {1}
  \multiframe{20}{iCount=1+1}{
    \draw[->] (start) -- ({ifthenelse(\iCount<10,\iCount,10)},0)
       coordinate (target)
       node[below] {\iCount};
    \foreach \cnt[evaluate={\Pos={\cnt/\iCount}}] in {0,...,\the\numexpr\iCount-1\relax}{
      \path (start) -- (target) node[below, pos=\Pos] (@) {\cnt};
      \draw (@.north) + (up:2pt) -- + (down:2pt);
    }
  }
\end{animateinline}
\end{frame}
\end{document}

Code (convert)

\documentclass{beamer}
\usepackage{tikz}
\usetheme{Warsaw} \usecolortheme{whale}
\begin{document}
\foreach \iCount in {1,...,20,19,18,...,2}{%
\begin{frame}{Progress in Time}
\tikzpicture[line width=1pt]
  \node[below] at (10,0) {\phantom{00}};
  \coordinate (start) at (0,0) ++ (up:.25cm);
  \draw[->] (start) -- ({ifthenelse(\iCount<10,\iCount,10)},0)
     coordinate (target)
     node[below] {\iCount};
  \foreach \cnt[evaluate={\Pos={\cnt/\iCount}}] in {0,...,\the\numexpr\iCount-1\relax}{
    \path (start) -- (target) node[below, pos=\Pos] (@) {\cnt};
    \draw (@.north) + (up:2pt) -- + (down:2pt);
  }
\endtikzpicture
\end{frame}
}
\end{document}

Output

enter image description here

| improve this answer | |
  • Thanks @Qrrbrbirlbel. That is the perfect solution. Thanks a lot! – Bonkers Sep 21 '13 at 18:57

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.