Skip to content

Instantly share code, notes, and snippets.

@16EAGLE
Created April 25, 2019 14:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 16EAGLE/8237db3ea0f6e773e8d47bf4ebb201b6 to your computer and use it in GitHub Desktop.
Save 16EAGLE/8237db3ea0f6e773e8d47bf4ebb201b6 to your computer and use it in GitHub Desktop.
Short moveVis example on how to hold the last frame of an animation for a defined time and make it look good by using path_fade
# use moveVis >= 0.10.2 for this example (does not work with CRAN version 0.10.1)
# remotes::install_github("16eagle/moveVis")
library(moveVis)
library(move)
data("move_data")
# align movement to unique times and regular resolution
m <- align_move(m = move_data, digit = 0, res = 4, unit = "mins")
# create frames
# using path_fade = T to let paths disappear towards the last frame and thus only showing traces on the last frame
frames <- frames_spatial(m, map_service = "mapbox", map_type = "satellite", map_token = "YOUR_MAPBOX_TOKEN",
equidistant = F, path_colours = c("red", "green", "blue"), path_fade = T, trace_show = T) %>%
add_labels(x = "Longitude", y = "Latitude") %>%
add_northarrow(colour = "white", position = "bottomright") %>%
add_scalebar(colour = "white", position = "bottomleft") %>%
add_timestamps(type = "label") %>%
add_progress(size = 2)
# animate frames with an end_pause of 2 seconds (holding last frame for 2 seconds)
animate_frames(frames, out_file = "moveVis.gif",
width = 850, height = 550, end_pause = 2, overwrite = T)
@16EAGLE
Copy link
Author

16EAGLE commented Apr 25, 2019

result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment