Academic_animation

ANDY

2017/10/17

Animation Gallery

1. HKB Landscape

require(animation)
saveGIF({
   x <- seq(-240, 240, length= 201)
   ani.options(interval = 0.1, nmax = length(x))
  par(mar = c(3, 3, 2, 0.5), mgp = c(2, 0.5, 0), tcl = -0.3, cex.axis = 0.8, 
      cex.lab = 0.8, cex.main = 1)
  for (i in seq(0,1,0.005)) {
    a<-1
    b<-i
    y <- -a*cos(x/180*3.14)-b*cos(2*x/180*3.14)
    plot(x,y,main=paste0("b/a=",b/a),xaxt="n")
    ani.pause()  ## pause for a while ('interval')
    axis(side=1,at=c(-180,0,180),lwd=3)
  }
},movie.name = "2d_HKB.gif",
other.opts = "-pix_fmt yuv420p -b 300k",convert = 'gm convert', 
ani.width = 550, ani.height = 350)
## [1] TRUE
2d_hkb

2d_hkb

require(animation)
saveGIF({
  ani.options(interval = .08, nmax = length(x))
  par(mar = c(3, 3, 2, 0.5), mgp = c(2, 0.5, 0), tcl = -0.3, cex.axis = 0.8, 
      cex.lab = 0.8, cex.main = 1)
  for(i in 1:180){
    x <- seq(-240, 240, length= 51)
    y <- seq(0,1,0.02)
    f <-function(x,y){ -cos(x/180*3.14)-y*cos(2*x/180*3.14) }
    z <- outer(x, y, f)
    persp(x, y, z,  theta = 150 + (i * 0.5), phi = 35, expand = 0.5, col = "lightblue",
          axes=T, ticktype="detailed",
          zlab = c("V"),xlab = c("raltive phase"),ylab = c("b/a"))
  }
}, movie.name = "landscape_HKB.gif",
other.opts = "-pix_fmt yuv420p -b 4000k",convert = 'gm convert') 
## [1] TRUE
3d_hkb

3d_hkb