我正在使用光束,我试图自动动画一个图形构建在一个单一的框架与tikzpicture。我想做一个循环,其中visible on=<1>和visible on=<2> 的行不需要单击就会自动显示,并且一个接一个地显示 (<1>,<2>,然后是<1>,然后是<2> .无限循环)。
这是我的Latex代码:
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usetheme{Madrid}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{animate}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}[auto]
\draw(-2.7,1.5) node[sloped,above] {Start A};
\draw[->,thick] (-2,0.5) -- node[below] {T} (4,0.5) ;
\draw[visible on=<1>,gray1,-,thick,dashed] (-1.7,1.7) -- (3.7,1.7);
\draw[visible on=<1>] (1,1.8) node[sloped,above] {text};
\draw[visible on=<2>,gray1,-,thick,dashed] (-1.7,1.7) -- (-0.3,1.7);
\draw[visible on=<2>,gray1,-,thick,dashed] (2.3,1.7) -- (3.7,1.7);
\draw[visible on=<2>](3,2.5) node[sloped,above] {text};
\draw[visible on=<2>](1,1.68) node[sloped,above] {Point};
\draw[visible on=<2>](1,1.18) node[sloped,above] {C};
\draw(4.7,1.90) node[sloped,above] {Point};
\draw(4.7,1.45) node[sloped,above] {B};
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}这给了我以下两张没有自动动画的幻灯片:

我寻找我的问题的答案,并找到了这个answer。
我在序言中添加了以下命令\usetikzlibrary{shapes,arrows, positioning, calc} \usetikzlibrary{overlay-beamer-styles},但它没有解决我的问题。
\setbeamercovered{dynamic}
\usetikzlibrary{shapes,arrows, positioning, calc}
\usetikzlibrary{overlay-beamer-styles}您对创建这个动画循环有什么建议吗?
发布于 2021-06-03 16:01:18
您可以使用\transduration{<number of seconds>}自动切换之间的转换,而不需要点击(需要一个pdf查看器,支持转换,例如,在表示模式下的adobe阅读器)。
\documentclass{beamer}
\usetheme{Madrid}
\usepackage{tikz}
\usetikzlibrary{positioning}
\setbeamercovered{dynamic}
\usetikzlibrary{shapes,arrows, positioning, calc}
\usetikzlibrary{overlay-beamer-styles}
\begin{document}
\newcommand{\myani}{1-}
\begin{frame}[label=foo]
\transduration<\myani>{1}
\begin{center}
\begin{tikzpicture}[auto]
\draw(-2.7,1.5) node[sloped,above] {Start A};
\draw[->,thick] (-2,0.5) -- node[below] {T} (4,0.5) ;
\draw[visible on=<1>,gray,-,thick,dashed] (-1.7,1.7) -- (3.7,1.7);
\draw[visible on=<1>] (1,1.8) node[sloped,above] {text};
\draw[visible on=<2>,gray,-,thick,dashed] (-1.7,1.7) -- (-0.3,1.7);
\draw[visible on=<2>,gray,-,thick,dashed] (2.3,1.7) -- (3.7,1.7);
\draw[visible on=<2>](3,2.5) node[sloped,above] {text};
\draw[visible on=<2>](1,1.68) node[sloped,above] {Point};
\draw[visible on=<2>](1,1.18) node[sloped,above] {C};
\draw(4.7,1.90) node[sloped,above] {Point};
\draw(4.7,1.45) node[sloped,above] {B};
\end{tikzpicture}
\end{center}
\end{frame}
\foreach \x in {0,...,10}{
\againframe{foo}
}
\renewcommand{\myani}{1}
\againframe{foo}
\begin{frame}
content
\end{frame}
\end{document}

https://stackoverflow.com/questions/67824609
复制相似问题