1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/saveSWF.R
\name{saveSWF}
\alias{saveSWF}
\title{Convert images to Flash animations}
\usage{
saveSWF(
expr,
swf.name = "animation.swf",
img.name = "Rplot",
swftools = NULL,
...
)
}
\arguments{
\item{expr}{an expression to generate animations; use either the animation
functions (e.g. \code{brownian.motion()}) in this package or a custom
expression (e.g. \code{for(i in 1:10) plot(runif(10), ylim = 0:1)}).}
\item{swf.name}{file name of the Flash file}
\item{img.name}{the base file name of the sequence of images (without any
format or extension)}
\item{swftools}{the path of SWFTools, e.g. \file{C:/swftools}. This argument
is to make sure that \code{png2swf}, \code{jpeg2swf} and \code{pdf2swf} can
be executed correctly. If it is \code{NULL}, it should be guaranteed that
these commands can be executed without the path; anyway, this function will
try to find SWFTools from Windows registry even if it is not in the PATH
variable.}
\item{...}{other arguments passed to \code{\link{ani.options}}, e.g.
\code{ani.height} and \code{ani.width}, ...}
}
\value{
An integer indicating failure (-1) or success (0) of the converting
(refer to \code{\link{system}}).
}
\description{
This function opens a graphical device first to generate a sequence of images
based on \code{expr}, then makes use of the commands in SWFTools
(\command{png2swf}, \command{jpeg2swf}, \command{pdf2swf}) to convert these
images to a single Flash animation.
}
\note{
Please download and install the SWFTools before using this function:
\url{http://www.swftools.org}
We can also set the path to SWF Tools by \code{ani.options(swftools =
'path/to/swftools')}.
\code{ani.options('ani.type')} can only be one of \code{png}, \code{pdf}
and \code{jpeg}.
Also note that PDF graphics can be compressed using qpdf or Pdftk (if
either one is installed and \code{ani.options('qpdf')} or
\code{ani.options('pdftk')} has been set); see \code{\link{qpdf}} or
\code{\link{pdftk}}.
}
\references{
Examples at \url{https://yihui.org/animation/example/saveswf/}
}
\seealso{
Other utilities:
\code{\link{im.convert}()},
\code{\link{saveGIF}()},
\code{\link{saveHTML}()},
\code{\link{saveLatex}()},
\code{\link{saveVideo}()}
}
\author{
Yihui Xie
}
\concept{utilities}
|