\documentclass[aspectratio=169]{ctexbeamer} 
\usepackage{tikz}%绘图
%自定义新命令
\newcommand{\tb}[1]{\textcolor{blue}{#1}}
\newcommand{\tr}[1]{\textcolor{red}{#1}}

\begin{document}
    \begin{frame}{三视图}
    \tikzset{OT/.style={x={(-0.35355cm,-0.35355cm)},z={(0cm,1cm)},y={(1cm,0cm)}}}
    \pgfmathsetmacro{\length}{3}   % 定义长方体的长度
    \pgfmathsetmacro{\width}{2}  % 定义长方体的宽度
    \pgfmathsetmacro{\height}{1}   % 定义长方体的高度
    \begin{minipage}[t]{0.3\textwidth}
        \centering
        \begin{tikzpicture}[OT,scale=1]
            % 定义长方体的顶点
            \coordinate (a) at (\width,0,0);%DA为宽
            \coordinate (b) at (\width,\length,0);
            \coordinate (d) at (0,0,0);%D为原点
            \coordinate (c) at (0,\length,0);%DC为长
            \coordinate (a') at (\width,0,\height);
            \coordinate (b') at (\width,\length,\height);
            \coordinate (c') at (0,\length,\height);
            \coordinate (d') at (0,0,\height);%这里体现高

            % 长方体的三条虚线
            \draw[thick,dashed] (d) -- (a);
            \draw[thick,dashed] (d) -- (c);
            \draw[thick,dashed] (d) -- (d');
    
            % 长方体的实线
            \draw[thick] (a) -- (b) -- (b') -- (a') -- cycle; % 正面
            \draw[thick] (b) -- (c) -- (c') -- (b') ; % 右侧面
            \draw[thick] (c') -- (d') -- (a') ; % 上底面面

            %设置颜色,没有学习字母表示顶点，只能用颜色表示长、宽、高.
            \draw[red,ultra thick] (a')--(b');%长为红色
            \draw[green,ultra thick] (a')--(d');%宽为绿色
            \draw[blue,ultra thick] (a)--(a');%高为蓝色
        \end{tikzpicture}\\
        长方体
    \end{minipage}
    \hfill
    \visible<2->{\begin{minipage}[t]{0.3\textwidth}
        \centering
        \begin{tikzpicture}[scale=1]
            % 主视图（投影到 yz 平面）
            \draw[thick] (0,0) rectangle (\length,\height);%主视图是取长方体的长和高
            \draw[red,ultra thick] (0,\height)--(\length,\height);%使得长变为红色
            \draw[blue,ultra thick] (0,0)--(0,\height);%使得高为蓝色
        \end{tikzpicture}\\
        主视图
    \end{minipage}}
    \hfill
    \visible<3->{\begin{minipage}[t]{0.3\textwidth}
        \centering
        \begin{tikzpicture}[scale=1]
            % 左视图（投影到 zx 平面）
            \draw[thick] (0,0) rectangle (\width,\height);%左视图是取长方体的宽和高
            \draw[green,ultra thick] (0,\height)--(\width,\height);%使得宽变为绿色
            \draw[blue,ultra thick] (\width,0)--(\width,\height);%使得高为蓝色
        \end{tikzpicture}\\
        左视图
    \end{minipage}}
    \\[1cm]
    \visible<5->{\begin{minipage}[t]{0.32\textwidth}%这里表示第一个minipage的宽度为整个的0.32倍.这个参数t只控制minipage内的内容顶部对齐.
        \centering
        从正面看为\tb{主视图};\\
        从左面看为\tb{左视图};\\
        从上面看为\tb{俯视图}.
    \end{minipage}}
    \hfill
    \visible<4->{\begin{minipage}[t]{0.32\textwidth}
        \centering
        \begin{tikzpicture}[scale=1]
            % 俯视图（投影到 xy 平面）
            \draw[thick] (0,0) rectangle (\length,\width);
            \draw[red,ultra thick] (0,0)--(\length,0);%使得长变为红色
            \draw[green,ultra thick] (0,0)--(0,\width);%使得宽为绿色
        \end{tikzpicture}\\
        俯视图
    \end{minipage}}
    \hfill
    \visible<6->{\begin{minipage}[t]{0.32\textwidth}
        \centering
        长对正;\\
        高平齐；\\
        宽相等.
    \end{minipage}}
\end{frame}
\end{document}
