Skip to main content

Animate

Wolfram Kernel
Execution environment
Animate[expr_, {u_Symbol, min_, max_}, opts___]
Animate[expr_, {u_Symbol, min_, max_, step_}, opts___]

generates a version of expr allowing automatic repeated reevaluation for each u though min, max with a defined frame rate.

warning

Avoid animating many frames of Plot or Plot3D using such expression and consider AnimatePlot instead.

For example

Animate[Row[{Sin[x], "==", Series[Sin[x], {x,0,n}], Invisible[1/2]}], {n, 1, 10, 1}, AnimationRate->3]

Portability

The same as for Manipulate, i.e. can be fully exported as Dynamic HTML.

warning

Please do not use infinite AnimationRepetitions

MMAView

MMAView wrapper allows to use native Wolfram Engine rendering engine for animating expressions, any expression. It uses a parallel kernel to rasterize the provided expression and stream updates to the frontend.

Animate[Plot[Sin[x y], {x,0,1}], {y,0,5}] // MMAView

Options

AnimationRate

Specifies frames per second. The default is 6

AnimationRepetitions

The default is Infinity

"TriggerEvent"

Specifies an EventObject used to start an animation (or restart) externally (via a button for instance)

"UpdateFunction"

Allows to alter the data generated on update or cause user-defined side-effects. The following values are expected

Function[u,
(* side effects *)
(* RETURN *)
True <- accept change
False <- prevent default
_String <- will be written instead
]

One can bypass the default method completely and rely on side effects

Module[{pts},
Animate[Graphics[{
Circle[{0,0},1],
Red, Point[pts // Offload]
}, ImageSize->Small], {t, 0, 2Pi, 0.1}, "UpdateFunction" -> Function[t,
pts = {Sin[t], Cos[t]};
False
]]
]