% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api.R
\name{animate}
\alias{animate}
\title{Animate a plot over a transition variable}
\usage{
animate(by, duration = 800, easing = "cubic-in-out", loop = TRUE)
}
\arguments{
\item{by}{Transition variable: an unquoted column name or a string.}

\item{duration}{Milliseconds per frame.}

\item{easing}{\code{"linear"}, \code{"cubic"}, or \code{"cubic-in-out"}.}

\item{loop}{Restart automatically after the last frame.}
}
\value{
An \link{Animation} spec to add to a plot with \code{+}.
}
\description{
Animation is a property of the plot, not a separate verb chain: the same
geometry pipeline runs once per level of \code{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.
}
\details{
Animated plots render to the interactive target (like \code{\link[=interact]{interact()}}).
\code{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)
}
