Animate a set of pngs

animate(
  dir,
  gif = "animation.gif",
  regexp = NULL,
  glob = NULL,
  delay = 2,
  loop = TRUE,
  max_size = 1200,
  repeat_last = 2
)