如何在 animateinline 循环中缩放图形并保持缩放结构的中心点相同

如何在 animateinline 循环中缩放图形并保持缩放结构的中心点相同

我需要为我的动画缩放一个结构。我为此使用了缩放选项,但它导致结构移动到新位置。我希望十字形缩放但中心位置相同。这是我的代码,非常感谢您的帮助。

\documentclass[pdf]{beamer}
\mode<presentation>{\usetheme{Warsaw}} 
\usepackage{animate}
\usepackage{amsmath}
\usepackage{tikz}
\title[]{My Presentation}
\author[Raghuram Dharmavarapu]{Raghu}
\date{}
\usepackage{ifthen}

\begin{document}

\begin{frame}[fragile]{Animated Integral}

\begin{animateinline}[loop, poster = first,controls]{3}
    \multiframe{11}{i=0+1}{%
    \begin{tikzpicture}[scale = 0.8]
    \useasboundingbox (-4,-5) rectangle (10,5);
    \onslide<1->
    \filldraw[blue!40!black] (0,0) -- (2,0) -- (2.35,1) --(-0.35,1)--cycle;
    \filldraw[blue!40!white] (-0.35,1) --(0.25,1.6) -- (1.75,1.6) -- (2.35,1) --cycle;

    \filldraw[gray!30!white,scale = 0.08] (10,16) -- (13,16) -- (12.9,17) -- (14.5,17) --(14.2,18.25)--(12.7,18.25)--(12.6,19)--(10.4,19)--(10.3,18.25)--(8.8,18.25)--(8.5,17)--(10.1,17)--cycle;
    \filldraw[gray!90!white,scale = 0.08] (8.5,17)--(8.6,14.5)--(10.05,14.5)--(10,16)--(10.1,17)--cycle;
    \filldraw[gray!90!black,scale = 0.08] (10,16) -- (10.1,14) -- (12.9,14) -- (13,16)-- cycle;
    \filldraw[gray!90!white,scale = 0.08] (14.5,17) --(14.4,14.5) --(12.95,14.5) --(13,16) -- (12.9,17) --cycle;

\onslide<2->
    \filldraw[blue!40!black] (0,0) -- (2,0) -- (2.35,1) --(-0.35,1)--cycle;
    \filldraw[blue!40!white] (-0.35,1) --(0.25,1.6) -- (1.75,1.6) -- (2.35,1) --cycle;

    \filldraw[gray!30!white,scale = 0.08+\i/100] (10,16) -- (13,16) -- (12.9,17) -- (14.5,17) --(14.2,18.25)--(12.7,18.25)--(12.6,19)--(10.4,19)--(10.3,18.25)--(8.8,18.25)--(8.5,17)--(10.1,17)--cycle;
    \filldraw[gray!90!white,scale = 0.08+\i/100] (8.5,17)--(8.6,14.5)--(10.05,14.5)--(10,16)--(10.1,17)--cycle;
    \filldraw[gray!90!black,scale = 0.08+\i/100] (10,16) -- (10.1,14) -- (12.9,14) -- (13,16)-- cycle;
    \filldraw[gray!90!white,scale = 0.08+\i/100] (14.5,17) --(14.4,14.5) --(12.95,14.5) --(13,16) -- (12.9,17) --cycle;


      \draw[->] (-3,-4) -- (10,-4) node[right] {$\lambda$};
      \draw[->] (-3,0) -- (10,0) node[right] {$\lambda$};
      \draw[->] (-2.5,-4.5) -- (-2.5,4) node[above] {$|E|$};
      \draw[->] (4,-4.5) -- (4,4) node[above] {$\angle E$};
      \draw[thick, dashed,domain=-1.5:3,samples = 100,smooth,variable=\x,blue] plot ({\x},{-4+3*pow(2.71,-(pow(\x+1-(\i/10*1.5),2))/0.05)});
      \draw[thick,domain=-1.5:3,smooth,samples = 100,variable=\x,red] plot ({\x},{-4+3*pow(2.71,-(pow(\x-2+(\i/10*1.5),2))/0.05)}); 

      \draw[thick, dashed,domain=-2:2,smooth,samples = 100,variable=\x,green] plot ({\x+6+(\i/10*1)},{-2.5+rad(atan(\x*3.5))});
      \draw[thick,domain=-2:2,smooth,samples = 100,variable=\x,magenta] plot ({\x+8 
      -(\i/10*1)},{-2.5+rad(atan(\x*3.5))});
    \end{tikzpicture}
    }
\end{animateinline}
\end{frame}

\end{document}

在此处输入图片描述 在此处输入图片描述

相关内容