R/acdc_analyse_record.R
acdc_animate_record.Rd
This function is a simple wrapper for acdc_plot_record
and saveHTML
which creates an animation of the AC* algorithm(s) over time. To implement this function, a named list of arguments for acdc_plot_record
, which creates the plots, must be supplied. This is embedded within saveHTML
, which creates a folder in the specified directory named `images' that contains a .png file for each time step and an animation as a .html file.
acdc_animate_record(
expr_param,
dir = NULL,
html_name = "ACDC_algorithm_demo.html",
image_name = "ACDC",
html_title = "Demonstration of the ACDC Algorithm",
html_description = "",
navigator = FALSE,
ani_height = 1000,
ani_width = 1000,
ani_res = 150,
interval = 0.1,
verbose = FALSE,
...
)
A named list of arguments, passed to acdc_plot_record
, to create plots.
(optional) A string that defines the directory in which to save files. If unsupplied, if available, dir
is taken from html_name
using dirname
.
A string that defines the name of the html file (see `htmlfile' argument in saveHTML
).
A string that defines the names of the individual .png files creates (see `img.name' argument in saveHTML
).
Character strings that provide a title and a description that are displayed within the html animation (see `title' and `description' arguments in saveHTML
).
A logical variable that defines whether or not to add a navigator panel to the animation (see `navigator' argument in saveHTML
).
Numbers that define the size and the resolution of the animation (see `ani.height' `ani.width' and `ani.res' arguments in ani.options
).
A number that defines the time interval between sequential frames (see `interval' argument in ani.options
).
A logical or character variable that defines whether or not, or what, to write as a footer to the html animation (see `verbose' argument in ani.options
).
Additional arguments passed to ani.options
.
The function produces an animation in .html format in the specified directory. A folder named `images' is also produced which contains the images for each time step. The `css' and `js' folders are also produced by saveHTML
which creates the animation.
This function requires the animation
package.
dir_current <- getwd()
setwd(tempdir())
acdc_record <- acdc_simplify(dat_acdc)
#> acdc_simplify() implemented for type = 'acs'.
acdc_animate_record(
expr_param =
list(
record = acdc_record,
add_coastline = list(x = dat_coast, col = "darkgreen"),
plot = 1:5,
fix_zlim = FALSE
)
)
#> flapper::acdc_plot_record() called...
#> ... Checking function inputs...
#> ... Defining data for background plot...
#> ... Setting plotting window...
#> ... Making plots for each time step ...
#> Warning: Nothing to summarize if you provide a single RasterLayer; see cellStats
#> Warning: Nothing to summarize if you provide a single RasterLayer; see cellStats
#> Warning: Nothing to summarize if you provide a single RasterLayer; see cellStats
#> Warning: Nothing to summarize if you provide a single RasterLayer; see cellStats
#> Warning: Nothing to summarize if you provide a single RasterLayer; see cellStats
#> HTML file created at: ACDC_algorithm_demo.html
setwd(dir_current)