Try the following code that compiles the PSTricks code behind the scene. You just need to type pdflatex -shell-escape main in your terminal or DOS command window.
In the directory in which this input file exists, you will get GIF animation, PDF animation, PNG frames. Make sure that you have installed ImageMagick (the latest version is recommended to make sure that remove option is available).
% this filename is main.tex
% compile it with "pdflatex -shell-escape main" (without the quotes)
\documentclass[preview,border={7pt 0pt 7pt 0pt}]{standalone}
\usepackage{filecontents}
\begin{filecontents*}{WaterDrop.tex}
\documentclass[pstricks,border=3pt]{standalone}
\usepackage{pstricks-add}
\def\N{15}
\begin{document}
\psLoop{20}{%
\begin{pspicture}[showgrid=false](-2,-2)(2,5)
\psclip{\psbezier[linestyle=none](0,5)(-6.8,-4.3)(6.8,-4.3)(0,5)}
\psLoop{\N}{
\rput(!rand 21 mod 10 div 1 sub rand 51 mod 10 div 1 sub){$+$}
\rput(!rand 21 mod 10 div 1 sub rand 51 mod 10 div 1 sub){$-$}}%
\endpsclip
\psbezier[linecolor=orange](0,5)(-6.8,-4.3)(6.8,-4.3)(0,5)
\end{pspicture}}
\end{document}
\end{filecontents*}
\immediate\write18{latex WaterDrop}
\immediate\write18{dvips WaterDrop}
\immediate\write18{ps2pdf WaterDrop.ps}% sometimes you need to disable auto rotate in ps2pdf. Please follow up if you really need it!
% delete auxiliary files generated by the 3 commands above.
% cmd /c del WaterDrop.ext is Windows command, adapt it to other OS.
\makeatletter
\@for\x:={tex,dvi,ps,log,aux}\do{\immediate\write18{cmd /c del WaterDrop.\x}}
\makeatother
% convert to GIF animation
\immediate\write18{convert -delay 100 -loop 0 -density 200 -alpha remove WaterDrop.pdf WaterDrop.gif}
% convert to PNG
\makeatletter
\immediate\write18{convert -density 200 -alpha on WaterDrop.pdf WaterDrop-\@percentchar02d.png}
\makeatother
\usepackage{animate}
\begin{document}
%\animategraphics[controls,autoplay,loop,scale=<integer>]{<frame rate>}{<PDF filename without extension>}{<left blank>}{<left blank>}
\animategraphics[controls,autoplay,loop,scale=1]{3}{WaterDrop}{}{}
\end{document}
pdflatexinstead oflatex. I haven't used anything other thanpdflatex. What's the output I should expect while usinglatex? I tried opening the .dvi file that was generated but it shows an unexpected result. While scrolling down on the .dvi file I got the error: – Shashank Sawant Sep 24 '12 at 01:54