Goal
To control the animation using start/stop/pause buttons.
Problem
The animation
package can save the created animation as a HTML page using the saveHTML()
function (example here). But it requires "expr
= an R expression to be evaluated to create a sequence of images" as the first argument.
However, gganimate
creates a gganim
object, and I can't seem to find a function that can save the animation as a HTML page with buttons. The available anim_save()
function does not save as HTML. Is there a workaround to do that?
Example code for animation
If you have any ideas please share. For your reference, I'm putting below the gganimate
code from its website.
library(ggplot2)
library(gganimate)
ggplot(mtcars, aes(factor(cyl), mpg)) +
geom_boxplot() +
# Here comes the gganimate code
transition_states(
gear,
transition_length = 2,
state_length = 1
) +
enter_fade() +
exit_shrink() +
ease_aes('sine-in-out')