samcarter
I would like to place an image along a tikz path in such a way that it rotates with the loops of the path, e.g. in the example below the duck should be head down when flying though the looping.
MWE without rotation:
```
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings}
\setbeamertemplate{background}{%
\begin{tikzpicture}[
remember picture,
overlay,
decoration={
markings,
mark=at position \thepage/10 with {
\node{\includegraphics[width=2cm]{example-image-duck}};
}
}
]
\path[postaction=decorate,draw] (-0.0024, -0.846) .. controls (2.9731, -2.564) and (4.9397, -0.8115) .. (4.9397, -4.2473) .. controls (4.9397, -8.2498) and (-2.9933, -2.7915) .. (0.9993, -3.0728) .. controls (10.1424, -3.7168) and (9.4455, -9.435) .. (6.1477, -7.1566) .. controls (3.4609, -5.3004) and (10.1189, 2.4134) .. (13.8065, -10.4522);
\end{tikzpicture}%
}
\begin{document}
\begin{frame}
\pause[10]
\end{frame}
\end{document}
```
![document.gif](/image?hash=d01d5d4b1d22a5a09778078d947b40623bbd369dec6e18166da806f590ee9944)
Top Answer
user 3.14159
Of course. You should just ask the authors of the Christmas Exravaganza. ;-)
```
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings}
\setbeamertemplate{background}{%
\begin{tikzpicture}[
remember picture,
overlay,
decoration={
markings,
mark=at position \thepage/10 with {
\path (-0.1cm,0) coordinate (aux0) (0.1cm,0) coordinate(aux1)
(0,0) coordinate(aux2);
\pgftransformreset
\path let \p1=($(aux1)-(aux0)$), \n1={atan2(\y1,\x1)} in
(aux2) node[rotate=\n1]{\includegraphics[width=2cm]{example-image-duck}};
}
}
]
\path[postaction=decorate,draw] (-0.0024, -0.846) .. controls (2.9731, -2.564) and (4.9397, -0.8115) .. (4.9397, -4.2473) .. controls (4.9397, -8.2498) and (-2.9933, -2.7915) .. (0.9993, -3.0728) .. controls (10.1424, -3.7168) and (9.4455, -9.435) .. (6.1477, -7.1566) .. controls (3.4609, -5.3004) and (10.1189, 2.4134) .. (13.8065, -10.4522);
\end{tikzpicture}%
}
\begin{document}
\begin{frame}
\pause[10]
\end{frame}
\end{document}
```
![ani.gif](/image?hash=1d06a2ee1dfee9358e3dc25eefef06c9156974ae12f8dd1e4820a650dd5cce84)