WLJS LogoWLJS Notebook

AnimatePlot

Wolfram Kernel
AnimatePlot[f_, {x, min, max}, {t, min, max}, opts___]

a animated version of Plot, that samples all frames and creates live animation using them.

f must return _Real or {__Real} (in a case of multiple curves)

The output is safe for exporting as a static HTML file, since it keeps all data inside the notebook. No Wolfram Kernel is required for playing the animation.

the set of parameters are not limited and accepts the following forms

Options

"SamplingPoints"

A number of points used in sampling. The default value is 200

It inherits some of Graphics options as well

AnimationRate

Specifies the number of updates per second

"TransitionType"

See TransitionType

"TransitionDuration"

See TransitionDuration

ImageSize

Accepts {width, height}

PlotStyle

Specifies colors for each curve

Epilog

Prolog

Appends graphics primitives to the plot. See Graphics

Example

Plot the simplest sine function

AnimatePlot[{Sin[x c], Sinc[x c]}, {x,-10,10}, {c,1,10,0.1}]

More examples

AnimatePlot[(*TB[*)Sum[(*|*)(*FB[*)((Sin[2π(2j - 1) x])(*,*)/(*,*)(2j))(*]FB*)(*|*), {(*|*)j(*|*),(*|*)1.0(*|*),(*|*)n(*|*)}](*|*)(*1:eJxTTMoPSmNiYGAoZgMSwaW5TvkVmYwgPguQCCkqTQUAeAcHBQ==*)(*]TB*), {x, -1,1}, {n, 1,30, 1}]

Here it is important to keep n integer, otherwise it will be converted into a symbolic sum with LerchPhi function, which is not defined at some values.

Supported output forms

Exporting as GIF or video

This feature is only available for WLJS Notebook desktop application, since we rely on our custom Electron.js renderer

You can wrap it with AnimatedImage to rasterize frames into the series of images and export to a file as GIF or video

Export["animation.gif", 
  AnimatedImage @ AnimatePlot[{Sin[x c], Sinc[x c]}, {x,-10,10}, {c,1,10,0.1}] 
]

where AnimatedImage can be extended with options alike Rasterize

Issues

Help needed!

There is no adaptive sampling implemented.

On this page