3

I would like to create a movie using tikz images, but it seems a lot of work without some sort of automation. I have a background mesh of triangles, and a red line crossing them. At each of the intersection points I would like to raise a pyramidal function (one for each of the 6 intersection points, and each happening one after another sequentially). As each of these functions raise, I would also like to rotate the viewpoint the pyramidal functions can be seen clearly. So far this is what I have:

\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}

where I have all the pyramidal functions but I have commented all of them but one. One function looks like this:

enter image description here

So my questions is mainly how do I get a movie out of this code. Can I do this somehow within the code I wrote or do I have to create several files using some sort of scripting language (perhaps using loops)? How do I handle the view point? Luckily enough I have 6 functions, so if each function raises to its maximum value in 10 increments, that would give me 60 frames (so I could divide a full rotation of the mesh by 60).

UPDATE

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}

I have a few issues still I don't know how to resolve:

  • The transition between each frame is not smooth. The width each frame is also changing so it's not constant. In particular, halfway through the animation there's a big jump. There must be a way to specify the outer dimensions of the 3-D object I want to visualize so that the center of the mesh is always centered. Is this possible?
  • I do not know how to convert the resulting pdf file to an animated gif. I tried using convert, following directions found here, but at some point the gif couldn't get created giving error convert: images are not the same sizeslide-00.png' @ error/layer.c/OptimizeLayerFrames/964.` I assume this error is given because of my previous remark. Also, whatever gif file created had all frames superposing one another.
  • 1
    The animate package allows you to create pdf animations, and Alex G's method can be used to create animated gifs. Which output format are you after? – marmot May 22 '18 at 15:12
  • It could be in any format, but I wanted to use tikz to draw each of the frames. – aaragon May 22 '18 at 15:30
6

OLD ANSWER: (after clarifications in the comments): With growing functions and changing viewing angle.

\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}

enter image description here

For fun: a beamer version. (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}

enter image description here

UPDATE: As for the additional request, consider

\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}

with convert -density 120 -delay 50 -loop 0 -alpha remove tex.pdf ani.gif you'll get

enter image description here

  • Will this create a single .pdf file that I have to convert to a movie? In each of your frames functions raise immediately, but I would scale them from 0 to their maximum value in 10 frames. Then I would continue with the next one (while the former goes down), and so on. So if you see, it would require 60 frames total to raise all pyramids. I thought about the view point, and since it would require 60 frames, I could divide an entire rotation of the mesh (360 degrees) by 60, so each frame every 6 degrees, so it would be view={\theta}{45} where \theta is the actual view angle. – aaragon May 22 '18 at 16:10
  • @aaragon I still do not now your desired output format. At this point, this creates a bunch of pdf frames, that can be converted to a gif movie, say. You are using pgfplots, which is very powerful, but there are expansion issues that prevented me from using the animate package in a straightforward way. (I am not saying it cannot be done but my first attempt was not successful.) The increment can be done in a straightforward way, wait a few minutes, I'll do that. But as long as I don't know where the journey should go I won't put too much effort into it. – marmot May 22 '18 at 16:41
  • @aaragon I updated my answer. – marmot May 22 '18 at 17:01
  • 1
    @marmot Wonderful, excellent code. Very very good. +1. – Sebastiano May 22 '18 at 17:27
  • I will try to take it from there and post an update with the result. I think I can manage to do everything else. If I wanted to embed the movie within a beamer presentation, what would be the best output? One more question: I see your mesh is somehow going down. Is there a way to avoid that by having the mesh always centered? – aaragon May 22 '18 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.