Animateinline 无法与 \setbeamertemplate{} 配合使用

Animateinline 无法与 \setbeamertemplate{} 配合使用

我正在尝试使用 自定义我的标题页\setbeamertemplate{title page}{}。我想向标题页添加动画,我也在使用\begin{animateinline}。下面给出了示例代码:

\setbeamertemplate{title page}
\begin{animateinline}[autoplay, loop, begin={\begin{tikzpicture}\useasboundingbox (0,0) rectangle (7,7);}, end={\end{tikzpicture}}]{6}
\multiframe{10}{i=1+1}{
\begin{tikzpicture}
\newframe
\node[anchor=south west]
at (0,-4) (anime)
{\includegraphics[trim = 15mm 10mm 10mm 10mm,clip,width=0.5\textwidth]{image-\i}};
}
\end{animateinline}
}

\begin{document}
\maketitle
\end{documnet}

然而,当我编译时,

! Package animate Error: Contents of first frame must not have zero width.

正在显示。我应该更改什么?

提前致谢 :)

毗湿奴。

编辑:MWE:

\documentclass{beamer}

\mode<presentation> {
\usetheme{Marburg}
\usecolortheme{beaver}
\setbeamertemplate{navigation symbols}{} % To remove the navigation symbols from the bottom of all slides uncomment this line
}
\usepackage{tikz}
\usepackage[backend=bibtex,style=numeric]{biblatex} 
\addbibresource{ref.bib}
\renewcommand*{\bibfont}{\footnotesize}
\usepackage{patchcmd}
\usepackage{textpos}
\usepackage{etoolbox}
\usepackage{graphicx} % Allows including images
\graphicspath{ {../figs/} {../figs/GIF/}}
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage{soul}
\setul{1ex}{}
\usepackage{array} % needed for \arraybackslash
\usepackage{adjustbox}
\usepackage{protecteddef}
\usepackage{fixltx2e}
\usepackage{multimedia}
\usepackage{media9}
\usepackage{tikz}
\usepackage{animate}
\usepackage{pdfrender}
\usepackage{ragged2e}
\usepackage{pgfplots}
\RaggedRight

\setbeamertemplate{footnote}{%
  \tiny%
  \parindent 1em\noindent%
  \raggedright
  \hbox to 1.8em{\hfil\insertfootnotemark}\insertfootnotetext\par%
}%
\setlength\footnotesep{0pt}

\definecolor{myBlue}{RGB}{150,155,158}
\definecolor{myGrey}{RGB}{80,80,80}
\definecolor{miGrey}{RGB}{200,200,200}
\makeatletter
\setbeamertemplate{sidebar canvas right}[vertical shading][top=myGrey,bottom=myBlue]
\setbeamercolor{title in sidebar}{fg=white}
\setbeamerfont{title in sidebar}{series=\bfseries}
\setbeamerfont{author in sidebar}{series=\bfseries,size=\fontsize{6}{20}\selectfont}
\setbeamercolor{author in sidebar}{fg=white}
\setbeamercolor{section in sidebar shaded}{fg=miGrey}
 \setbeamertemplate{section in sidebar}%{sidebar theme}
{%
  \vbox{%
    \vskip1ex%
    {\tikz{\node[fill=black!80,text=white,text width={\beamer@sidebarwidth}]{\insertsectionheadnumber
    ~\insertsectionhead};}}
    %
  }%
}
\setbeamertemplate{subsection in sidebar}%{sidebar theme}
{%
  \vbox{%
  \hsize=\beamer@sidebarwidth %
    \vskip1ex%
    {\tikz{\node[fill=black!80,text=white,text width={\beamer@sidebarwidth}]{\insertsubsectionhead};}}
   % 
  }%
}
%\setbeamertemplate{section in sidebar}{\tikz{\node[fill=black!80,text=white]{\insertsectionhead};}}

\setbeamertemplate{section in sidebar shaded}%{sidebar theme}
{%
  \vbox{%
    \vskip1ex%
    \beamer@sidebarformat{3pt}{section in sidebar shaded}{\insertsectionheadnumber
~\insertsectionhead}%
  }%
}
\addtobeamertemplate{frametitle}{}{%
    \begin{textblock*}{100mm}(\textwidth,-1cm)
        \hspace{-0.5cm}\includegraphics[height=1cm,width=1cm]{iitm_logo}
    \end{textblock*}}
\patchcmd{\insertverticalnavigation}%
{\ifx\beamer@nav@css\beamer@hidetext{\usebeamertemplate{section in sidebar}}\else{\usebeamertemplate{section in sidebar shaded}}\fi}%
{{\usebeamertemplate{section in sidebar}}}{}{}
\makeatother
%\insertframenumber/\inserttotalframenumber
\addtobeamertemplate{footline}{}{%
\makebox[\paperwidth]{%
    \hspace{0.85\textwidth}\raisebox{3ex}[0pt][0pt]{\insertframenumber/\inserttotalframenumber}%
}%
}
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{bibliography item}[text]
\renewcommand*{\bibfont}{\footnotesize}

%\makeatletter
%\let\zeropad\@anim@pad
%\makeatother

\usetikzlibrary{shapes,arrows}
\setbeamerfont{author}{size=\normalsize}
\setbeamerfont{institute}{size=\normalsize\itshape}
\setbeamerfont{title}{size=\fontsize{30}{36}\bfseries}
\setbeamerfont{subtitle}{size=\normalsize\normalfont\slshape}

\setbeamertemplate{title page}{%
\begin{animateinline}[autoplay, loop, begin={\begin{tikzpicture}\useasboundingbox (0,0) rectangle (7,7);}, end={\end{tikzpicture}}]{6}
   \multiframe{10}{i=1+1}{
\begin{tikzpicture}
\newframe
\node[anchor=south west] 
  at (0,-4) (anime)
%  {\animategraphics[autoplay,loop,width=0.5\textwidth]{6}{md-angles-}{0}{17} };
%  {\includegraphics[height=0.7\textheight]{md-sooraj-4}};
%{ \movie[width=.5\textwidth,showcontrols=false,loop,autostart]{\includegraphics[width=0.5\textwidth]{iitm_logo}}{atest.mp4}};
{\includegraphics[trim = 15mm 10mm 10mm 10mm,clip,width=0.5\textwidth]{md-angles-\i}};

\node[anchor=south east] 
  at (30,-6) (background)
  {\includegraphics[height=1.5\textheight]{test}};
\node[anchor=east] 
  at ([yshift=-50pt]current page.north east) (author)
  {\parbox[t]{.6\paperwidth}{\raggedleft%
    \usebeamerfont{author}\textcolor{white}{%
    \textpdfrender{
    TextRenderingMode=FillStroke,
    FillColor=orange,
    LineWidth=.1ex,
    }{\insertauthor}}}};
\node[anchor=north east] 
  at ([yshift=-70pt]current page.north east) (institute)
  {\parbox[t]{.78\paperwidth}{\raggedleft%
    \usebeamerfont{institute}\textcolor{gray}{\insertinstitute}}};
\node[anchor=east]
  at ([yshift=-10pt,xshift=-20pt]current page.east) (title)
  {\parbox[t]{\textwidth}{\raggedleft%
 \usebeamerfont{author}\textcolor{white}{%
    \textpdfrender{
    TextRenderingMode=FillStroke,
    FillColor=white,
    LineWidth=.1ex,
    }{\inserttitle}}}};
\node[anchor=east]
  at ([yshift=-60pt,xshift=-20pt]current page.east) (subtitle)
  {\parbox[t]{.6\paperwidth}{\raggedleft\usebeamerfont{subtitle}\textcolor{white}{\insertsubtitle}}};
\end{tikzpicture}
}
\end{animateinline}
}
\subtitle{Potential of Nanomembranes to desalinate water}
\titlegraphic{\includegraphics[width=3cm]{iitm_logo}}
%----------------------------------------------------------------------------------------
%   TITLE PAGE
%----------------------------------------------------------------------------------------

\title[My Short Titl]{My Long Title} 
\titlegraphic{\includegraphics[width=3cm]{logo}%  
}
\author[{Vishnu}]{Vishnu } 
\institute[My Institute] 
{
Designation \\ 
}
\date{}
\begin{document}

\begin{frame}[plain]
\advance\textwidth2cm
\hsize\textwidth
\columnwidth\textwidth
\titlepage
\end{frame}

\begin{frame}
\frametitle{Overview}
\tableofcontents 
\end{frame}

\section{Introduction} 

\begin{frame}
\frametitle{Intro}
        \begin{itemize}
            \setlength\itemsep{2em}         
            \item Item 1
            \item Item 2
            \end{itemize}   
    \end{frame}

    \end{document} 

答案1

您不应该嵌套tikz图片。

\documentclass{beamer}

\usepackage{tikz}
\usepackage{animate}

\setbeamertemplate{title page}{%
\begin{animateinline}[autoplay, loop, begin={\begin{tikzpicture}\useasboundingbox (0,0) rectangle (7,7);}, end={\end{tikzpicture}}]{6}
   \multiframe{10}{i=1+1}{
%\begin{tikzpicture}
            \newframe
            \node[anchor=south west] at (0,0) (anime) {%
                \includegraphics[width=0.5\textwidth]{example-image}
            };
%\end{tikzpicture}
}
\end{animateinline}
}

\begin{document}

\begin{frame}
\titlepage
\end{frame}


\end{document} 

相关内容