如何将多个动画放置在同一个投影仪框架中?

如何将多个动画放置在同一个投影仪框架中?

我制作了一张讲义,上面画了相同面积的平行四边形。

聚胞胞

\documentclass[]{article}
\usepackage[np]{numprint} 
\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}
\draw[dashed] (0,0)--(13,0);
\draw[dashed] (0,3)--(13,3);
\draw[<->,>={Latex}](.5,0)--(.5,3)node[midway,fill=white]{\numprint[cm]{3}};
\draw[fill=green!30] (4.5,0)--(5.5,3)--(9.5,3)--(8.5,0)--cycle ;% parallelo 1
\draw[<->,>={Latex}](4.5,-.3)--(8.5,-.3)node[midway,fill=white]{\numprint[cm]{4}};

\begin{scope}
\draw[dashed] (0,-4)--(13,-4);
\draw[dashed] (0,-1)--(13,-1);
\draw[<->,>={Latex}](.5,-4)--(.5,-1)node[midway,fill=white]{\numprint[cm]{3}};
\draw[fill=green!30] (8,-4)--(2,-1)--(6,-1)--(12,-4)--cycle;% parallelo 4
\draw[<->,>={Latex}](8,-4.3)--(12,-4.3)node[midway,fill=white]{\numprint[cm]{4}};
\end{scope}
\end{tikzpicture}
\end{document}

当学生们完成工作后,我想将相同的文档以幻灯片投影机的形式投影到黑板上,但该文档由以下两个动画组成,只需单击鼠标即可激活。

平行四边形

平行四边形

第一个动画:

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta,patterns}
\usepackage[np]{numprint}
\usepackage{animate}
\usepackage{fontawesome}
\begin{document}

\foreach \y  in {0,.2,...,3}{% découper le parallélogramme - images 1 - 16
    \begin{tikzpicture}
        \useasboundingbox (-6.5,-.5) rectangle (6.5,4);
        \draw[dashed] (-6.5,0)--(6.5,0);
        \draw[dashed] (-6.5,3)--(6.5,3);
        \draw[<->,>={Latex}](-6,0)--(-6,3)node[midway,fill=white]{\numprint[cm]{3}};
        \draw[<->,>={Latex}](-2,-.3)--(2,-.3)node[midway,fill=white]{\numprint[cm]{4}};     

        \fill[green!50](-2,0)--(-1,3)--(3,3)--(2,0)--cycle; 
        \fill[pattern=north east  lines,pattern color=blue!30](2,0)--(2,\y)--(2+\y/3,\y)--cycle;
        \draw[dashed](2,0)--(2,\y);
        \draw[dashed](2,0)--(2+\y/3,\y);
    \end{tikzpicture}
 }   

 \foreach \iangle in {2,4,...,180}{% déplacer le triangle
    \begin{tikzpicture}
        \fill[white] (-6.5,-.5) rectangle (6.5,4);
        \draw[dashed] (-6.5,0)--(6.5,0);
        \draw[dashed] (-6.5,3)--(6.5,3);
        \draw[<->,>={Latex}](-6,0)--(-6,3)node[midway,fill=white]{\numprint[cm]{3}};
        \draw[<->,>={Latex}](-2,-.3)--(2,-.3)node[midway,fill=white]{\numprint[cm]{4}}; 
        \fill[green!50](-2,0)--(-1,3)--(2,3)--(2,0)--cycle;
        \fill[green,opacity=.5] (\iangle:20mm and 8mm)--([shift={(0,3)}]\iangle:20mm and 8mm)--([shift={(1,3)}]\iangle:20mm and 8mm)--cycle;
        \draw[thin,dashed,pattern=north east  lines,pattern color=blue!30](2,3)--(2,0)--(3,3)--cycle;
        \draw[thin,dashed,pattern=north east  lines,pattern color=blue!30] (\iangle:20mm and 8mm)--([shift={(0,3)}]\iangle:20mm and 8mm)--([shift={(1,3)}]\iangle:20mm and 8mm)--cycle;
        \node at ([shift={(.4,1.5)}]\iangle:20mm and 8mm)[black]{\faHandPointerO};                      
     \end{tikzpicture}
    }
\end{document}

第二个动画:

\documentclass[tikz]{standalone}
\usepackage{animate}
\usepackage{pgf}
\usepackage{multido}
\usepackage{numprint}
\usetikzlibrary{patterns,decorations,arrows.meta}

\pgfdeclaredecoration{ignore}{final}{
    \state{final}{}
}

\pgfdeclaremetadecoration{start}{initial}{
    \state{initial}[width={0pt},next state=middle]{
        \decoration{moveto}
    }
    \state{middle}[width={\pgfmetadecoratedpathlength*\pgfdecorationsegmentlength},next state=final]{
        \decoration{lineto}
    }
    \state{final}{\decoration{ignore}}
}

\tikzset{
    start segment/.style={decoration={start,raise=1mm},decorate, segment length=#1},
}
\tikzset{every path/.style={>={Straight Barb[]}}}
\begin{document}
\def\couleur{white}

\begin{tikzpicture}% fond écran vert - triangles 1 et 2 - image 1
    \useasboundingbox (0,3.1) rectangle (13,-.5);
    \fill[green!40](2,3) rectangle (12,0);
    \draw[dashed] (0,0)--(13,0);
    \draw[dashed] (0,3)--(13,3);
    \draw[<->](.5,0)--(.5,3)node[midway,fill=white]{\numprint[cm]{3}};
    \draw[<->](8,-.3)--(12,-.3)node[midway,fill=white]{\numprint[cm]{4}};   
    \fill[\couleur] (12,0)--(12,3)--(6,3)--cycle;
    \fill[\couleur] (2,0)--(2,3)--(8,0)--cycle;
\end{tikzpicture}

\foreach \rpos  in {.02,.04,...,1}{% inscrire le parallélogramme dans un rectangle - images 2-51
            \begin{tikzpicture}
                \useasboundingbox (0,3.1) rectangle (13,-.5); 
                \fill[green!40](2,3) rectangle (12,0);
                \draw[dashed] (0,0)--(13,0);
                \draw[dashed] (0,3)--(13,3);
                \draw[<->](.5,0)--(.5,3)node[midway,fill=white]{\numprint[cm]{3}};
                \draw[<->](8,-.3)--(12,-.3)node[midway,fill=white]{\numprint[cm]{4}};   
                \fill[\couleur] (12,0)--(12,3)--(6,3)--cycle;
                \fill[\couleur] (2,0)--(2,3)--(8,0)--cycle;
                \draw[start segment=\rpos,blue,semithick] (2,3) -- (2,0) -- (12,0) -- (12,3) --cycle ;
            \end{tikzpicture} 
 } 

\foreach \rpos  in {.1,.2,...,3}{% colorer le triangle 2 progressivement - 30 images: 52-81
            \begin{tikzpicture}
                \useasboundingbox (0,3.1) rectangle (13,-.5); 
                \fill[green!40](2,3) rectangle (12,0);
                \draw[dashed] (0,0)--(13,0);
                \draw[dashed] (0,3)--(13,3);
                \draw[<->,](.5,0)--(.5,3)node[midway,fill=white]{\numprint[cm]{3}};
                \draw[<->](8,-.3)--(12,-.3)node[midway,fill=white]{\numprint[cm]{4}};   
                \fill[\couleur] (12,0)--(12,3)--(6,3)--cycle;
                \fill[\couleur] (2,0)--(2,3)--(8,0)--cycle;
                \draw[blue,thin] (2,3) -- (2,0) -- (12,0) -- (12,3) --cycle ;
                \draw[blue,thin] (2,3) -- (2+2*\rpos,3-\rpos);
                \fill[pattern color=blue,pattern=north east lines](2,3)--(2+2*\rpos,3-\rpos)--(2,3-\rpos)--cycle;
            \end{tikzpicture} 
 } 

\foreach \rpos  in {.1,.2,...,3}{% colorer le triangle 1 progressivement - 30 images: 82-111
            \begin{tikzpicture}
                \useasboundingbox (0,3.1) rectangle (13,-.5); 
                \fill[green!40](2,3) rectangle (12,0);
                \draw[dashed] (0,0)--(13,0);
                \draw[dashed] (0,3)--(13,3);
                \draw[<->](.5,0)--(.5,3)node[midway,fill=white]{\numprint[cm]{3}};
                \draw[<->](8,-.3)--(12,-.3)node[midway,fill=white]{\numprint[cm]{4}};   
                \fill[\couleur] (12,0)--(12,3)--(6,3)--cycle;
                \fill[\couleur] (2,0)--(2,3)--(8,0)--cycle;
                \draw[blue,thin] (2,3) -- (2,0) -- (12,0) -- (12,3) --cycle ;
                \draw[blue,thin] (2,3) -- (8,0);
                \fill[pattern color=blue,pattern=north east lines](2,3)--(8,0)--(2,0)--cycle;
                \draw[blue,thin] (12,0) -- (12-2*\rpos,\rpos);
                \fill[pattern color=blue,thin,pattern=north east lines](12,0)--(12,\rpos)--(12-2*\rpos,\rpos);
            \end{tikzpicture} 
 } 

\foreach \x in {11.95,11.9,...,8}{% translation du triangle 1 - 80 images: 112-191
    \begin{tikzpicture}
        \useasboundingbox (0,3.1) rectangle (13,-.5);
        \fill[green!40](2,3) rectangle (12,0);
        \draw[dashed] (0,0)--(13,0);
        \draw[dashed] (0,3)--(13,3);
        \draw[<->](.5,0)--(.5,3)node[midway,fill=white]{\numprint[cm]{3}};
        \draw[<->](8,-.3)--(12,-.3)node[midway,fill=white]{\numprint[cm]{4}};   
        \fill[\couleur] (2,0)--(2,3)--(8,0)--cycle;
        \draw[blue,thin] (2,3) -- (2,0) -- (12,0) -- (12,3) --cycle ;
        \draw[blue,thin] (2,3) -- (8,0);
        \fill[pattern color=blue,pattern=north east lines](2,3)--(8,0)--(2,0)--cycle;
        \draw[blue,thin,fill=white](\x,0)--(\x,3)--(\x-6,3)--cycle; 
        \fill[pattern color=blue,pattern=north east lines] (\x,0)--(\x,3)--(\x-6,3)--cycle; 
    \end{tikzpicture}
    }   
\end{document}

我尝试使用投影机的电影命令,但是不行。

\documentclass[aspectratio=1610]{beamer}
\usepackage{animate}
\usepackage{multimedia}
\usepackage{media9}

\begin{document}
\begin{frame}{Aire du parallélogramme}
\movie[]{}{para1.pdf}
%\includemedia[]{}{para1.pdf}

\movie[]{}{para4.pdf}
%\includemedia[]{}{para4.pdf}
\end{frame}
\end{document}
  • 是否可以将两个动画放在同一个投影仪框架中?
  • 如果是,怎么办?
  • 我是否应该更改动画的格式:gif,swf,mp4,...而不是pdf?

答案1

一帧内两个动画。按钮用于同时播放控制。的 JavaScript 接口animate用于定义按钮操作。

可以通过直接单击来单独播放动画。

在此处输入图片描述

\documentclass{beamer}
\usepackage{animate}
\usepackage{media9} %\mediabutton
\usepackage{fontawesome}

\begin{document}

\begin{frame}[t]{Two animations}
\animategraphics[label=anim1,width=\linewidth]{12}{para1}{}{}\\[1ex]
\animategraphics[label=anim2,width=\linewidth]{12}{para4}{}{}

\mediabutton[
  jsaction={anim.anim1.stopFirst();anim.anim2.stopFirst();}
]{\fbox{\faStop}}
\mediabutton[
  jsaction={anim.anim1.pause();anim.anim2.pause();}
]{\fbox{\faPause}}
\mediabutton[
  jsaction={anim.anim1.playFwd();anim.anim2.playFwd();}
]{\fbox{\faPlay}}
\end{frame}

\end{document}

答案2

我一定是累了(热浪?)因为完全可以通过这种方式插入使用包\animategraphics中的命令创建的两个动画:animate

\documentclass[aspectratio=1610]{beamer} % Présentation générale et mise en page
\usepackage{animate}

\begin{document}
\begin{frame}{Aire du parallélogramme}
\animategraphics[]{24}{para1image}{}{}

\animategraphics[]{24}{para4image}{}{}
\end{frame}
\end{document}

我感谢 marmot 和 AlexG 提出的新曲目,这将使我能够构思出更加漂亮的动画。

相关内容