A function is not really necessary. It´s actually quite simple.

library(raster)
library(animation)
setwd("c:/empty") 

logo <- raster(system.file("external/rlogo.grd", package="raster"), values=TRUE)

saveMovie(
for(i in 1:250)
{
    logo1 <- logo
    logo1[logo1<i] <- 0
    #here you could also extract a RasterLayer from a RasterStack
    plot(logo1, main=i) 
},
loop=1,
interval= 0.1,
outdir = getwd(),
moviename="logo")

Cheers,

Jacob.

--- On Sat, 13/11/10, Kevin Ummel <kevinummel@gmail.com> wrote:

From: Kevin Ummel <kevinummel@gmail.com>
Subject: [R-sig-Geo] Anyone attempted to "animate" multi-layered rasters?
To: R-sig-Geo@stat.math.ethz.ch
Date: Saturday, 13 November, 2010, 12:58

Hello,

I came across the 'animate' package, and I'm wondering if anyone has successfully adapted it to create animations of multi-layered spatial data.

This seems like a logical advance of R's spatial data visualization, especially given the prominence of NetCDF and HDR file types, but I don't want to replicate if someone else already has a function in working order...

Cheers,
Kevin

Kevin Ummel
Senior Visiting Associate, Center for Global Development
MESPOM Candidate, University of Manchester

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



      
	[[alternative HTML version deleted]]

