Learn R Programming

spinifex (version 0.2.5)

render_gganimate: Render the slides as a gganimate animation.

Description

Takes the result of array2df() and renders them into a gganimate animation.

Usage

render_gganimate(
  fps = 3L,
  rewind = FALSE,
  start_pause = 1L,
  end_pause = 3L,
  gif_filename = NULL,
  gif_path = NULL,
  ...
)

Arguments

fps

Frames/slides shown per second. Defaults to 3.

rewind

Logical, should the animation play backwards after reaching the end? Default to FALSE.

start_pause

Number of seconds to pause on the first frame for. Defaults to 1.

end_pause

Number of seconds to pause on the last frame for. Defaults to 3.

gif_filename

Optional, saves the animation as a GIF to this string (without folderpath) . Defaults to NULL (no GIF saved). For more control call gganimate::anim_save() on a return object of render_gganimate().

gif_path

Optional, A string of the directory path (without filename) to save a GIF to. Defaults to NULL (current work directory).

...

Optionally passes arguments to the projection points inside the aesthetics; geom_point(aes(...)).

Examples

Run this code
# NOT RUN {
flea_std <- tourr::rescale(tourr::flea[, 1:6])
flea_class <- tourr::flea$species
rb <- tourr::basis_random(n = ncol(flea_std))
mtour <- manual_tour(basis = rb, manip_var = 4)
sshow <- array2df(array = mtour, data = flea_std)
# }
# NOT RUN {
render_gganimate(slides = sshow)

render_gganimate(slides = sshow, axes = "bottomleft", fps = 2, rewind = TRUE,
  col = flea_class, pch = flea_class, size = 2, alpha = .6)
  
if(F){
  render_gganimate(slides = sshow, axes = "right", fps = 4, rewind = TRUE,
    col = flea_class, pch = flea_class, size = 2,
    gif_filename = "myRadialTour.gif", gif_path = "./docs")
}
# }

Run the code above in your browser using DataLab