Description Usage Arguments Details Value Author(s) Examples
Given the file names of a sequence of SVG files, this function could convert them into a Flash file (.swf).
1 2 | svg2swf(input, output = "movie.swf", bgColor = "white",
interval = 1)
|
input |
the file names of the SVG files to be converted |
output |
the name of the output SWF file |
bgColor |
background color of the output SWF file |
interval |
the time interval (in seconds) between animation frames |
This function uses the XML package in R and a subset of
librsvg (http://librsvg.sourceforge.net/) to parse
the SVG file, and uses the Ming library
(http://www.libming.org/) to implement the
conversion. Currently this function supports SVG files
created by svg()
in the
grDevices package, and
CairoSVG()
in the Cairo
package.
The name of the generated SWF file if successful.
Yixuan Qiu <yixuan.qiu@cos.name>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
if(capabilities("cairo")) {
olddir = setwd(tempdir())
svg("Rplot%03d.svg", onefile = FALSE)
set.seed(123)
x = rnorm(5)
y = rnorm(5)
for(i in 1:100) {
plot(x <- x + 0.1 * rnorm(5), y <- y + 0.1 * rnorm(5),
xlim = c(-3, 3), ylim = c(-3, 3), col = "steelblue",
pch = 16, cex = 2, xlab = "x", ylab = "y")
}
dev.off()
output = svg2swf(sprintf("Rplot%03d.svg", 1:100), interval = 0.1)
swf2html(output)
setwd(olddir)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.