Moving a point along a "multi-node path"

Use decorations.markings and the overlay option. The overlay option pretends that the object has zero size and therefore doesn't add to the bounding box. Because the nodes are now going outside the bounding box of the path, you have to add a border around the drawing so it doesn't fall off the page.

\documentclass[tikz,border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}

\foreach \n in {0,0.05,...,1} {
    \begin{tikzpicture}
    \draw
        [postaction=decorate,
         decoration={
            markings,
            mark=at position \n with {
                \draw [overlay, draw=black, fill=red] circle (2pt);
                \node [overlay, above] {x};
            }
         }]
        (0,0)   -- ++ (1,2)
                -- ++ (1,.5)
                -- ++ (1,-1)
                -- ++ (1,0)
                -- ++ (1,-4);
    \end{tikzpicture}
}

\end{document}

enter image description here


Very similar to Henri Menke's great answer with a small tilt: the bounding box gets recorded and the maximal bounding box of all iterations gets applied. You need to compile twice that it works. The code is more complex but the bounding box gets only increased in the directions in which it is needed. This code is somewhat similar to this nice answer which addresses a similar problem.

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings,calc}
\begin{document}
\pgfmathsetmacro{\xmin}{0}
\pgfmathsetmacro{\xmax}{0}
\pgfmathsetmacro{\ymin}{0}
\pgfmathsetmacro{\ymax}{0}
\foreach \X in {0,0.05,...,1} {
    \begin{tikzpicture}
    \ifdefined\figbb\relax
    \path \figbb;
    \fi
    \draw
        [postaction=decorate,
         decoration={
            markings,
            mark=at position \X with {
                \node [circle,inner sep=2pt,draw,fill=red,label=above:$x$]{};
            }
         }]
        (0,0)   -- ++ (1,2)
                -- ++ (1,.5)
                -- ++ (1,-1)
                -- ++ (1,0)
                -- ++ (1,-4);
    \path let \p1=(current bounding box.south west),
    \p2=(current bounding box.north east)
    in \pgfextra{%
    \pgfmathsetmacro{\xmin}{min(\x1,\xmin)}
    \pgfmathsetmacro{\xmax}{max(\x2,\xmax)}
    \pgfmathsetmacro{\ymin}{min(\y1,\ymin)}
    \pgfmathsetmacro{\ymax}{max(\y2,\ymax)}
    \xdef\xmin{\xmin pt}
    \xdef\xmax{\xmax pt}    
    \xdef\ymin{\ymin pt}
    \xdef\ymax{\ymax pt}    
    };
    \end{tikzpicture}
}
\makeatletter               
\edef\figbb{(\xmin,\ymin) rectangle (\xmax,\ymax)}
\immediate\write\@mainaux{\xdef\string\figbb{\figbb}\relax}
\makeatother
\end{document}

enter image description here