Animation is a property of the plot, not a separate verb chain: the same geometry pipeline runs once per level of by, and the interactive target plays the resulting frames with a scrubber and play/pause control. Because frames are ordinary geometry buffers, positions are interpolated by the player rather than recomputed.

animate(by, duration = 800, easing = "cubic-in-out", loop = TRUE)

Arguments

by

Transition variable: an unquoted column name or a string.

duration

Milliseconds per frame.

easing

"linear", "cubic", or "cubic-in-out".

loop

Restart automatically after the last frame.

Value

An Animation spec to add to a plot with +.

Details

Animated plots render to the interactive target (like interact()). render(p, target = "static") still produces a static SVG of the whole data, so animation never blocks a static export.

Examples

d <- data.frame(
  x = rep(1:5, 3), y = c(1:5, (1:5)^1.5, (1:5)^2),
  step = rep(c(1, 2, 3), each = 5)
)
p <- ggnext(d, aes(x, y)) + geom_point(size = 5) + animate(step)
html <- render(p)