Skip to contents

This function adds a progress bar to frames created with frames_spatial.

Usage

add_progress(frames, colour = "grey", size = 1.8, y_nudge = 0, verbose = TRUE)

Arguments

frames

an object of class moveVis created with frames_spatial.

colour

character, progress bar colour.

size

numeric, progress bar line size (line width).

y_nudge

numeric, amount of vertical distance to move the progress bar (default: top of plot area).

verbose

logical, if TRUE, messages and progress information are displayed on the console (default).

Value

A frames object of class moveVis.

Author

Jakob Schwalb-Willmann

Examples

library(moveVis)
library(move2)
library(terra)

data("move_data", package = "moveVis")
r <- readRDS(example_data(file = "raster_NDVI.rds"))

# align movement
m <- align_move(move_data, res = units::set_units(4, "min"))
#> Temporal resolution of 4 [min] is used to align trajectories.

# create frames and add northarrow
frames <- frames_spatial(m, r, r_type = "gradient", fade_raster = TRUE) %>% 
  add_progress()
#> Processing input data...
#> Approximated animation duration: ≈ 7.52s at 25 fps using 188 frames
#> CRS (geodetic):   WGS 84
#> Assigning raster maps to frames...
frames[[100]]


# or in white at another position
frames <- frames_spatial(m, r, r_type = "gradient", fade_raster = TRUE) %>% 
  add_progress(colour = "red", size = 2.5)
#> Processing input data...
#> Approximated animation duration: ≈ 7.52s at 25 fps using 188 frames
#> CRS (geodetic):   WGS 84
#> Assigning raster maps to frames...
frames[[100]]