\documentclass{article}
\usepackage[inline]{asymptote}
%\usepackage{asymptote}
\usepackage{animate}
\begin{document}
 
Here is an inline 3D PDF movie, generated with the commands
\begin{verbatim}
pdflatex inlinemovie3
asy inlinemovie3
pdflatex inlinemovie3
\end{verbatim}

\begin{center} 
\begin{asy}
settings.render=4;
settings.prc=false;

import graph3;
import animate;
currentprojection=orthographic(1,-2,0.5);

animation A=animation("movie3");
int n=20;
for(int i=0; i < n; ++i) {
  picture pic;
  size3(pic,12cm,12cm,8cm);
  real k=i/n*pi;
  real f(pair z) {return 4cos(abs(z)-k)*exp(-abs(z)/6);}
  draw(pic,surface(f,(-4pi,-4pi),(4pi,4pi),Spline),paleblue);
  draw(pic,shift(i*6Z/n)*unitsphere,yellow);
  A.add(pic);
}
label(A.pdf("autoplay,loop",delay=20,keep=!settings.inlinetex));
\end{asy}
%Uncomment the following line when not using the [inline] package option:
%\ASYanimategraphics[autoplay,loop]{50}{movie3}{}{}
\end{center} 
\end{document}

