From: klebyn <klebyn_at_yahoo.com.br>

Date: Thu 06 Oct 2005 - 10:05:18 EST

}

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Oct 06 11:10:11 2005

Date: Thu 06 Oct 2005 - 10:05:18 EST

Hello all

I am playing with R for to make a animated GIF.

any suggestions, improvements are welcome :-)

case somebody could help me, i thanks!

Cleber N. Borges ( klebyn )

my objective:

(steps TODO)

- to save PNG files;

-----> i don't know the best way to make this;

2) transform the PNG files into GIF files (easy! no problem! ... i think ...)

3) reload the GiF files in R and use the caTools package to make a animated GIF.

############################ the code

######## reverse the STRING

strReverse <- function(x) sapply(lapply(strsplit(x, NULL), rev), paste, collapse="")

######## logotype to animate

yourLogo = "Is Nice to play with R-package "

logoWidth = 1.5

logoHeight = 2.5

L = nchar(yourLogo)

TrigSplit = 360 / L

yourLogo = strReverse(yourLogo)

posx = numeric(L)

posy = numeric(L)

for( i in 0:L){

posx[i] = logoHeight * sin(i * TrigSplit * pi / 180)
posy[i] = logoWidth * cos(i * TrigSplit * pi / 180)
}

max_x = max(posx)*1.1

max_y = max(posy)*3

min_x = min(posx)*1.1

min_y = min(posy)*3

cex = 2/(posy + 2)

idx = 1:L

for(j in 1:L-1) {

###################file = paste("CQM_",j,".png",sep="") ###################png(filename=file, bg="transparent")

plot(0,t='n', xlim=c(min_x,max_x), ylim=c(min_y,max_y), axes=FALSE, ann=FALSE, font=3 )

for( i in 1:L){text(x=posx[i], y=posy[i], labels=substr(yourLogo,idx[i],idx[i]), col='blue', cex=cex[i] ) }

idx = (append(idx[L],idx))[1:L]

Sys.sleep(0.2)

###################dev.off()

}

############## final code

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Oct 06 11:10:11 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:40:36 EST
*