带有叠加图片的动画包

带有叠加图片的动画包

我想生成动画 PDF,其中一个图像用作背景,动画部分在上层发生变化。这可以用动画包裹?

灵感:法拉第马达

MNWE:

\documentclass{article}
\usepackage{animate}
\usepackage{tikz} 

\begin{document}
  \begin{animateinline}
    \includegraphics[width=\textwidth]{example-image-a}  % Backgroung image
    \animategraphics[controls,autoplay,loop]{18}{stick_}{0}{59}
  \end{animateinline}
\end{document}

答案1

animateinline\animategraphics不能嵌套。

使用钛Z 节点对齐图像部分:

\documentclass[varwidth]{standalone}

\usepackage{tikz}
\usepackage{graphicx}
\usepackage{animate}

\begin{document}
\begin{animateinline}[controls,loop,scale=0.3]{25}
\multiframe{60}{i=0+1}{
  \begin{tikzpicture}[inner sep=0,outer sep=0]
    \node at (0,0) {\includegraphics{down}};
    \ifthenelse{\i<15 \OR \i>45}{
      % stick in front of magnet
      \node at (-2,0.4) {\includegraphics{magnet}};
      \node at (-2,4.05) {\includegraphics{stick-\i}};
    }{
      % stick behind magnet
      \node at (-2,4.05) {\includegraphics{stick-\i}};
      \node at (-2,0.4) {\includegraphics{magnet}};
    }
  \end{tikzpicture}
}
\end{animateinline}\\[1ex]
\small Images: \textcopyright\ National High Magnetic Field Laboratory
\end{document}


原始示例的图像已使用此 shell 脚本下载并重命名:

#!/bin/bash
for i in {0..59}
do
    wget https://nationalmaglab.org/html5/MagLabU/source/faradaymotor/images/stickFrames/stick%20\($i\).png
    mv stick\ \($i\).png stick-$i.png
done
wget https://nationalmaglab.org/html5/MagLabU/source/faradaymotor/images/down.png
wget https://nationalmaglab.org/html5/MagLabU/source/faradaymotor/images/magnet.png

相关内容