如何让我的 Tikz 动画化

如何让我的 Tikz 动画化

你能让我的tikz文字animate像这样吗这个答案

\documentclass[compress]{beamer}
\usetheme{Warsaw}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}

\tikzstyle{every picture}+=[remember picture]
\tikzstyle{na} = [baseline=-.5ex]

\begin{document}

    \begin{frame}
        \frametitle{Test}
    
    
        \begin{itemize}
            \item Overall mean \tikz[na] \node[coordinate] (s1) {};
        \end{itemize}
    
    
        \begin{equation}
            X_{t} = \tikz[baseline]{ \node[fill=blue!20,anchor=base,rounded corners=2pt]
                (d1) {$\mu$}; }
            + \tikz[baseline]{ \node[fill=red!20,anchor=base,rounded corners=2pt]
                (d2) {$\phi_{1} X_{t-1}$}; }
            + \tikz[baseline]{ \node[fill=green!20,anchor=base,rounded corners=2pt]
                (d3) {$\phi_{2} X_{t-2}$}; }
            + \tikz[baseline]{ \node[fill=yellow!20,anchor=base,rounded corners=2pt]
                (d4) {$\phi_{3} X_{t-3}$}; }
            + \tikz[baseline]{ \node[fill=yellow!10,anchor=base,rounded corners=2pt]
                (d5) {$\epsilon_{t}$}; }
        \end{equation}
    
        \begin{itemize}
            \item The first order \tikz[na] \node[coordinate] (s2) {};
            \item The second order \tikz[na] \node[coordinate] (s3) {};
            \item The third order \tikz[na] \node[coordinate] (s4) {};
            \item The error term \tikz[na] \node[coordinate] (s5) {};
        \end{itemize}
    
        \begin{tikzpicture}[overlay]
            \path[->] (s1) edge [bend left] (d1);
            \path[->] (s2) edge [bend right] (d2);
            \path[->] (s3) edge [out=0, in=-90] (d3);
            \path[->] (s4) edge [out=0, in=-90] (d4);
            \path[->] (s5) edge [out=0, in=-90] (d5);
        \end{tikzpicture}
    
    \end{frame}

\end{document}

我的意思是像最后两个数字这个答案

答案1

\documentclass[compress]{beamer}
\usetheme{Warsaw}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{overlay-beamer-styles,tikzmark}
\tikzset{rc/.style={inner sep=2pt,rounded corners=2pt,fill=#1!20}}
\begin{document}

    \begin{frame}
        \frametitle{Test}
    
    
        \begin{itemize}
            \item \tikzmarknode{s1}{Overall mean}
        \end{itemize}
    
    
        \begin{equation}
            X_{t} = \tikzmarknode[rc=blue]{d1}{\mu}
            + \tikzmarknode[rc=red]{d2}{\phi_{1} X_{t-1}}
            + \tikzmarknode[rc=green]{d3}{\phi_{2} X_{t-2}}
            + \tikzmarknode[rc=yellow]{d4}{\phi_{3} X_{t-3}}
            + \tikzmarknode[rc=orange]{d5}{\epsilon_{t}}
        \end{equation}
    
        \begin{itemize}
            \item \tikzmarknode{s2}{The first order}
            \item \tikzmarknode{s3}{The second order}
            \item \tikzmarknode{s4}{The third order}
            \item \tikzmarknode{s5}{The error term}
        \end{itemize}
    
        \begin{tikzpicture}[overlay,remember picture]
         \foreach [count=\x] \Style in {bend left,bend right,{out=0,in=-90},{out=0,in=-90},{out=0,in=-90}}
         {\draw[->,visible on={<\x->}] (s\x.east) 
            to[style/.expanded=\Style] (d\x);}
        \end{tikzpicture}
    
    \end{frame}

\end{document}

在此处输入图片描述

相关内容