# Animation of a 2D graph: animate

### 7.21.1 Animation of a 2D graph: animate

The animate command creates two-dimensional animations using graphs of functions depending on a parameter. (See also Section 7.5.)

- animate takes three mandatory arguments and two optional arguments:
  - expr, an expression involving two variables, one of which will be regarded as the parameter.
  - var the name of the (non-parameter) variable in the expression, which can also specify a range of values var=a..b.
  - param the name of the parameter, which can also specify a range of values.
  - Optionally, frames=n, where n is an integer specifying the number of frames.
  - Optionally, opt, which can be xstep=n to specify the discretization step or nstep=n to specify the number of points used to graph.
- animate(expr,var,param,frames=n ⟨opt⟩) draws an animation consisting of graph of the function as the parameter varies.

#### Examples.

- animate(sin(a*x),x=-pi..pi,a=-2..2,frames=10,color=red)
  Output:
  The output is an animation beginning with: