r <- rast(system.file("ex/logo.tif", package="terra"))
animate(r, n=1)
v <- vect(system.file("ex/lux.shp", package="terra"))
animate(v[1:3, ], n=1, pause=0.3)
# animate(v, vars=names(v))
s <- svc(as.lines(v[3:5,]), v, v[1:3,], as.points(v))
animate(s, col="blue", alpha=0.3, pause=0.3)
# you can save an animation to file like this
# animation::saveGIF(terra::animate(v), "animation.gif")
Run the code above in your browser using DataLab