acdc_animate_record: Create a html animation of the AC/DC algorithm(s)

View source: R/acdc_analyse_record.R

acdc_animate_recordR Documentation

Create a html animation of the AC/DC algorithm(s)

Description

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.

Usage

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,
  ...
)

Arguments

expr_param

A named list of arguments, passed to acdc_plot_record, to create plots.

dir

(optional) A string that defines the directory in which to save files. If unsupplied, if available, dir is taken from html_name using dirname.

html_name

A string that defines the name of the html file (see ‘htmlfile’ argument in saveHTML).

image_name

A string that defines the names of the individual .png files creates (see ‘img.name’ argument in saveHTML).

html_title, html_description

Character strings that provide a title and a description that are displayed within the html animation (see ‘title’ and ‘description’ arguments in saveHTML).

navigator

A logical variable that defines whether or not to add a navigator panel to the animation (see ‘navigator’ argument in saveHTML).

ani_height, ani_width, ani_res

Numbers that define the size and the resolution of the animation (see ‘ani.height’ ‘ani.width’ and ‘ani.res’ arguments in ani.options).

interval

A number that defines the time interval between sequential frames (see ‘interval’ argument in ani.options).

verbose

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.

Details

This function requires the animation package.

Value

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.

Author(s)

Edward Lavender

Examples

dir_current <- getwd()
setwd(tempdir())
acdc_record <- acdc_simplify(dat_acdc)
acdc_animate_record(
  expr_param =
    list(
      record = acdc_record,
      add_coastline = list(x = dat_coast, col = "darkgreen"),
      plot = 1:5,
      fix_zlim = FALSE
    )
)
setwd(dir_current)

edwardlavender/flapper documentation built on Jan. 22, 2025, 2:44 p.m.