This transition treats each visual element as an event in time and allows you to control the duration and enter/exit length individually for each event.

  end = NULL,
  range = NULL,
  enter_length = NULL,
  exit_length = NULL


start, end

The unquoted expression giving the start and end time of each event. If endis NULL the event will be treated as having no duration.


The range the animation should span. Defaults to the range of the events from they enter to they have exited.

enter_length, exit_length

The unquoted expression giving the length to be used for enter and exit for each event.

Label variables

transition_components makes the following variables available for string literal interpretation, in addition to the general ones provided by animate():

  • frame_time gives the time that the current frame corresponds to

Object permanence

transition_events does not link rows across data to the same graphic element, so elements will be defined uniquely by each row and its specific start, end, enter and exit.

Computed Variables

It is possible to use variables calculated by the statistic to define the transition. Simply inclose the variable in stat() in the same way as when using computed variables in aesthetics.


data <- data.frame(
  x = 1:10,
  y = runif(10),
  begin = runif(10, 1, 100),
  length = runif(10, 5, 20),
  enter = runif(10, 5, 10),
  exit = runif(10, 5, 10)

anim <- ggplot(data, aes(x, y)) +
  geom_col() +
  transition_events(start = begin,
                    end = begin + length,
                    enter_length = enter,
                    exit_length = exit) +
 enter_grow() +
 exit_drift(x_mod = 11) +