2
$\begingroup$

I have a Manipulate with bookmarks which do not set the value of all parameters; only some. A MWE is:

Manipulate[{x, y}, {x, 0, 1}, {y, 0, 1}, 
  Bookmarks -> {"beginning" :> {x = 0}, "halfway" :> {x = 0.5}, "end" :> {x = 1}}]

The problem comes when I click on "Animate bookmarks". Ideally, I would like the animation of bookmarks to keep the current value of parameter y (i.e. the unset parameter). However, this is what I get in Mathematica 11.3:

enter image description here

My naive (and unsuccessful) attempt to solve this was:

Manipulate[{x, y}, {x, 0, 1}, {y, 0, 1}, 
  Bookmarks -> {"beginning" :> {x = 0, y = y},"halfway" :> {x = 0.5, y = y}, "end" :> {x = 1, y = y}}]

I would really appreciate any help on this. If it is not possible to solve this problem, do you know if there is any way of disabling the "Animate bookmarks" feature?

Thank you so much for reading up to here, Best, Luis

$\endgroup$
1
$\begingroup$

The following seems to work :

y0=0.3;
Manipulate[
  y0=y;Column[{x, y}], {x, 0, 1}, {{y,y0}, 0, 1}, 
  Bookmarks -> {"beginning" :> {x = 0,y = Dynamic[y0]}, "halfway" :> {x = 
     0.5,y = Dynamic[y0]}, "end" :> {x = 1,y = Dynamic[y0]}},
  AutorunSequencing-> {1}]  

enter image description here

Note that my understanding of "why" it works is limited.

If you remove the Dynamic[...], it works too, but you can only change y when the animation is stopped.

$\endgroup$
  • $\begingroup$ This is a great help, thanks a lot. I wonder whether it would be possible to solve this issue without defining global variables. Thanks a lot! $\endgroup$ – Luis Apr 21 '18 at 12:14
  • $\begingroup$ In the end, inspired by @MichaelE2 's answer to 17951, I ended up abandoning native bookmarks (i.e. AppearanceElements->None) and implementing my desired functionality with an ActionMenu, such as: ActionMenu["Set x", {"x = 1" :> (x = 1;), "x = 2" :> (x = 2;)}]. Thank you so much for your help! $\endgroup$ – Luis May 1 '18 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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