虽然在这里回答提供了我第一个问题的解决方案(气泡图是否可以叠加?),下一个分支问题自然而然地出现了:
- 是否可以制作气泡动画顺时针?
示例借自土拨鼠:
\documentclass[border=10pt]{beamer}
\usepackage{smartdiagram}
\begin{document}
\begin{frame}[t]
\frametitle{}
\smartdiagramanimated[bubble diagram]{Machine Learning,
Supervised, Unsupervised, Reinforcement}
\end{frame}
\end{document}
答案1
我查看了代码。虽然大多数(动画)图表都有clockwise
选项,但气泡图没有。但是,这个代码相当短,所以我复制并“破解”了它。现在你有可选键orientation
(-1
手段clockwise
)和“起始角度”,你可以根据需要进行调整。
\documentclass[border=10pt]{beamer}
\usepackage{smartdiagram}
\tikzset{Partha/.cd,
start angle/.initial=0,
orientation/.initial=1}
\makeatletter
\newcommand{\BubbleDiagramAnimated}[2][]{%
\begin{tikzpicture}[every node/.style={align=center,let hypenation},
Partha/.cd,#1]
\foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
\pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
\foreach \smitem [count=\xi] in {#2}{%
\ifnumequal{\xi}{1}{ %true
\node[bubble center node, smvisible on=<\xi->](center bubble){\smitem};
}{%false
\pgfmathtruncatemacro{\xj}{\xi-1}
\pgfmathtruncatemacro{\angle}{\pgfkeysvalueof{/tikz/Partha/start angle}+%
\pgfkeysvalueof{/tikz/Partha/orientation}*360/\actualnumitem*\xj}
\edef\col{\@nameuse{color@\xj}}
\node[bubble node, smvisible on=<\xi->](module\xi)
at (center bubble.\angle) {\smitem};
}%
}%
\end{tikzpicture}}
\makeatother
\begin{document}
\begin{frame}[t]
\frametitle{}
\BubbleDiagramAnimated[orientation=-1,start angle=-120]{Machine Learning,
Supervised, Unsupervised, Reinforcement}
\end{frame}
\end{document}
当然,您可以通过定义clockwise
代码使其更容易让人联想到其他键。
\documentclass[border=10pt]{beamer}
\usepackage{smartdiagram}
\tikzset{Partha/.cd,
start angle/.initial=0,
orientation/.initial=1,
clockwise/.code=\tikzset{Partha/orientation=-1,Partha/start angle=-120}}
\makeatletter
\newcommand{\BubbleDiagramAnimated}[2][]{%
\begin{tikzpicture}[every node/.style={align=center,let hypenation},
Partha/.cd,#1]
\foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
\pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
\foreach \smitem [count=\xi] in {#2}{%
\ifnumequal{\xi}{1}{ %true
\node[bubble center node, smvisible on=<\xi->](center bubble){\smitem};
}{%false
\pgfmathtruncatemacro{\xj}{\xi-1}
\pgfmathtruncatemacro{\angle}{\pgfkeysvalueof{/tikz/Partha/start angle}+%
\pgfkeysvalueof{/tikz/Partha/orientation}*360/\actualnumitem*\xj}
\edef\col{\@nameuse{color@\xj}}
\node[bubble node, smvisible on=<\xi->](module\xi)
at (center bubble.\angle) {\smitem};
}%
}%
\end{tikzpicture}}
\makeatother
\begin{document}
\begin{frame}[t]
\frametitle{}
\BubbleDiagramAnimated[clockwise]{Machine Learning,
Supervised, Unsupervised, Reinforcement}
\end{frame}
\end{document}