Inspired by these questions—
—how can one convert a PSTricks animation to an animated SVG image?
SVG animation would be nicer than GIF because SVG is a vector format that supports smooth animations and arbitrary colors.
Inspired by these questions—
—how can one convert a PSTricks animation to an animated SVG image?
SVG animation would be nicer than GIF because SVG is a vector format that supports smooth animations and arbitrary colors.
M. Gieseking's dvisvgm is the state-of-the-art utility for generating SVG from LaTeX input. Recently, dvisvgm support was added to animate.
Animated PSTricks example, picked from gif image in beamer presentation:
Compile with
latex lissajous latex lissajous dvisvgm --exact --font-format=woff --zoom=-1 lissajous
File lissajous.tex:
\documentclass[dvisvgm]{article}
\usepackage{pst-plot,animate}
\pagestyle{empty}
\begin{document}
\begin{animateinline}[%
scale=1.2,
begin={\begin{pspicture}(-2.1,-2.1)(2.1,2.1)},
end={\end{pspicture}},
controls, %palindrome, %autoplay,
poster=last
]{12}
\newframe
\multiframe{144}{rA=25+25,rB=2.5+2.5}{
\psset{algebraic,plotpoints=\rA,linecolor=red}
\parametricplot{0}{\rB}{2*sin(7*t*Pi/180)|2*cos(11*t*Pi/180)}
}
\end{animateinline}
\end{document}
there is a pdf2svg available for Linux by the distribution or from http://www.cityinthesky.co.uk/opensource/pdf2svg
But I didn't tried it for an animation.
The only way I can answer what you asked is: currently not possible, unless you write (or commission) the [extra] software needed.
Some alternatives that I use(d) for web animations:
The R animate package can output in a host of formats, but not SVG+SMIL. It can generate however LaTeX with (CTAN) animate code that can be turned into real animated PDFs. It can also generate web animations in at least a couple of ways (that are probably more generally usable than SMIL): Flash (SWF) and HTML+javascript (using jquery). More at http://www.r-project.org/conferences/useR-2010/slides/Xie.pdf (view it in Adobe's Reader for the animations to work) and http://www.inside-r.org/packages/cran/animation/docs/saveHTML has the HTML specifics. For some demos of HTML output see http://vis.supstat.com/2013/03/simulation-of-coin-flipping/ etc.
There's a "PDF" (but really EPS sequence) to SWF translator (pdf2swf, part of SWFtools) that can do METAPOST to SWF with little trouble as shown at http://melusine.eu.org/syracuse/swf/pdf2swf/ ; page in French, but with lots of examples e.g. http://melusine.eu.org/syracuse/metapost/animations/ellipse2/ You can probably hack/adapt it to source from PSTricks with a moderate amount of work, assuming SWF output instead of SMIL is fine with you.
Bonus update: Apparently there is a way to convert SWF to SVG+SMIL using MP4Box; see http://www.slideshare.net/cconcolato/streaming-of-svg-animations-on-the-web from slide 10 onward. I've just discovered that presentation, so I have no idea how well that works in practice.
Update2: It seems that the only TeX engine that has native support for SVG animations is BaKoMa, which ain't free: http://www.bakoma-tex.com/menu/svgwrite.php (The svg.sty discussed there is not the one from CTAN, but a proprietary one, which depends on SVG specials on the backend/driver that no free TeX seems to provide.) They have a demo with mostly gratuitous animations at http://www.bakoma-tex.com/samples/svgtour.svg. I would have liked to see something more useful done with that... (For the sake of completeness, the non-free version of VTeX 8 also claims some kind of support for SVG animations, again using their own specials. The examples at http://www.micropress-inc.com/svg.htm don't work out of the box on modern browsers, and VTeX itself hasn't been updated in almost a decade, so I'm not really going to try to figure out what's wrong with their examples. Looking at the source code of the SVG they generate, it seems they use Javascript for the SVG animations, unlike BaKoMa which uses SMIL, at least in the first slide of their demo.)
Practical update(3): Well, I had no trouble converting the pdf resulting from How to convert pstricks animation to GIF file? to a SWF (via pdf2swf), and it plays fine in a web browser, however getting MP4box to do anything other than crash on the resulting SWF has been a challenge insofar. You may want to stay tuned to https://sourceforge.net/p/gpac/discussion/287547/thread/ee0d387d/
I had no trouble converting the SWF with Google Swiffy (https://www.google.com/doubleclick/studio/swiffy/) though, which generates SVG (at render time, the storage format is JSON) but with Javascript for animations (and the runtime conversion from JSON to SVG). The following excerpt from the Swiffy thesis is generally relevant for converting key-frame animations to SVG:
The choice of SVG for rendering leaves us with several options to animate the SVG content. At first sight, both CSS animation and SMIL, adhere to our design goal of using a declarative representation when possible. However, both technologies provide insufficient control over the animation when support for ActionScript scripting is required. For example, although the concept of keyframes exists in CSS animation, it does not provide a mechanism to synchronise the JavaScript code to those keyframes or to modify the timeline from JavaScript, which is a basic feature required for SWF compatibility. Another limiting factor is that animation in the SWF file itself is not defined in terms of high-level transitions, but defines the position of every object at specific keyframes. Mapping these definitions back onto CSS or SMIL transitions is not always possible. Finally, these standards are not widely available: The CSS animation specification is still in working draft state, while SMIL is not implemented in the Internet Explorer browser We have therefore chosen to use JavaScript to animate SVG on the client. Although this imperative approach might be less efficient, the level of control it provides is required to match all SWF functionality.