Skip to content

Instantly share code, notes, and snippets.

@iUmarov
Created November 14, 2017 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iUmarov/56bae6d20d1a0a831d0b671b0422a4e2 to your computer and use it in GitHub Desktop.
Save iUmarov/56bae6d20d1a0a831d0b671b0422a4e2 to your computer and use it in GitHub Desktop.
Cartoon animation R
#install.packages("animation")
# install.packages("jpeg") ## if necessary
library(animation)
library(jpeg)
ani.options(interval = 0.5)
for(i in 1:8){
img <- paste("~/Documents/R/photo_", i, ".jpg", sep="")
img <- readJPEG(img , native = TRUE)
plot.new()
rect(0, 0, 1, 1, col = "white")
rasterImage(img, 0, 0, 1, 1)
ani.pause()
}
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment