ani.options {animation} | R Documentation |
Set or query various parameters that control the behaviour of the animation, such as time interval, maximum frames, height and width, etc. This function is based on options
to set an option ani
which is a list containing the animation parameters.
ani.options(...)
... |
arguments in tag = value form, or a list of tagged values.
The tags must come from the animation parameters described
below. |
a list containing the options.
When parameters are set, their former values are returned in an
invisible named list. Such a list can be passed as an argument to
ani.options
to restore the parameter values.
png
, jpeg
, ...; default to be 480.tempdir
."images"
.ani.start
(restore with ani.stop
)png
, jpg
, ...; default to be "png"
png
, jpeg
, ...); default to be "png"
TRUE
, write a foot part in the HTML page containing information such as date/time of creation; if given a character string, it will be used as the footer message; in other cases, the footer of the page will be blank.TRUE
to interate for infinite times)
Please note that nmax
is usually equal to the number of animation frames (e.g. for brownian.motion
) but not always! The reason is that sometimes there are more than one frame recorded in a single step of a loop, for instance, there are 2 frames generated in each step of kmeans.ani
, and 4 frames in knn.ani
, etc.
This function can be used for almost all the animation functions such as brownian.motion
, boot.iid
, buffon.needle
, cv.ani
, flip.coin
, kmeans.ani
, knn.ani
, etc. All the parameters will affect the behaviour of HTML animations, but only interval
will affect animations in windows graphics device.
When R is not running interactively, interval
will be set to 0 because it does not make much sense to let R wait for a possibly very long time when we cannot watch the animations in real time.
Yihui Xie <http://yihui.name>
http://animation.yihui.name/animation:options
## Not run: # store the old option to restore it later oopt = ani.options(interval = 0.05, nmax = 100, ani.dev = "png", ani.type = "png") ani.start() opar = par(mar = c(3, 3, 2, 0.5), mgp = c(2, .5, 0), tcl = -0.3, cex.axis = 0.8, cex.lab = 0.8, cex.main = 1) brownian.motion( pch = 21, cex = 5, col = "red", bg = "yellow", main = "Demonstration of Brownian Motion",) par(opar) ani.stop() ani.options(oopt) ## End(Not run)