プレゼンテーションに最も簡単なアニメーションさえ含めることができない

プレゼンテーションに最も簡単なアニメーションさえ含めることができない

プレゼンテーションにアニメーションを組み込むことについて、少し迷っています。animationパッケージを使用しようとしましたが、希望する結果にはまったく近づきません。

私が作成したいアニメーションは非常にシンプルです。最初は完全に水平なシーソーです。次に下に移動します (シーソーの左側が右側よりも高くなります)。そして再び水平になります。これらは、プレゼンテーションでマウスをクリックしたときに発生する 3 つの動きです。

アニメーションの図解として、パワーポイントでシーソーの例を作成しました (たとえば、シーソーが動くとユーロがドルより高くなるはずです)。 これを正式な学術プレゼンテーションで使用したいので、レイアウトに関するヒントも大歓迎です。 シーソー債券利回りの例

答え1

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usepackage{eurosym}

\begin{document}
\begin{frame}
% for animations see beamer documentation page 135f (for version 3.33)
% what I have failed to find in the documentation
% is that the "counter" in \animatevalue may NOT be a LaTeX counter
% but must be TeX count
% regarding the difference see
% https://www.texdev.net/2009/11/17/tex-counts-and-latex-counters/
\newcount\angle
\animate<2-10,12-20>
%\transduration{0}
\newcommand{\maxangle}{-20}
\only<1-10>{\animatevalue<1-10>{\angle}{0}{\maxangle}}
\only<11-21>{\animatevalue<11-20>{\angle}{\maxangle}{0}}
\begin{center}
% https://tex.stackexchange.com/a/18201/120953
\pgfdeclarelayer{bg1}    % declare background layer
\pgfdeclarelayer{bg2}    % declare background layer
\pgfsetlayers{bg2,bg1,main}  % set the order of the layers (main is the standard layer)
\begin{tikzpicture}
    \tikzset{%
        my border style/.style = {
            draw=blue,
            line width=2pt,
        },
        my fill style/.style = {
            fill=blue!50,
        },
        mynodestyle/.style = {
            circle,
            my border style,
            fill,
            minimum size=3em,
            outer sep=0pt,
            transform shape,
        },
    }
    \begin{scope}[rotate=\the\angle]
        \node[mynodestyle, fill=blue!30!white] (euro) at (-2, 0) [above] {\%\euro};
        \node[mynodestyle, fill=red!30!white] (dollar) at (2, 0) [above] {\%\$};
        \begin{pgfonlayer}{bg1}
            \draw[my border style, my fill style] (euro.south) ++(0,5pt) rectangle (dollar.south);
        \end{pgfonlayer}
    \end{scope}
    \begin{scope}[yshift=5pt, scale=1.5]
        \path[my fill style, rounded corners=4pt] (0,0) -- (1,-1) -- (-1,-1) -- cycle;
        \begin{pgfonlayer}{bg2}
            % note how I am using twice the line width because half of the line is overdrawn by the filling
            % if you are very interested in this topic, take a look at this question: https://tex.stackexchange.com/q/29991/120953
            \path[my border style, rounded corners=4pt, line width=4pt,] (0,0) -- (1,-1) -- (-1,-1) -- cycle;
        \end{pgfonlayer}
    \end{scope}
    % ensure the tikzpicture has always the same height
    % by always drawing it (invisibly) for the extreme values additionally.
    % note that with draw=none the border would not be drawn
    % and therefore the picture would be 0.5\pgflinewidth smaller.
    \begin{scope}[rotate=\maxangle]
        \node[mynodestyle, fill=none, draw opacity=0] (euro) at (-2, 0) [above] {};
        \node[mynodestyle, fill=none, draw opacity=0] (dollar) at (2, 0) [above] {};
    \end{scope}
    \node[mynodestyle, fill=none, draw opacity=0] (euro) at (-2, 0) [above] {};
    \node[mynodestyle, fill=none, draw opacity=0] (dollar) at (2, 0) [above] {};
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}

ここに画像の説明を入力してください

evince では再生速度がかなり遅くなりますが、これはコードの問題ではなく、視聴者の問題だと思います。

あるいは、TikZを使用してgifを作成することもできます。こここれを で埋め込むと\movieビーマードキュメントセクション14.1アニメーション


OP のリクエストに応じて、 を使用した単一beamerフレームのアニメーションanimate。シーケンスの後半を表示するには、グラフィックスをもう一度クリックします。これには、A-Reader、Foxit、または PDF-XChange ビューアが必要です。

\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}
\usepackage{eurosym}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% command for printing the current BBox coordinates to the terminal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\newcommand\printBoundingBox{{%
    \pgfpointanchor{current bounding box}{south west}%
    \pgfmathparse{\pgf@x/\pgf@xx}%
    \xdef\llx{\pgfmathresult}%
    \pgfmathparse{\pgf@y/\pgf@yy}%
    \xdef\lly{\pgfmathresult}%
    \pgfpointanchor{current bounding box}{north east}%
    \pgfmathparse{\pgf@x/\pgf@xx}%
    \xdef\urx{\pgfmathresult}%
    \pgfmathparse{\pgf@y/\pgf@yy}%
    \xdef\ury{\pgfmathresult}%
    \typeout{+++BoundingBox: (\llx,\lly)\space(\urx,\ury)+++}
}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% see-saw ; graphic with parameter (angle)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\seesaw[1]{ %#1: angle
  \begin{tikzpicture}
      \useasboundingbox (-2.5843,-1.00703) rectangle (2.73778,1.89165);
      \tikzset{%
          mynodestyle/.style = {
              circle,
              draw=black,
              fill,
              minimum size=3em,
              transform shape,
          }
      }
      \begin{scope}[rotate=#1]
          \node[mynodestyle, fill=blue!.3!white] (euro) at (-2, 0) [above] {\%\euro};
          \node[mynodestyle, fill=red!.3!white] (dollar) at (2, 0) [above] {\%\$};
          \draw (euro.south) -- (dollar.south);
      \end{scope}
      \draw[] (0,0) -- (1,-1) -- (-1,-1) -- cycle;
      \node[mynodestyle, fill=none, draw=none] (euro) at (-2, 0) [above] {};
      \node[mynodestyle, fill=none, draw=none] (dollar) at (2, 0) [above] {};
      \printBoundingBox
  \end{tikzpicture}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
  \begin{center}
  \begin{animateinline}[controls]{12}
    \multiframe{21}{iAngle=0+-1}{ % 0, -1, ...,-20
      \seesaw{\iAngle}
    }
    \newframe* %Pause; click to continue
    \multiframe{20}{iAngle=-19+1}{ % -19, -18, ..., 0
      \seesaw{\iAngle}
    }
  \end{animateinline}
  \end{center}
\end{frame}  

\end{document}

ここに画像の説明を入力してください

関連情報