Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

ListAnimate is fairly similar to Manipulate, but while Manipulate has a simple way to request an initial value for the manipulation parameter, I haven't found a way to tell ListAnimate to start with a certain value.

Consider a simple example:

ListAnimate[Table[Plot[Sin[p x], {x, -1, 1}], {p, 1, 4}]]  

vs.

Manipulate[Plot[Sin[p x], {x, -1, 1}], {p, Range[1, 4]}]  

These simple examples seem virtually the same (I didn't bother to change the Manipulate Control to a slider), but in fact, they are different. ListAnimate is essentially pre-compiled. In my research, I want to do something similar with very complex plots which take a long time to produce. Manipulate re-calculates it's arguments when the manipulator is adjusted. We don't notice it here because Sin[p x] is so trivial. But with a complicated plot, it's no good. Conversely, with ListAnimate, it may take 15 minutes or more to run the code, once and for all, and then I can quickly scan through all the output smoothly.

I looked through the options for ListAnimate and, for example, I can begin the output paused with ,AnimationRunning -> False.

Is there a way to make the animation begin with not the first element but a chosen one?

TL;DR

Make

ListAnimate[Table[Plot[Sin[p x], {x, -1, 1}], {p, 1, 4}], AnimationRunning -> False]  

begin with output of Plot[Sin[3 x], {x, -1, 1}]

share|improve this question
1  
You could use ListAnimate[RotateLeft[Table[...],n],....] –  belisarius Apr 11 at 19:38
    
An elegant solution in some cases, most likely (strictly speaking, it does solve the question as I posed it, I guess). The problem is that in my case, the parameter that varies over the table elements is an ordinal quantity (varying, say, from 0 to 1) and doing this shifts it to where the animation bar left to right no longer corresponds to the parameter varying from 0 to 1. –  Steve Apr 11 at 19:44
    
I'm hoping to be able to retain the original order, but simple have the control not begin at the left of the slider, but at a chosen point in the middle perhaps. –  Steve Apr 11 at 19:45
2  
why not frames = Table[Plot[Sin[p x],{x,-1,1}],{p,1,4}]; Manipulate[Part[frames,p],{{p,3},1,4,1}]? If you are going to precompute the frames anyway... –  chuy Apr 11 at 19:53
1  
Also, not completely equivalent, but ... Animate[Plot[Sin[p x], {x, -1, 1}], {{p, 3}, 1, 4, 1}, AnimationRunning -> False] –  belisarius Apr 11 at 19:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.