先 Mark 一下。其实可以用 TikZ 生成 PDF 动图的,有空了我来补充上具体方法。
好了,我来写答案了:
\documentclass{article}
\usepackage{animate}
\usepackage{tkz-euclide}
\ExplSyntaxOn
\seq_gclear_new:N \g__accum_dot_coors_seq
\newcommand{\saveDotE}[1]
  {
    \seq_gput_right:Ne \g__accum_dot_coors_seq
      { #1 }
  }
\newcommand{\drawDotEdata}
  {
    \seq_map_inline:Nn \g__accum_dot_coors_seq
      {
        \draw[red] (##1) circle (2pt);
      }
  }
\ExplSyntaxOff
\begin{document}
\begin{animateinline}[
  autoplay, loop, controls=all, poster=last,
  begin = {\begin{tikzpicture}[scale=.65]},
  end = {\end{tikzpicture}},
]{20}
\multiframe{40}{rxcoor=-5+0.25}
  {
    \useasboundingbox (-10, -10) rectangle (10, 10);
    \tkzDefPoints{0/0/O,-4/0/B,4/0/C,0/4/A,-5/0/xmin,5/0/xmax,0/-5/ymin,0/5/ymax}
    \begin{scope}[thick]
      \draw [->] (xmin) -- (xmax) node[below]{$x$};
      \draw [->] (ymin) -- (ymax) node[above]{$y$};
    \end{scope}
    \draw (A) node[right]{$A$} -- (B) node[below left]{$B$} -- (C) node[below]{$C$} -- cycle;
    % animate begin
    \coordinate (D) at (\rxcoor, 0);
    \tkzDefPointBy[rotation=center D angle 90](A)
    \tkzGetPoint{E}
    \tkzGetPointCoord(E){e}
    \saveDotE{\ex, \ey}
    \draw[dashed, draw=red!\fpeval{\rxcoor*20}!blue] (A) 
      -- (D) node[below, gray] {$D$}
      -- (E) node[below, gray] {$E$} 
      -- cycle;
    \drawDotEdata
  }
\end{animateinline}
\end{document}效果如下(可以在 Adobe Arobat 中查看):




















问 平面几何动点问题中的绘图方法