Learn R Programming

animation (version 0.2-0)

ani.control: 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.

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

Run this code
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()

Run the code above in your browser using DataLab