play3d calls a function repeatedly, passing it the elapsed
time in seconds, and using the result of the function to
reset the viewpoint.
movie3d does the same, but
records each frame to a file to make a movie.
play3d(f, duration = Inf, dev = cur3d(), ..., startTime = 0) movie3d(f, duration, dev = cur3d(), ..., fps = 10, movie = "movie", frames = movie, dir = tempdir(), convert = NULL, clean = TRUE, verbose = TRUE, top = !rgl.useNULL(), type = "gif", startTime = 0, webshot = TRUE)
A function returning a list that may be passed to
The duration of the animation
Which RGL device to select
Additional parameters to pass to
Initial time at which to start the animation
Number of frames per second
The base of the output filename, not including .gif
The base of the name for each frame
A directory in which to create temporary files for each frame of the movie
How to convert to a GIF movie; see Details
Whether to report the
Whether to call
What type of movie to create. See Details.
Whether to use the webshot2 package
for snapshots of frames. See
f will be called in a loop with the first argument
startTime plus the time in seconds since the start
(where the start is measured after all arguments have been evaluated).
play3d is likely to place a high load
on the CPU; if this is a problem, calls to
should be made within the function to release time to other processes.
play3d will run for the specified
duration (in seconds), but
can be interrupted by pressing
ESC while the RGL window has the focus.
movie3d saves each frame to disk in a filename of the form
XXX is the frame number, starting from 0.
NULL (the default) and the
magick package is installed, it will be used
to convert the frames to a GIF movie (or other format if supported). If
magick is not installed or
movie3d will attempt
to use the external
ImageMagick program to convert the
frames to a movie.
magick executable is tried
convert if that fails.
type argument will be passed to
ImageMagick to use as a file extension
to choose the file type.
convert can be a template for a command to
execute in the standard shell (wildcards are allowed). The template is
converted to a command using
sprintf(convert, fps, frames, movie, type, duration, dir)
convert = TRUE
uses the template
"magick -delay 1x%d %s*.png %s.%s". All work
is done in the directory
dir, so paths should not be needed in
the command. (Note that
sprintf does not require all
arguments to be used, and supports formats that use them in an
top = TRUE default is designed to work around an OpenGL limitation:
in some implementations,
rgl.snapshot will fail if the window
is not topmost.
As of rgl version 0.94, the
dev argument is not needed: the
f can specify its device, as
for example. However, if
dev is specified, it will be selected
as the current device as each update is played.
As of rgl version 0.95.1476,
include multiple values in a
par3d() will be called
for each of them.
play3d is called for the side effect of its repeated calls to
movie3d is also normally called for the side effect
of producing the output movie. It invisibly returns
Duncan Murdoch, based on code by Michael Friendly