Home > Uncategorized > Animation

Animation

A couple hours work and we now have animations of the global anomalies:

Created with the animation package in R.  Once I figured out the code examples and fiddling about I was able to get  the program to output an Html animation complete with java based playback controls.

A little work in iPhoto and we have a movie with stupid colors, bad music and a slow frame rate

Write if you wanna know how it works and I’ll integrate this code into the  system

library("animation")

source("Global.R")

world <- loadGlobe("LandOcean")

layerNames(world)<- as.character(TIMELINE)

dir <- "Animation"

if(file.exists(dir))stop(cat(dir, "exists create new dir"))

dir.create(dir)

ani.options(nmax=nlayers(world),ani.width=1080,ani.height=540,

ani.type ="png",outdir=dir,imgdir="IMAGES",

filename = "world.html",ani.dev=png,title="Global Anomaly",

description ="world animation",autobrowse=TRUE,interval=.1)

ani.start()

aninmateWorldMap(world)

ani.stop()

Very simply. We start by loading animation package. Now, one nasty thing is that this package loads MASS package which them summarily CLOBBERS the key routine in raster that I use ( “area”) That bug destroyed about 2 days of my time, but once I figured it out there are various solutions. I employ one of them here ( a Hack ) where I allow “raster” to load second and CLOBBER the package that clobbered it. take that namespace thief.

next we set up animation configuration. ani.options(). Then we call start. ani.start() Then we make any drawing commands we want. In this case I cycled through the layers of the brick and plot each out as a *.png 1320 frames. Then we call ani.stop() and a browser is launched to see the page. The html page comes with player controls. then I pulled the images into IPhoto and merely output them as a .mov.   I ws going to fuss around with ImageMagick or graphicsmagick but my luck at doing unix compiles on this MAC has been close to ZERO ( I think my linux partition may be toast) I should probably give Wolfgang Spraul or Jon Phillips a hollar.

About these ads
Categories: Uncategorized
  1. ray
    May 13, 2011 at 8:53 PM

    Thanks for the idea about using iPhoto!–that worked smoothly.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 38 other followers

%d bloggers like this: