我想制作一个有行走的人的演示文稿。我需要两张图形,其中的人处于两种不同的位置。我如何让它们在适当的时刻出现,同时移动?感谢您的帮助:)
\documentclass[a4paper]{article}
\usepackage[cp1250]{inputenc}
\usepackage{polski}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{calc,ifthen}
\usepackage{pgf}
\usepackage{tikz}
\usepackage{animate}
\newcommand{\bt}{\begin{tikzpicture}}
\newcommand{\et}{\end{tikzpicture}}
\begin{document}
\bt
\draw (0,-0.25)circle(0.75cm);
\draw (0,-1)--(0,-3.5);
\draw(0,-1.5)--(-1,-2.5)--(-0.5,-3)--(-0.25,-3);
\draw(0,-1.5)--(1,-2.5)--(1.5,-2)--(1.25,-2);
\draw(0,-3.5)--(0,-4.5)--(-0.5,-5.5)--(0,-5.5);
\draw(0,-3.5)--(1,-4)--(0.5,-5)--(1,-5);
\et
}
\end{animateinline}
\bt
\draw (0,-0.25)circle(0.75cm);
\draw (0,-1)--(0,-3.5);
\draw(0,-1.5)--(-1,-2)--(-0.75,-2.5)--(-0.5,-2.5);
\draw(0,-1.5)--(0.5,-2.75)--(1.25,-2.5)--(1,-2.35);
\draw(0,-3.5)--(0.5,-4.5)--(-0.5,-5)--(-0.25,-5.25);
\draw(0,-3.5)--(0.5,-5.5)--(1,-5.5);
\et
\end{document}
答案1
这可以使用进度条的简单变体来实现,例如latex-beamer 的进度条;我使用了一些自己的图像 man1、man2,但你可以使用自己的:
\documentclass{beamer}
\usetheme{CambridgeUS}
\usepackage{tikz}
\makeatletter
\def\progressbar@progressbar{} % the progress bar
\newcount\progressbar@tmpcounta% auxiliary counter
\newcount\progressbar@tmpcountb% auxiliary counter
\newdimen\progressbar@pbwd %progressbar width
\newdimen\progressbar@tmpdim % auxiliary dimension
\progressbar@pbwd=\textwidth
% the progress bar
\def\progressbar@progressbar{%
\progressbar@tmpcounta=\insertframenumber
\progressbar@tmpcountb=\inserttotalframenumber
\progressbar@tmpdim=\progressbar@pbwd
\multiply\progressbar@tmpdim by \progressbar@tmpcounta
\divide\progressbar@tmpdim by \progressbar@tmpcountb
\begin{tikzpicture}[overlay]
\path (-20pt,0pt) -- ++ (\progressbar@pbwd,0pt);
\node at (\progressbar@tmpdim,-30pt)
{
\ifodd\progressbar@tmpcounta\relax
\includegraphics[height=1cm]{man1}
\else
\includegraphics[height=1cm]{man2}
\fi
};
\end{tikzpicture}%
}
\setbeamertemplate{background canvas}{\progressbar@progressbar}{}
\makeatother
\setbeamertemplate{navigation symbols}{}
\newcommand\testframe{%
\begin{frame}
test~ \thepage
\end{frame}
}
\newcommand\testV{\testframe\testframe\testframe\testframe\testframe}
\begin{document}
\testV\testV\testV\testV\testV
\end{document}