yihui / animation

A gallery of animations in statistics and utilities to create animations
https://yihui.org/animation/
206 stars 60 forks source link

saveHTML recycles animations #43

Closed cpsievert closed 10 years ago

cpsievert commented 10 years ago

I found the result of the following code to be surprising:

library(animation)
saveHTML(for (i in 1:10) plot(rnorm(10)) )
saveHTML(for (i in 1:5) plot(rnorm(10), col=2) )

The second animation has 10 frames. The last five frames are the same as the last five frames in the first animation. This seems to be the case whenever a shorter animation is called after a longer animation. I suppose this should be considered a bug?

cpsievert commented 10 years ago

OK, this will serve as a reminder to read documentation before embarrassing myself publicly. The img.name option serves a reasonable solution to my problem.

library(animation)
saveHTML(for (i in 1:10) plot(rnorm(10)),  img.name="ani1")
saveHTML(for (i in 1:5) plot(rnorm(10), col=2), img.name="ani2" )
yihui commented 10 years ago

Great. One way of fixing a bug is to simply wait for two weeks. That said, I always want to redesign this package since there are a lot of "hidden features" and inconsistencies. It was my first R package after all.

cpsievert commented 10 years ago

Haha. I'm sure @rstudio has you working on much more important issues ;)