# Smooth framerate in Mathematica animations?

I'm trying to figure out how to get animations to render smoother in Mathematica. I'm very new to this but I'd like to get a 30fps animation of something. Here's a simple example:

Animate[Plot[Sin[a*x],{x,-2Pi,2Pi}],{a,-1,1,.05},RefreshRate->40]

However, this is not a smooth animation at all. I tried manipulating both step size and refresh rate, but neither seem to work. Am I missing something? I tried this both in cloud and desktop.

Generate the slides outside of the Animate, i.e.

slides = Table[Plot[Sin[a*x], {x, -2 Pi, 2 Pi}, PlotRange -> {{-2 Pi, 2 Pi}, {-1, 1}}],
{a, -1, 1, .01}];
Animate[slides[[i]], {i, 1, 201, 1}, RefreshRate -> 40]


Otherwise, Animate will try to generate them on the fly, which can slow things down.

Hopefully this helps achieve what you're after.

• Thanks for the response! This still seems to be giving me very slow framerates. – rb612 Sep 20 '17 at 4:52
• Maybe my computer is faster so I didn’t notice that. Perhaps export the slides as a GIF, at which point they’d be at a standard speed? – ktm Sep 20 '17 at 4:53
• This works! Thanks! Why does the methods I presented in my question not work? – rb612 Sep 20 '17 at 5:15
• @rb612 "Otherwise Animate will try to generate them on the fly, which can slow things down." – ktm Sep 20 '17 at 13:33

ListAnimate is probably what you're looking for. Set up your slides:

slides = Table[
Plot[Sin[a*x], {x, -2 Pi, 2 Pi},
PlotRange -> {{-2 Pi, 2 Pi}, {-1, 1}}], {a, -1, 1, 0.05}];


Then ListAnimate allows you to specify the frames per second directly in the second argument:

ListAnimate[slides, 40]


Obviously, you can mess with the stepsize in your Table to get the length of the animation right.

• Thank you for the answer! This looks like it should work, but the animation is being generated when I call it, so it's still running at a few fps. It won't even run when I'm at 40fps – rb612 Sep 20 '17 at 4:51
• @rb612 It won't be re-generating the plots when you call ListAnimate. ListAnimate just runs through whatever list you give it. All I can think is that there's something else sucking up your resources (unless you're using SetDelayed, :=, or something). – aardvark2012 Sep 20 '17 at 8:00