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.

I'm trying to create animation of some discrete process using Manipilate:

Manipulate[**Some graphics based on very slow computations, each step is calculated slowly then the previous**], {Step, 1, 1000, 1}]

It works fine if I move Step slider with the mouse.

But if I click the 'Play' button, animation starts but a lot of steps are missing. For example, I see the picture corresponding the 1st step, then the 13th, then 51st... And sometimes I even get '$Aborted'.

Manipulate options like ContinuousAction -> False don't make any change.

How can I make Manupulate display all the steps, one by one, with "Play' button?

share|improve this question
    
Short way should be to adjust AnimationRate: {step, 1, 1000, 1, AnimationRate -> 1, Appearance -> "Open"}] –  Kuba Jan 15 at 9:53
    
But as I said computation time is different for each step, so it's impossible to find proper constant AnimationRate. –  Epik17 Jan 15 at 10:02
    
Better use Animate here and let it calculate all steps in advance –  Sjoerd C. de Vries Jan 15 at 10:44
    
@SjoerdC.deVries Thanks, it will work for sure, but in this case we need a lot of memory to store each step data :( –  Epik17 Jan 15 at 11:40
1  
Converting the graphics to a bitmap may help if the number of graphical objects is high. –  Sjoerd C. de Vries Jan 15 at 11:47

1 Answer 1

up vote 1 down vote accepted

You are looking for the option DisplayAllSteps -> True in Animate:

(* plot with a random lag *)
plot[r_] := (Pause[RandomReal[]]; Plot[Sinc[r/10 x], {x, 0, 10}])

Animate[plot[z], {z, 1, 50, 1}, DisplayAllSteps -> True]

This code fails with an $Aborted if the rendering takes more than five seconds, because of the default Dynamic timeout. Michael explained how to use DynamicEvaluationTimeout to solve this as follows:

(* plot with a longer lag *)
plot[r_] := (Pause[6]; Plot[Sinc[r/10 x], {x, 0, 10}]);

Style[
  Animate[plot[z], {z, 1, 50, 1}, DisplayAllSteps -> True],
  DynamicEvaluationTimeout -> 100
]
share|improve this answer
    
In this case I get $Aborted when Step is rather big. The problem was discussed here groups.google.com/forum/#!topic/comp.soft-sys.math.mathematica/… –  Epik17 Jan 15 at 11:50
    
@Epik17 I believe that only happens when the rendering lag is quite high; if it is that high this won't really count as an "animation" at that point. Nevertheless there should be a work-around for that; let me see if I can find it. –  Mr.Wizard Jan 15 at 11:56
    
I will be grateful if you find it. –  Epik17 Jan 15 at 12:03
1  
FYI: It's there in V7, perhaps: reference.wolfram.com/legacy/v7/note/… –  Michael E2 Jan 15 at 12:17
1  
Feel free to incorporate it. DisplayAllSteps is your contribution. I've got to take my daughter to school now and start my day. I'll think about other ways. –  Michael E2 Jan 15 at 12:40

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.