The grammar of graphics as implemented in the 'ggplot2' package has been successful in providing a powerful API for creating static visualisation. In order to extend the API for animated graphics this package provides a completely new set of grammar, fully compatible with 'ggplot2' for specifying transitions and animations in a flexible and extensible way.
animate() function documentation describes how to specify how the
animation is rendered, whereas the documentation for the different transition
transition_states(), describe how to declare the animation.
Apart from the included documentation there is also a few web ressources worth mentioning:
The gganimate wiki includes user supplied example walkthroughs
The learngganimate project by rOpenSci Labs includes a long range of detailed explorations of the different gganimate functions