ani.control {animation}R Documentation

Control the Behaviour of Animations and Validate Arguments

Description

Various arguments that control the behaviour of the animation.

Usage

ani.control(saveANI = FALSE, interval = 1, nmax = 50, 
    width = 480, height = 480, ...)
checkargs(control, ...)

Arguments

saveANI logical. Should the animation frames be saved as png files while being displayed inside R?
interval a positive number to set the time interval of the animation (unit in seconds).
nmax maximum number of steps for a loop (e.g. iterations) to create animation frames.
width width of PNG image frames (unit in px); see png
height height of PNG image frames (unit in px); see png
control a list containing animation arguments (typically generated by ani.control)
... for ani.control: other controlling arguments; for checkargs: controlling arguments not included in control.

Value

a list containing the options.

Note

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.

The function checkargs is just for the convenience of writing functions in this package (check the validity of animation arguments); it is of no use to non-developers.

Author(s)

Yihui Xie

See Also

It is used in many animation functions such as brownian.motion, boot.iid, buffon.needle, cv.ani, flip.coin, kmeans.ani, knn.ani, etc.

Examples

## Not run: 
 
ani.start() 
op = 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(control = ani.control(interval = 0.05, nmax = 100,
    height = 500, width = 600, saveANI = TRUE))
par(op) 
ani.stop() 

## End(Not run)

[Package animation version 0.2-0 Index]