Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to simply set some parameters with sliders and click a button to start animation.

I know that I can manage this with Animate and Manipulate, but my animation is written like in this post, because I need to perform some calculations for stop condition.

So the point is that I want to start loop after setting parameters and clicking button. Is it achievable?


Ok, lets say that in the animation from linked post is some variable m

Do[p = Plot[m Cos[a x], {x, 0, 100}, Frame -> True, 
    FrameLabel -> {{None, None}, {x, 
  Style[Column[{"doing my own animation !", Cos[a x]}, 
    Alignment -> Center], 14]}}, GridLines -> Automatic];
If[a > 0.2, Break[]]; (*condition to stop*)
{a, 0.1, 1, .01}

I'd like to start this animation with button, and before that set m with slider.

share|improve this question
Welcome to Mma.SE! With the setup from the link, try Dynamic[p] on one line and Button["start", Do[...]] on another or in another cell. Please note that in its present form, this question does not include enough details for people to give specific, accurate answers. Please include code that illustrates the problem -- feel free to copy the code from the linked post if it accurately illustrates your problem. Thanks! – Michael E2 Nov 22 '13 at 11:23
The problem is that after clicking button I get animation but last frame(already done). – tobix10 Nov 22 '13 at 11:31
Note that the goal, "to start loop after setting parameters and clicking button", can be achieved with Animate and Manipulate, too. – Michael E2 Nov 22 '13 at 13:15

1 Answer 1

up vote 1 down vote accepted

To add a slider for setting m, try this:

Row[{Slider[Dynamic @ m, {0.1, 1, .01}], "  ", Dynamic @ m}]


topLbl = 
  Style[Column[{"Doing my own animation!", Dynamic @ m Cos[a x]}, Alignment -> Center], 14];

    p = Plot[m Cos[a x], {x, 0, 100},
      Frame -> True,
      FrameLabel -> {{None, None}, {x, topLbl}},
      GridLines -> Automatic];
    If[a > 0.2, Break[]];
    {a, 0.1, 1, .01}],
  Method -> "Queued"]




share|improve this answer

Your Answer


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.