我尝试找出错误但是我......
\documentclass[presentation]{beamer}
\usetheme{Madrid}
\usepackage[utf8]{inputenc}
\usepackage{tikz}\usetikzlibrary{calc}
\usetikzlibrary{decorations.text, decorations.pathmorphing}
\usepackage{animate}
\begin{document}
\begin{frame}
\newcounter{goc}
\setcounter{goc}{0}
\begin{animateinline}[auto,loop]{20}
\whiledo{\thegoc<50}
{\begin{tikzpicture}[join=round,\bfseries]
\pgfmathsetmacro{\g}{2.5-abs(2.5-0.1*\thegoc)}
\clip(-8,-2.5)rectangle (8,2.5);
\path(0,1)node[red,scale=2,yscale=\g]{SỬ DỤNG ANIMATE};
\path(0,0)node[green,scale=2,yscale=\g]{TẠO HÌNH ĐỘNG};
\end{tikzpicture}
\stepcounter{goc}
\ifthenelse{\thegoc<50}{\newframe}{\end{animateinline}}
}
\end{frame}
\end{document}
答案1
几个问题:
不要用于
\whiledo
围绕参数化动画帧构建循环\bfseries
-->font=\bfseries
auto
-->autoplay
\documentclass[presentation]{beamer}
\usetheme{Madrid}
\usepackage[utf8]{inputenc}
\usepackage[T5]{fontenc}
\usepackage{tikz}\usetikzlibrary{calc}
\usetikzlibrary{decorations.text, decorations.pathmorphing}
\usepackage{animate}
\begin{document}
\begin{frame}
\begin{animateinline}[autoplay,loop]{20}
\multiframe{50}{i=0+1}{
\begin{tikzpicture}[join=round,font=\bfseries]
\pgfmathsetmacro{\g}{2.5-abs(2.5-0.1*\i)}
\useasboundingbox(-4,-1)rectangle (4,2);
\path(0,1)node[red,xscale=2,yscale=\g]{SỬ DỤNG ANIMATE};
\path(0,0)node[green,xscale=2,yscale=\g]{TẠO HÌNH ĐỘNG};
\end{tikzpicture}
}
\end{animateinline}
\end{frame}
\end{document}
答案2
- 似乎环境实例的结尾
animateinline
是以一种特殊的方式检测到的,其中需要“直接”找到短语\end{animateinline}
,即,不需要扩展形成环境实例“主体”的东西。 - -environment
tikzpicture
的可选参数没有键\bfseries
。 - 的
animateinline
可选参数没有键auto
,只有一个键autoplay
。 - 我建议不要让每个帧都定义计数器
goc
,而是在前导码中定义该计数器。 - 我认为您需要至少编译两次,且在编译之间不删除辅助文件。
也许下面的方法可以解决问题 - 如果一切顺利,请告诉我,因为我目前无法自己测试:我目前正在使用一台没有安装可以显示动画的像样的 pdf 查看器的平板电脑。
\documentclass[presentation]{beamer}
\usetheme{Madrid}
\usepackage[utf8]{inputenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Probably you don't need this as your setup does it in any case:
\usepackage[vietnamese]{babel}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tikz}\usetikzlibrary{calc}
\usetikzlibrary{decorations.text, decorations.pathmorphing}
\usepackage{animate}
\newcounter{goc}
\begin{document}
\begin{frame}%
\setcounter{goc}{0}%
\begin{animateinline}[autoplay,loop]{20}%
\whiledo{\thegoc<50}{%
\begin{tikzpicture}[join=round, font=\bfseries]%
\pgfmathsetmacro{\g}{2.5-abs(2.5-0.1*\thegoc)}%
\clip(-8,-2.5)rectangle (8,2.5);%
\path(0,1)node[red,scale=2,yscale=\g]{SỬ DỤNG ANIMATE};%
\path(0,0)node[green,scale=2,yscale=\g]{TẠO HÌNH ĐỘNG};%
\end{tikzpicture}%
\stepcounter{goc}%
\ifthenelse{\thegoc<50}{\newframe}{}%
}%
\end{animateinline}%
\end{frame}
\end{document}