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.
aaragon
  • 3,041
  • 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? –  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

1 Answers1

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. –  May 22 '18 at 16:41
  • @aaragon I updated my answer. –  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
  • @aaragon Beamer comes with its own animation facilities. You will essentially have to do \animate<2-62> \animatevalue<2-62>{\i}{0}{60} \transduration<2-62>{0.4} or something along those lines. As for the axis, there are many options to control things. One option is to draw a bulky plot, e.g. a sphere, with draw=none that is so large that the size changes of the other elements and the rotations do not matter. –  May 22 '18 at 20:04
  • @aaragon I added a beamer version. –  May 22 '18 at 20:32
  • @marmot I have updated my questions. I still have a couple of things to resolve so I would really appreciate your help. – aaragon May 23 '18 at 08:54
  • @aaragon I am confused. You said it should be a beamer code. Why is "your" new code using the standalone class? And note that I am not supposed to answer follow-up questions in the same question. However, if you make a final request, I will look at it later that day. –  May 23 '18 at 11:45
  • This movie will be embedded in a beamer presentation (it's not a beamer document), so I'm not sure your beamer solution was appropriate for this. So in the end I decided to create a gif animation for that. If you can help tackle the two bullets in my edited questions it would be great. – aaragon May 23 '18 at 12:12
  • @aaragon I am looking at this now and I find that convert -density 120 -delay 50 -loop 0 -alpha remove tex.pdf ani.gif works, what convert options are you using? –  May 23 '18 at 14:52
  • I was using the command line provided in the site convert -layers OptimizePlus -delay 75 slide-0?.png slide-1[01234].png -delay 300 slide-1[567].png -loop 0 slides.gif – aaragon May 23 '18 at 14:59
  • Indeed your command works much better. – aaragon May 23 '18 at 15:07
  • @aaragon I updated my answer. All I did is to add two objects with draw=none that are a bit larger than the stuff you're plotting. This prevents the jumps. (I still don't get why you do not use the beamer package, if you compile the beamer part of my answer and view it with acroread you'll get a nice animation....) –  May 23 '18 at 15:30
  • Indeed that removed the jumps between frames. It's a nice animation. The only thing I dislike is the fact that the background mesh changes size towards half the animation because of the perspective. Perhaps this can go away if the white with draw=none is a circle that circumscribes the mesh? I'll try the beamer version too. It's just that this animation is supposed to be part of the slide, to which I have to add equations and other stuff. It will take forever to compile the slide, so I'll have to protect it with conditional compilation while I work on the rest of the presentation. – aaragon May 23 '18 at 16:24
  • Actually you had added a circle that circumscribes the mesh already, so I have no clue how to prevent the background mesh from changing size. – aaragon May 23 '18 at 16:49
  • @marmot I checked the beamer version and the file has 2.9MB with the animation only, so I guess this is a no-go. – aaragon May 23 '18 at 18:43
  • @aaragon Yes, but this is merely a consequence of your colormap, which might not be necessary. For instance, if you change to colormap/blackwhite, the size will decrease by a factor 3 or so. And in principle you could do the same with tikz-3dplot or with the 3d library, which will almost certainly result in a much smaller file and a much shorter compilation time... but this certainly deserves a separate question. –  May 23 '18 at 20:29