I have a complex Manipulate-
based demonstration containing a few sliders and a Setterbar.
I would like to make a movie out of it, avi, or whatever else. The movie will then be used for a journal publication as a Supporting material, so the quality should be good enough.
When the movie plays, the Setterbar should set its first value, then the sliders should move one after another, and then together. Further, the setter bar should set its second value and the slider manipulations should be repeated with this new Setterbar value. And so it should go for all Setterbar values. There will be something like 3-4 of them.
Is it possible at all?
To be more precise, I prepared a simplified demonstration with such controls:
Manipulate[Plot[{Sin[a*x] + b*Cos[3 a*x], k*x}, {x, 0, \[Pi]}],
{a, 1, 2}, {b, 0, 1}, {k, {0, 0.5, 1}}]
Answer
You can define a function that creates Manipulate
s with a "fake" SetterBar
and a specific AutorunSequencing
m[k_, seq_] := Manipulate[
Plot[{Sin[a*x] + b*Cos[3 a*x], k*x}, {x, 0, Pi}, ImageSize -> 400],
{a, 1, 2}, {b, 0, 1}, Grid@{{"k", SetterBar[k, {0, .5, 1}]}},
AutorunSequencing -> seq, ContentSize -> {420, 270}]
then create the frames for the movie with
frames = Join @@ (ArrayPad[
ImportString[ExportString[#, "AVI"], "ImageList"], {0, 3}, "Fixed"] & /@
Flatten[Table[{m[k, {{1, 1}, {2, 1}}], m[k, {All, 2.85}]}, {k, 0, 1, 0.5}]]);
and export them as using
Export["D:\\animationTest.gif", frames]
or
Export["D:\\animationTest.avi", frames]
Without a specified ContentSize
exporting to "AVI"
fails, as the size of the frames
varies.
Comments
Post a Comment