This is an app that is using gganimate within an R Shiny app
ggplot2 implemented the description of animation into the graphics via gganimate. It can be done by providing a range of new classes that can be added to the plot object in order to change with time.
The boxplot of fuel consumption (https://gganimate.com/) is a function of cylinders and can be used to transition between the number of gears in the car. We use transition_states and provide a relative length to use for transition and state view, as this is a discrete split. There are states missing a box because not all combinations of data is present. When a box appears, it should fade into view while at should shrink away. We decided to use a sinusoidal easing for our aesthetic needs.
The way ggplot2 renders its output is similar to gganimate’s way of doing it. The frame is rendered by the function which passes it to a renderer function which combines them to the final animation. A simple wrapper around a path to a Gif file is what the default renderer returns. The last_animation function is available if the animation has been called as part of the print. In order to save the animation to a specific location, you can use the anim_save function which, like ggplot2,:ggsave, defaults to taking the last rendered animation and writing it to a file.