使用 tikz 制作电影

使用 tikz 制作电影

我想使用 tikz 图像制作电影,但如果没有某种自动化,这似乎需要大量工作。我有一个三角形的背景网格,还有一条穿过它们的红线。在每个交叉点,我想提出一个金字塔函数(6 个交叉点各一个,每个函数依次发生)。随着每个函数的提出,我还想旋转视点,这样金字塔函数就可以清晰地看到。到目前为止,这就是我所拥有的:

\documentclass[border={10pt 10pt 10pt 10pt}]{standalone}

\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} % use color
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.groupplots, backgrounds,intersections,shapes.arrows}


\begin{document}

\begin{tikzpicture}

\begin{axis}[
        colormap/viridis,
        axis lines*=left,
        zmin=0,zmax=1,
%       view={-45}{45},
        axis line style={draw=none},
        tick style={draw=none},
        ticks=none,
        ]

\def\triangleParamX{s)}
\def\triangleParamY{t*(1-s)}

% draw mesh
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(0,0,0) (1,0,0) (0,1,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,0,0) (1,1,0) (0,1,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,0,0) (2,0,0) (2,1,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,0,0) (2,1,0) (1,1,0)};

\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(0,2,0) (0,1,0) (1,2,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(0,1,0) (1,1,0) (1,2,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,1,0) (2,1,0) (1,2,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(2,1,0) (2,2,0) (1,2,0)};

% draw curve with nodes
\addplot3+[BrickRed, solid, thick, no markers, samples=51, samples y=0,domain=0:2,variable=\t]
                                      ({\t)},{sin(\t r)+0.5},{0})
node (A) [draw, circle,fill=white,pos=0.,scale=0.5]{}
node (B) [draw, circle,fill=white,pos=0.15,scale=0.5]{} 
node (C) [draw, circle,fill=white,pos=0.31,scale=0.5]{} 
node (D) [draw, circle,fill=white,pos=0.56,scale=0.5]{} 
node (E) [draw, circle,fill=white,pos=0.785,scale=0.5]{} 
node (F) [draw, circle,fill=white,pos=1.,scale=0.5]{} 
;


% draw functions
\newcommand \wen {0.2};

% psi1
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0,0) (0,0.5,\wen) (1,0,0)};
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0.5,\wen) (1,0,0) (0.25,0.75,0) };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0.5,\wen) (0.25,0.75,0) (0,1,0)  };

% psi2
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,1,0) (0.25,0.75,\wen) (0.5,1,0)};
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,1,0) (0.25,0.75,\wen) (0,0.5,0)};
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0.5,0) (0.25,0.75,\wen) (0,0,0)  };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0,0) (0.25,0.75,\wen) (1,0,0)  };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0.5,1,0) (0.25,0.75,\wen) (1,0,0)  };

% psi3
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,1,0) (0.5,1.,\wen) (0.25,0.75,0)};
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0.25,0.75,0) (0.5,1.,\wen) (1.,0,0)};
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,0.,0) (0.5,1.,\wen) (1.,1.,0)};
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,1.,0) (0.5,1.,\wen) (1.,1.35,0)};
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,1.35,0) (0.5,1.,\wen) (1.,2.,0)};
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,2,0) (0.5,1.,\wen) (0.,1.,0)};

% psi4
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,1,0) (1.,1.35,\wen) (0.5,1,0) };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,1,0) (1.,1.35,\wen) (2.,1,0) };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2,1,0) (1.,1.35,\wen) (1.5,1.5,0) };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.5,1.5,0) (1.,1.35,\wen) (1,2,0) };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,2,0) (1.,1.35,\wen) (0.,1.,0)  };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0.,1.,0) (1.,1.35,\wen) (0.5,1,0) };


% psi5
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,1.35,0) (1.5,1.5,\wen) (1.,1.,0) };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,1.,0) (1.5,1.5,\wen) (2,1.,0) };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2,1.,0) (1.5,1.5,\wen) (2.,1.4,0)  };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2.,1.4,0) (1.5,1.5,\wen) (2,2.,0) };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2,2.,0) (1.5,1.5,\wen) (1.,2,0) };
%\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,2,0) (1.5,1.5,\wen)(1,1.35,0) };

% psi6
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.5,1.5,0) (2.,1.4,\wen) (2.,1.,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2.,2.,0) (2.,1.4,\wen) (1.,2,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,2,0) (2.,1.4,\wen) (1.5,1.5,0)  };


%\addplot3[surf, domain=0:1,y domain=0:1] (\triangleParamX,\triangleParamY,{1-x-y});

\end{axis}

\end{tikzpicture}

\end{document}

其中我包含了所有的金字塔函数,但除了一个之外,其他所有函数我都注释掉了。其中一个函数如下所示:

在此处输入图片描述

所以我的问题主要是如何从这段代码中获取电影。我可以在自己编写的代码中以某种方式做到这一点吗?还是我必须使用某种脚本语言(可能使用循环)创建多个文件?我如何处理视点?幸运的是,我有 6 个函数,因此如果每个函数以 10 个增量增加到其最大值,那么将为我提供 60 帧(因此我可以将网格的完整旋转除以 60)。

更新

This is the updated code:

\documentclass[border={10pt 10pt 10pt 10pt}]{standalone}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} % use color
\usepackage{tikz}
\standaloneconfig{tikz=true}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
%\usetikzlibrary{pgfplots.groupplots, backgrounds,intersections,shapes.arrows}

\begin{document}

\foreach \i in {0,...,72}{
\begin{tikzpicture}

\pgfmathsetmacro{\theta}{\i*1.25-45};

 \newcommand \wen {0.1};

\begin{axis}[
        colormap/viridis,
        point meta min=-\wen, point meta max=\wen,
        axis lines*=left,
%       xmin=0,xmax=1,
%       ymin=0,ymax=1,
        zmin=-\wen,zmax=\wen,
%        zmin=0,zmax=1,
        view={\theta}{45}, % You can make the view depend on \i
        axis line style={draw=none},
        tick style={draw=none},
        ticks=none,
        ]

\pgfplotsset{meshstyle/.style={patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.01}}

\addplot3[meshstyle] coordinates {(0,0,0) (1,0,0) (0,1,0)};
\addplot3[meshstyle] coordinates {(1,0,0) (1,1,0) (0,1,0)};
\addplot3[meshstyle] coordinates {(1,0,0) (2,0,0) (2,1,0)};
\addplot3[meshstyle] coordinates {(1,0,0) (2,1,0) (1,1,0)};

\addplot3[meshstyle] coordinates {(0,2,0) (0,1,0) (1,2,0)};
\addplot3[meshstyle] coordinates {(0,1,0) (1,1,0) (1,2,0)};
\addplot3[meshstyle] coordinates {(1,1,0) (2,1,0) (1,2,0)};
\addplot3[meshstyle] coordinates {(2,1,0) (2,2,0) (1,2,0)};


% draw curve with nodes
\addplot3+[BrickRed, solid, thick, no markers, samples=51, samples y=0,domain=0:2,variable=\t]
                                      ({\t)},{sin(\t r)+0.5},{0})
node (A) [draw, circle,fill=white,pos=0.,scale=0.5]{}
node (B) [draw, circle,fill=white,pos=0.15,scale=0.5]{} 
node (C) [draw, circle,fill=white,pos=0.31,scale=0.5]{} 
node (D) [draw, circle,fill=white,pos=0.56,scale=0.5]{} 
node (E) [draw, circle,fill=white,pos=0.785,scale=0.5]{} 
node (F) [draw, circle,fill=white,pos=1.,scale=0.5]{} 
;




% draw functions

% draw weak enrichments

 \pgfplotsset{psistyle/.style={patch, patch type=triangle, ultra thin, shader=faceted interp, fill opacity=0.4}}

% psi1
\ifnum\i>0
\ifnum\i<11
\pgfmathsetmacro{\wenOne}{min(\i,10)*\wen/10};

\addplot3[psistyle] coordinates {(0,0,0) (0,0.5,\wenOne) (1,0,0)};
\addplot3[psistyle] coordinates {(0,0.5,\wenOne) (1,0,0) (0.25,0.75,0) };
\addplot3[psistyle] coordinates {(0,0.5,\wenOne) (0.25,0.75,0) (0,1,0) };

\else

\ifnum\i<21

\pgfmathsetmacro{\wenOne}{max(20-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(0,0,0) (0,0.5,\wenOne) (1,0,0)};
\addplot3[psistyle] coordinates {(0,0.5,\wenOne) (1,0,0) (0.25,0.75,0) };
\addplot3[psistyle] coordinates {(0,0.5,\wenOne) (0.25,0.75,0) (0,1,0) };
\fi
\fi
\fi


% psi2
\ifnum\i>10
\ifnum\i<21

\pgfmathsetmacro{\wenTwo}{min(\i-10,10)*\wen/10};

\addplot3[psistyle] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0.5,1,0)};
\addplot3[psistyle] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0,0.5,0)};
\addplot3[psistyle] coordinates {(0,0.5,0) (0.25,0.75,\wenTwo) (0,0,0)  };
\addplot3[psistyle] coordinates {(0,0,0) (0.25,0.75,\wenTwo) (1,0,0)  };
\addplot3[psistyle] coordinates {(0.5,1,0) (0.25,0.75,\wenTwo) (1,0,0)  };


\else

\ifnum\i<31

\pgfmathsetmacro{\wenTwo}{max(30-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0.5,1,0)};
\addplot3[psistyle] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0,0.5,0)};
\addplot3[psistyle] coordinates {(0,0.5,0) (0.25,0.75,\wenTwo) (0,0,0)  };
\addplot3[psistyle] coordinates {(0,0,0) (0.25,0.75,\wenTwo) (1,0,0)  };
\addplot3[psistyle] coordinates {(0.5,1,0) (0.25,0.75,\wenTwo) (1,0,0)  };
\fi
\fi
\fi


% psi3
\ifnum\i>20
\ifnum\i<31

\pgfmathsetmacro{\wenThree}{min(\i-20,10)*\wen/10};

\addplot3[psistyle] coordinates {(1.,2,0) (0.5,1.,\wenThree) (0.,1.,0)};
\addplot3[psistyle] coordinates {(0,1,0) (0.5,1.,\wenThree) (0.25,0.75,0)};
\addplot3[psistyle] coordinates {(0.25,0.75,0) (0.5,1.,\wenThree) (1.,0,0)};
\addplot3[psistyle] coordinates {(1.,0.,0) (0.5,1.,\wenThree) (1.,1.,0)};
\addplot3[psistyle] coordinates {(1.,1.,0) (0.5,1.,\wenThree) (1.,1.35,0)};
\addplot3[psistyle] coordinates {(1.,1.35,0) (0.5,1.,\wenThree) (1.,2.,0)};

\else

\ifnum\i<41

\pgfmathsetmacro{\wenThree}{max(40-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(1.,2,0) (0.5,1.,\wenThree) (0.,1.,0)};
\addplot3[psistyle] coordinates {(0,1,0) (0.5,1.,\wenThree) (0.25,0.75,0)};
\addplot3[psistyle] coordinates {(0.25,0.75,0) (0.5,1.,\wenThree) (1.,0,0)};
\addplot3[psistyle] coordinates {(1.,0.,0) (0.5,1.,\wenThree) (1.,1.,0)};
\addplot3[psistyle] coordinates {(1.,1.,0) (0.5,1.,\wenThree) (1.,1.35,0)};
\addplot3[psistyle] coordinates {(1.,1.35,0) (0.5,1.,\wenThree) (1.,2.,0)};
\fi
\fi
\fi



% psi4
\ifnum\i>30
\ifnum\i<41

\pgfmathsetmacro{\wenFour}{min(\i-30,10)*\wen/10};

\addplot3[psistyle] coordinates {(1,2,0) (1.,1.35,\wenFour) (0.,1.,0)  };
\addplot3[psistyle] coordinates {(1,1,0) (1.,1.35,\wenFour) (0.5,1,0) };
\addplot3[psistyle] coordinates {(1,1,0) (1.,1.35,\wenFour) (2.,1,0) };
\addplot3[psistyle] coordinates {(2,1,0) (1.,1.35,\wenFour) (1.5,1.5,0) };
\addplot3[psistyle] coordinates {(1.5,1.5,0) (1.,1.35,\wenFour) (1,2,0) };
\addplot3[psistyle] coordinates {(0.,1.,0) (1.,1.35,\wenFour) (0.5,1,0) };

\else

\ifnum\i<51

\pgfmathsetmacro{\wenFour}{max(50-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(1,2,0) (1.,1.35,\wenFour) (0.,1.,0)  };
\addplot3[psistyle] coordinates {(1,1,0) (1.,1.35,\wenFour) (0.5,1,0) };
\addplot3[psistyle] coordinates {(1,1,0) (1.,1.35,\wenFour) (2.,1,0) };
\addplot3[psistyle] coordinates {(2,1,0) (1.,1.35,\wenFour) (1.5,1.5,0) };
\addplot3[psistyle] coordinates {(1.5,1.5,0) (1.,1.35,\wenFour) (1,2,0) };
\addplot3[psistyle] coordinates {(0.,1.,0) (1.,1.35,\wenFour) (0.5,1,0) };
\fi
\fi
\fi


% psi5
\ifnum\i>40
\ifnum\i<51

\pgfmathsetmacro{\wenFive}{min(\i-40,10)*\wen/10};

\addplot3[psistyle] coordinates {(2,2.,0) (1.5,1.5,\wenFive) (1.,2,0) };
\addplot3[psistyle] coordinates {(1,1.35,0) (1.5,1.5,\wenFive) (1.,1.,0) };
\addplot3[psistyle] coordinates {(1.,1.,0) (1.5,1.5,\wenFive) (2,1.,0) };
\addplot3[psistyle] coordinates {(2,1.,0) (1.5,1.5,\wenFive) (2.,1.4,0)  };
\addplot3[psistyle] coordinates {(2.,1.4,0) (1.5,1.5,\wenFive) (2,2.,0) };
\addplot3[psistyle] coordinates {(1.,2,0) (1.5,1.5,\wenFive)(1,1.35,0) };


\else

\ifnum\i<61

\pgfmathsetmacro{\wenFive}{max(60-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(2,2.,0) (1.5,1.5,\wenFive) (1.,2,0) };
\addplot3[psistyle] coordinates {(1,1.35,0) (1.5,1.5,\wenFive) (1.,1.,0) };
\addplot3[psistyle] coordinates {(1.,1.,0) (1.5,1.5,\wenFive) (2,1.,0) };
\addplot3[psistyle] coordinates {(2,1.,0) (1.5,1.5,\wenFive) (2.,1.4,0)  };
\addplot3[psistyle] coordinates {(2.,1.4,0) (1.5,1.5,\wenFive) (2,2.,0) };
\addplot3[psistyle] coordinates {(1.,2,0) (1.5,1.5,\wenFive)(1,1.35,0) };

\fi
\fi
\fi



% psi6
\ifnum\i>50
\ifnum\i<61

\pgfmathsetmacro{\wenSix}{min(\i-50,10)*\wen/10};

\pgfmathsetmacro{\wenSix}{min(\i-50,10)*\wen/10};

\addplot3[psistyle] coordinates {(2.,2.,0) (2.,1.4,\wenSix) (1.,2,0) };
\addplot3[psistyle] coordinates {(1.5,1.5,0) (2.,1.4,\wenSix) (2.,1.,0) };
\addplot3[psistyle] coordinates {(1.,2,0) (2.,1.4,\wenSix) (1.5,1.5,0)  };


\else

\ifnum\i<71

\pgfmathsetmacro{\wenSix}{max(70-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(2.,2.,0) (2.,1.4,\wenSix) (1.,2,0) };
\addplot3[psistyle] coordinates {(1.5,1.5,0) (2.,1.4,\wenSix) (2.,1.,0) };
\addplot3[psistyle] coordinates {(1.,2,0) (2.,1.4,\wenSix) (1.5,1.5,0)  };

\fi
\fi
\fi


\end{axis}
\end{tikzpicture}

} % \foreach

\end{document}

我仍然有几个问题不知道如何解决:

  • 每帧之间的过渡并不平滑。每帧的宽度也在变化,所以不是恒定的。特别是,动画进行到一半时,出现了一个很大的跳跃。必须有一种方法来指定我想要可视化的 3-D 对象的外部尺寸,以便网格的中心始终居中。这可能吗?
  • 我不知道如何将生成的 pdf 文件转换为动画 gif。我尝试使用convert,按照说明操作找到这里,但在某些时候无法创建 gif,并给出错误convert: images are not the same sizeslide-00.png' @ error/layer.c/OptimizeLayerFrames/964.` 我认为出现此错误是因为我之前的评论。此外,无论创建什么 gif 文件,所有帧都是相互叠加的。

答案1

旧答案:(在评论中澄清后):随着功能的不断增加和视角的变化。

\documentclass[border={10pt 10pt 10pt 10pt}]{standalone}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} % use color
\usepackage{tikz}
\standaloneconfig{tikz=true}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
%\usetikzlibrary{pgfplots.groupplots, backgrounds,intersections,shapes.arrows}


\begin{document}
\foreach \i in {0,...,60}{
\begin{tikzpicture}
\begin{axis}[
        colormap/viridis,
        axis lines*=left,
        zmin=0,zmax=1,
        view={\i}{45}, % You can make the view depend on \i
        axis line style={draw=none},
        tick style={draw=none},
        ticks=none,
        ]

\def\triangleParamX{s)}
\def\triangleParamY{t*(1-s)}

% draw mesh
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(0,0,0) (1,0,0) (0,1,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,0,0) (1,1,0) (0,1,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,0,0) (2,0,0) (2,1,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,0,0) (2,1,0) (1,1,0)};

\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(0,2,0) (0,1,0) (1,2,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(0,1,0) (1,1,0) (1,2,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,1,0) (2,1,0) (1,2,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(2,1,0) (2,2,0) (1,2,0)};

% draw curve with nodes
\addplot3+[BrickRed, solid, thick, no markers, samples=51, samples y=0,domain=0:2,variable=\t]
                                      ({\t)},{sin(\t r)+0.5},{0})
node (A) [draw, circle,fill=white,pos=0.,scale=0.5]{}
node (B) [draw, circle,fill=white,pos=0.15,scale=0.5]{} 
node (C) [draw, circle,fill=white,pos=0.31,scale=0.5]{} 
node (D) [draw, circle,fill=white,pos=0.56,scale=0.5]{} 
node (E) [draw, circle,fill=white,pos=0.785,scale=0.5]{} 
node (F) [draw, circle,fill=white,pos=1.,scale=0.5]{} 
;


% draw functions



% psi1
\ifnum\i>0
\pgfmathsetmacro{\wenOne}{min(\i,10)*0.05/10};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0,0) (0,0.5,\wenOne) (1,0,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0.5,\wenOne) (1,0,0) (0.25,0.75,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0.5,\wenOne) (0.25,0.75,0) (0,1,0)  };
\fi

% psi2
\ifnum\i>10
\pgfmathsetmacro{\wenTwo}{min(\i-10,10)*0.05};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0.5,1,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0,0.5,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0.5,0) (0.25,0.75,\wenTwo) (0,0,0)  };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0,0) (0.25,0.75,\wenTwo) (1,0,0)  };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0.5,1,0) (0.25,0.75,\wenTwo) (1,0,0)  };
\fi
% \ifnum\i>3

% psi3
\ifnum\i>20
\pgfmathsetmacro{\wenThree}{min(\i-20,10)*0.05};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,1,0) (0.5,1.,\wenThree) (0.25,0.75,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0.25,0.75,0) (0.5,1.,\wenThree) (1.,0,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,0.,0) (0.5,1.,\wenThree) (1.,1.,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,1.,0) (0.5,1.,\wenThree) (1.,1.35,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,1.35,0) (0.5,1.,\wenThree) (1.,2.,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,2,0) (0.5,1.,\wenThree) (0.,1.,0)};
\fi

% psi4
\ifnum\i>30
\pgfmathsetmacro{\wenFour}{min(\i-30,10)*0.05};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,1,0) (1.,1.35,\wenFour) (0.5,1,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,1,0) (1.,1.35,\wenFour) (2.,1,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2,1,0) (1.,1.35,\wenFour) (1.5,1.5,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.5,1.5,0) (1.,1.35,\wenFour) (1,2,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,2,0) (1.,1.35,\wenFour) (0.,1.,0)  };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0.,1.,0) (1.,1.35,\wenFour) (0.5,1,0) };
\fi

% psi5
\ifnum\i>40
\pgfmathsetmacro{\wenFive}{min(\i-40,10)*0.05};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,1.35,0) (1.5,1.5,\wenFive) (1.,1.,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,1.,0) (1.5,1.5,\wenFive) (2,1.,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2,1.,0) (1.5,1.5,\wenFive) (2.,1.4,0)  };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2.,1.4,0) (1.5,1.5,\wenFive) (2,2.,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2,2.,0) (1.5,1.5,\wenFive) (1.,2,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,2,0) (1.5,1.5,\wenFive)(1,1.35,0) };
\fi

% psi6
\ifnum\i>50
\pgfmathsetmacro{\wenSix}{min(\i-50,10)*0.05};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.5,1.5,0) (2.,1.4,\wenSix) (2.,1.,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2.,2.,0) (2.,1.4,\wenSix) (1.,2,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,2,0) (2.,1.4,\wenSix) (1.5,1.5,0)  };
%\addplot3[surf, domain=0:1,y domain=0:1] (\triangleParamX,\triangleParamY,{1-x-y});
\fi
\end{axis}
\end{tikzpicture}


}
\end{document}

在此处输入图片描述

为了好玩:一个 beamer 版本。(Modulo xcolor...)

\documentclass[xcolor]{beamer} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \definecolor{BrickRed}{rgb}{0.45,0.06,0.06} % #880000

\begin{document}
\begin{frame}[t]
\frametitle{A growing plot}
\newcount\myangle
\animate<2-62> 
\animatevalue<2-62>{\myangle}{0}{60} 
\typeout{\myangle}
\pgfmathtruncatemacro{\i}{\myangle}
\transduration<2-62>{0.4}
\begin{tikzpicture}[scale=2]
\begin{axis}[
        colormap/viridis,
        axis lines*=left,
        zmin=0,zmax=1,
        view={\i}{45}, % You can make the view depend on \i
        axis line style={draw=none},
        tick style={draw=none},
        ticks=none,
        ]

\def\triangleParamX{s)}
\def\triangleParamY{t*(1-s)}

%\addplot3 ({cos(2*pi*x)*cos(2*pi*y)},{cos(2*pi*x)*sin(2*pi*x)},{sin(2*pi*x)});

% draw mesh
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(0,0,0) (1,0,0) (0,1,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,0,0) (1,1,0) (0,1,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,0,0) (2,0,0) (2,1,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,0,0) (2,1,0) (1,1,0)};

\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(0,2,0) (0,1,0) (1,2,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(0,1,0) (1,1,0) (1,2,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(1,1,0) (2,1,0) (1,2,0)};
\addplot3[patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1] coordinates {(2,1,0) (2,2,0) (1,2,0)};

% draw curve with nodes
\addplot3+[BrickRed, solid, thick, no markers, samples=51, samples y=0,domain=0:2,variable=\t]
                                      ({\t)},{sin(\t r)+0.5},{0})
node (A) [draw, circle,fill=white,pos=0.,scale=0.5]{}
node (B) [draw, circle,fill=white,pos=0.15,scale=0.5]{} 
node (C) [draw, circle,fill=white,pos=0.31,scale=0.5]{} 
node (D) [draw, circle,fill=white,pos=0.56,scale=0.5]{} 
node (E) [draw, circle,fill=white,pos=0.785,scale=0.5]{} 
node (F) [draw, circle,fill=white,pos=1.,scale=0.5]{} 
;


% draw functions


% psi1
\ifnum\i>0
\pgfmathsetmacro{\wenOne}{min(\i,10)*0.05/10};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0,0) (0,0.5,\wenOne) (1,0,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0.5,\wenOne) (1,0,0) (0.25,0.75,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0.5,\wenOne) (0.25,0.75,0) (0,1,0)  };
\fi

% psi2
\ifnum\i>10
\pgfmathsetmacro{\wenTwo}{min(\i-10,10)*0.05};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0.5,1,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0,0.5,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0.5,0) (0.25,0.75,\wenTwo) (0,0,0)  };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,0,0) (0.25,0.75,\wenTwo) (1,0,0)  };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0.5,1,0) (0.25,0.75,\wenTwo) (1,0,0)  };
\fi
% \ifnum\i>3

% psi3
\ifnum\i>20
\pgfmathsetmacro{\wenThree}{min(\i-20,10)*0.05};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0,1,0) (0.5,1.,\wenThree) (0.25,0.75,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0.25,0.75,0) (0.5,1.,\wenThree) (1.,0,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,0.,0) (0.5,1.,\wenThree) (1.,1.,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,1.,0) (0.5,1.,\wenThree) (1.,1.35,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,1.35,0) (0.5,1.,\wenThree) (1.,2.,0)};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,2,0) (0.5,1.,\wenThree) (0.,1.,0)};
\fi

% psi4
\ifnum\i>30
\pgfmathsetmacro{\wenFour}{min(\i-30,10)*0.05};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,1,0) (1.,1.35,\wenFour) (0.5,1,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,1,0) (1.,1.35,\wenFour) (2.,1,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2,1,0) (1.,1.35,\wenFour) (1.5,1.5,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.5,1.5,0) (1.,1.35,\wenFour) (1,2,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,2,0) (1.,1.35,\wenFour) (0.,1.,0)  };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(0.,1.,0) (1.,1.35,\wenFour) (0.5,1,0) };
\fi

% psi5
\ifnum\i>40
\pgfmathsetmacro{\wenFive}{min(\i-40,10)*0.05};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1,1.35,0) (1.5,1.5,\wenFive) (1.,1.,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,1.,0) (1.5,1.5,\wenFive) (2,1.,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2,1.,0) (1.5,1.5,\wenFive) (2.,1.4,0)  };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2.,1.4,0) (1.5,1.5,\wenFive) (2,2.,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2,2.,0) (1.5,1.5,\wenFive) (1.,2,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,2,0) (1.5,1.5,\wenFive)(1,1.35,0) };
\fi

% psi6
\ifnum\i>50
\pgfmathsetmacro{\wenSix}{min(\i-50,10)*0.05};
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.5,1.5,0) (2.,1.4,\wenSix) (2.,1.,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(2.,2.,0) (2.,1.4,\wenSix) (1.,2,0) };
\addplot3[patch,dotted,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.1, shader=faceted interp] coordinates {(1.,2,0) (2.,1.4,\wenSix) (1.5,1.5,0)  };
%\addplot3[surf, domain=0:1,y domain=0:1] (\triangleParamX,\triangleParamY,{1-x-y});
\fi

\end{axis}
\end{tikzpicture}



\end{frame}

\end{document}

在此处输入图片描述

更新:至于附加请求,请考虑

\documentclass[border={1pt 1pt 1pt 1pt}]{standalone} % I made the border smaller
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} % use color
\usepackage{tikz}
\standaloneconfig{tikz=true}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
%\usetikzlibrary{pgfplots.groupplots, backgrounds,intersections,shapes.arrows}

\begin{document}

\foreach \i in {0,...,72}{
\begin{tikzpicture}

\pgfmathsetmacro{\theta}{\i*1.25-45};

\newcommand\wen{0.1} % <- no ; here

\begin{axis}[
        colormap/viridis,
        point meta min=-\wen, point meta max=\wen,
        axis lines*=left,
%       xmin=0,xmax=1,
%       ymin=0,ymax=1,
        zmin=-\wen,zmax=\wen,
%        zmin=0,zmax=1,
        view={\theta}{45}, % 
        axis line style={draw=none},
        tick style={draw=none},
        ticks=none,
        ]

\pgfplotsset{meshstyle/.style={patch,patch type=triangle,color=gray,faceted color=gray,fill opacity=0.01}}

\addplot3[draw=none,domain=0:360] ({1+2*cos(x)},{1+2*sin(x)},0);
\addplot3[draw=none,domain=0:3] (0,0,x);

\addplot3[meshstyle] coordinates {(0,0,0) (1,0,0) (0,1,0)};
\addplot3[meshstyle] coordinates {(1,0,0) (1,1,0) (0,1,0)};
\addplot3[meshstyle] coordinates {(1,0,0) (2,0,0) (2,1,0)};
\addplot3[meshstyle] coordinates {(1,0,0) (2,1,0) (1,1,0)};

\addplot3[meshstyle] coordinates {(0,2,0) (0,1,0) (1,2,0)};
\addplot3[meshstyle] coordinates {(0,1,0) (1,1,0) (1,2,0)};
\addplot3[meshstyle] coordinates {(1,1,0) (2,1,0) (1,2,0)};
\addplot3[meshstyle] coordinates {(2,1,0) (2,2,0) (1,2,0)};


% draw curve with nodes
\addplot3+[BrickRed, solid, thick, no markers, samples=51, samples y=0,domain=0:2,variable=\t]
                                      ({\t)},{sin(\t r)+0.5},{0})
node (A) [draw, circle,fill=white,pos=0.,scale=0.5]{}
node (B) [draw, circle,fill=white,pos=0.15,scale=0.5]{} 
node (C) [draw, circle,fill=white,pos=0.31,scale=0.5]{} 
node (D) [draw, circle,fill=white,pos=0.56,scale=0.5]{} 
node (E) [draw, circle,fill=white,pos=0.785,scale=0.5]{} 
node (F) [draw, circle,fill=white,pos=1.,scale=0.5]{} 
;




% draw functions

% draw weak enrichments

 \pgfplotsset{psistyle/.style={patch, patch type=triangle, ultra thin, shader=faceted interp, fill opacity=0.4}}

% psi1
\ifnum\i>0
\ifnum\i<11
\pgfmathsetmacro{\wenOne}{min(\i,10)*\wen/10};

\addplot3[psistyle] coordinates {(0,0,0) (0,0.5,\wenOne) (1,0,0)};
\addplot3[psistyle] coordinates {(0,0.5,\wenOne) (1,0,0) (0.25,0.75,0) };
\addplot3[psistyle] coordinates {(0,0.5,\wenOne) (0.25,0.75,0) (0,1,0) };

\else

\ifnum\i<21

\pgfmathsetmacro{\wenOne}{max(20-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(0,0,0) (0,0.5,\wenOne) (1,0,0)};
\addplot3[psistyle] coordinates {(0,0.5,\wenOne) (1,0,0) (0.25,0.75,0) };
\addplot3[psistyle] coordinates {(0,0.5,\wenOne) (0.25,0.75,0) (0,1,0) };
\fi
\fi
\fi


% psi2
\ifnum\i>10
\ifnum\i<21

\pgfmathsetmacro{\wenTwo}{min(\i-10,10)*\wen/10};

\addplot3[psistyle] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0.5,1,0)};
\addplot3[psistyle] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0,0.5,0)};
\addplot3[psistyle] coordinates {(0,0.5,0) (0.25,0.75,\wenTwo) (0,0,0)  };
\addplot3[psistyle] coordinates {(0,0,0) (0.25,0.75,\wenTwo) (1,0,0)  };
\addplot3[psistyle] coordinates {(0.5,1,0) (0.25,0.75,\wenTwo) (1,0,0)  };


\else

\ifnum\i<31

\pgfmathsetmacro{\wenTwo}{max(30-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0.5,1,0)};
\addplot3[psistyle] coordinates {(0,1,0) (0.25,0.75,\wenTwo) (0,0.5,0)};
\addplot3[psistyle] coordinates {(0,0.5,0) (0.25,0.75,\wenTwo) (0,0,0)  };
\addplot3[psistyle] coordinates {(0,0,0) (0.25,0.75,\wenTwo) (1,0,0)  };
\addplot3[psistyle] coordinates {(0.5,1,0) (0.25,0.75,\wenTwo) (1,0,0)  };
\fi
\fi
\fi


% psi3
\ifnum\i>20
\ifnum\i<31

\pgfmathsetmacro{\wenThree}{min(\i-20,10)*\wen/10};

\addplot3[psistyle] coordinates {(1.,2,0) (0.5,1.,\wenThree) (0.,1.,0)};
\addplot3[psistyle] coordinates {(0,1,0) (0.5,1.,\wenThree) (0.25,0.75,0)};
\addplot3[psistyle] coordinates {(0.25,0.75,0) (0.5,1.,\wenThree) (1.,0,0)};
\addplot3[psistyle] coordinates {(1.,0.,0) (0.5,1.,\wenThree) (1.,1.,0)};
\addplot3[psistyle] coordinates {(1.,1.,0) (0.5,1.,\wenThree) (1.,1.35,0)};
\addplot3[psistyle] coordinates {(1.,1.35,0) (0.5,1.,\wenThree) (1.,2.,0)};

\else

\ifnum\i<41

\pgfmathsetmacro{\wenThree}{max(40-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(1.,2,0) (0.5,1.,\wenThree) (0.,1.,0)};
\addplot3[psistyle] coordinates {(0,1,0) (0.5,1.,\wenThree) (0.25,0.75,0)};
\addplot3[psistyle] coordinates {(0.25,0.75,0) (0.5,1.,\wenThree) (1.,0,0)};
\addplot3[psistyle] coordinates {(1.,0.,0) (0.5,1.,\wenThree) (1.,1.,0)};
\addplot3[psistyle] coordinates {(1.,1.,0) (0.5,1.,\wenThree) (1.,1.35,0)};
\addplot3[psistyle] coordinates {(1.,1.35,0) (0.5,1.,\wenThree) (1.,2.,0)};
\fi
\fi
\fi



% psi4
\ifnum\i>30
\ifnum\i<41

\pgfmathsetmacro{\wenFour}{min(\i-30,10)*\wen/10};

\addplot3[psistyle] coordinates {(1,2,0) (1.,1.35,\wenFour) (0.,1.,0)  };
\addplot3[psistyle] coordinates {(1,1,0) (1.,1.35,\wenFour) (0.5,1,0) };
\addplot3[psistyle] coordinates {(1,1,0) (1.,1.35,\wenFour) (2.,1,0) };
\addplot3[psistyle] coordinates {(2,1,0) (1.,1.35,\wenFour) (1.5,1.5,0) };
\addplot3[psistyle] coordinates {(1.5,1.5,0) (1.,1.35,\wenFour) (1,2,0) };
\addplot3[psistyle] coordinates {(0.,1.,0) (1.,1.35,\wenFour) (0.5,1,0) };

\else

\ifnum\i<51

\pgfmathsetmacro{\wenFour}{max(50-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(1,2,0) (1.,1.35,\wenFour) (0.,1.,0)  };
\addplot3[psistyle] coordinates {(1,1,0) (1.,1.35,\wenFour) (0.5,1,0) };
\addplot3[psistyle] coordinates {(1,1,0) (1.,1.35,\wenFour) (2.,1,0) };
\addplot3[psistyle] coordinates {(2,1,0) (1.,1.35,\wenFour) (1.5,1.5,0) };
\addplot3[psistyle] coordinates {(1.5,1.5,0) (1.,1.35,\wenFour) (1,2,0) };
\addplot3[psistyle] coordinates {(0.,1.,0) (1.,1.35,\wenFour) (0.5,1,0) };
\fi
\fi
\fi


% psi5
\ifnum\i>40
\ifnum\i<51

\pgfmathsetmacro{\wenFive}{min(\i-40,10)*\wen/10};

\addplot3[psistyle] coordinates {(2,2.,0) (1.5,1.5,\wenFive) (1.,2,0) };
\addplot3[psistyle] coordinates {(1,1.35,0) (1.5,1.5,\wenFive) (1.,1.,0) };
\addplot3[psistyle] coordinates {(1.,1.,0) (1.5,1.5,\wenFive) (2,1.,0) };
\addplot3[psistyle] coordinates {(2,1.,0) (1.5,1.5,\wenFive) (2.,1.4,0)  };
\addplot3[psistyle] coordinates {(2.,1.4,0) (1.5,1.5,\wenFive) (2,2.,0) };
\addplot3[psistyle] coordinates {(1.,2,0) (1.5,1.5,\wenFive)(1,1.35,0) };


\else

\ifnum\i<61

\pgfmathsetmacro{\wenFive}{max(60-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(2,2.,0) (1.5,1.5,\wenFive) (1.,2,0) };
\addplot3[psistyle] coordinates {(1,1.35,0) (1.5,1.5,\wenFive) (1.,1.,0) };
\addplot3[psistyle] coordinates {(1.,1.,0) (1.5,1.5,\wenFive) (2,1.,0) };
\addplot3[psistyle] coordinates {(2,1.,0) (1.5,1.5,\wenFive) (2.,1.4,0)  };
\addplot3[psistyle] coordinates {(2.,1.4,0) (1.5,1.5,\wenFive) (2,2.,0) };
\addplot3[psistyle] coordinates {(1.,2,0) (1.5,1.5,\wenFive)(1,1.35,0) };

\fi
\fi
\fi



% psi6
\ifnum\i>50
\ifnum\i<61

\pgfmathsetmacro{\wenSix}{min(\i-50,10)*\wen/10};

\pgfmathsetmacro{\wenSix}{min(\i-50,10)*\wen/10};

\addplot3[psistyle] coordinates {(2.,2.,0) (2.,1.4,\wenSix) (1.,2,0) };
\addplot3[psistyle] coordinates {(1.5,1.5,0) (2.,1.4,\wenSix) (2.,1.,0) };
\addplot3[psistyle] coordinates {(1.,2,0) (2.,1.4,\wenSix) (1.5,1.5,0)  };


\else

\ifnum\i<71

\pgfmathsetmacro{\wenSix}{max(70-\i,0)*\wen/10};

\addplot3[psistyle] coordinates {(2.,2.,0) (2.,1.4,\wenSix) (1.,2,0) };
\addplot3[psistyle] coordinates {(1.5,1.5,0) (2.,1.4,\wenSix) (2.,1.,0) };
\addplot3[psistyle] coordinates {(1.,2,0) (2.,1.4,\wenSix) (1.5,1.5,0)  };

\fi
\fi
\fi


\end{axis}
\end{tikzpicture}

} % \foreach

\end{document}

convert -density 120 -delay 50 -loop 0 -alpha remove tex.pdf ani.gif会得到

在此处输入图片描述

相关内容