yihui / animation

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

Error in 'saveGIF()' if 'ani.dev' is a function #133

Closed trevorld closed 3 years ago

trevorld commented 3 years ago

According to ?ani.options the ani.dev option should allow functions but currently doing so results in an error in saveGIF(). This bug should affect saveHTML() and saveVideo() as well. I'll be initiating a pull request that fixes this soon...

library("animation")
library("grid")

grob <- rectGrob(x = unit(1.5, "in"), width = unit(1.0, "in"), 
                 gp = gpar(fill = "blue", col = NA))

saveGIF(grid.draw(grob), ani.height = 200, ani.width = 200, ani.res = 100,
        ani.dev = png)

Results in

Error in as.character(pattern) : 
  cannot coerce type 'closure' to vector of type 'character'
trevorld commented 3 years ago

This doesn't replicate when I update from {animation} release v2.6 to development v2.6.1. However #134 still replicates.