需要在 Beamer 中表示一辆驶过服务中心的汽车。链接上描述了一个动作如何让过山车轨道上行驶的车厢长度保持不变?。需要类似类型的格式。汽车需要移至服务中心然后离开,并且此移动应继续。
我尝试了以下方法:
\documentclass[aspectratio=169]{beamer} % Document class
\usepackage{subcaption}
\usepackage[english]{babel} % Set language
\mode<presentation> % Set options
{
\usetheme{default} % Set theme
\usecolortheme{rose} % Set colors
\usefonttheme{default} % Set font theme
\setbeamertemplate{caption}[numbered] % Set caption to be numbered
}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{overlay-beamer-styles}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary {arrows.meta}
\begin{document}
\begin{frame}{Example}
\begin{tikzpicture}
\draw[black, thick] (0,0) rectangle (3,2) node[pos=.5] {Service center};
\draw[-stealth] (-3,1) -- (0,1) node[midway,above] {Car};
\draw[-stealth] (3,1) -- (6,1) node[midway,above] {Car};
\end{tikzpicture}
\end{frame}
\end{document}
答案1
使用@CarLaTeX 的红色跑车https://github.com/TikZlings/Extravaganza2018/blob/main/samcarter/CarlaDriving/carlatex.pdf
\documentclass[aspectratio=169]{beamer} % Document class
\usepackage{subcaption}
\usepackage[english]{babel} % Set language
\usepackage{subcaption}
\usepackage[english]{babel} % Set language
\usepackage{nicematrix,tikz}
\mode<presentation> % Set options
{
\usetheme{default} % Set theme
\usecolortheme{rose} % Set colors
\usefonttheme{default} % Set font theme
\setbeamertemplate{caption}[numbered] % Set caption to be numbered
}
\usepackage{tabularx}
\usepackage{booktabs, caption} % For table rules
\usepackage{fontawesome}
\usepackage{charter} % serif
\usepackage{colortbl}
\usepackage{pdflscape,array,booktabs}
\usepackage[font=scriptsize]{caption}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{overlay-beamer-styles}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary {arrows.meta}
\setbeamertemplate{frametitle}[default][center]
\begin{document}
\begin{frame}
\transduration<1->{0}
\frametitle{Example \dots}
\begin{tikzpicture}[remember picture,overlay]
\node[draw,rectangle,minimum height=2cm,minimum width=3cm] (foo) at (current page.center) {Service center};
\draw[-stealth] ([xshift=1cm]current page.west) -- (foo);
\draw[-stealth] (foo) -- ([xshift=-1cm]current page.east);
\foreach \x in {1,1.25,...,15}{
\node<+>[xscale=-1] at ([xshift=\x cm]current page.west) {\includegraphics[width=1cm]{carlatex}};
}
\node[draw,fill=white,rectangle,minimum height=2cm,minimum width=3cm] at (current page.center) {Service center};
\end{tikzpicture}
\end{frame}
\end{document}