0
$\begingroup$

I have the following (admittedly artificial) code:

f[r_, \[Theta]_] :=  r + t Sin[\[Theta]]

frames = Table[ParametricPlot3D[{r Cos[\[Theta]], r Sin[\[Theta]], f[r, \[Theta]]}, 
{r, 0, 4}, {\[Theta], 0, 2 \[Pi]}], {t, 1, 10, 0.1}];

Export["test.gif", frames]

When I open "test.gif", in some web browsers it won't even play, and in others, it cuts off part of the image for certain frames. I believe this is down to the fact that my frames are different sizes, and it seems to be taking the size of the first frame and cropping all subsequent frames to that size.

I'm tried playing around with "ImageSize", but have had no luck.

$\endgroup$
1
$\begingroup$

Indeed your problem is the different image sizes

Try fixing the PlotRange

frames = Table[
   ParametricPlot3D[
    {r Cos[\[Theta]], r Sin[\[Theta]], f[r, \[Theta]]}, {r, 0, 
     4}, {\[Theta], 0, 2 \[Pi]}
    , PlotRange -> {{-5, 5}, {-5, 5}, {-15, 15}}
    ], {t, 1, 10, 0.1}];

Now all images are the same size.

Tally[ImageDimensions /@ frames]
{{{213, 432}, 91}}

Before was

Tally[ImageDimensions /@ frames]

{{{360, 377}, 1}, {{360, 381}, 1}, {{360, 385}, 1}, {{360, 389}, 1}, {{360, 393}, 1}, {{360, 397}, 1}, {{360, 401}, 1}, {{360, 405}, 1}, {{360, 409}, 1}, {{360, 407}, 1}, {{360, 411}, 1}, {{360, 416}, 1}, {{360, 422}, 1}, {{360, 427}, 1}, {{360, 432}, 1}, {{356, 432}, 2}, {{352, 432}, 1}, {{347, 432}, 1}, {{349, 432}, 1}, {{345, 432}, 1}, {{342, 432}, 1}, {{338, 432}, 1}, {{335, 432}, 1}, {{331, 432}, 1}, {{328, 432}, 1}, {{324, 432}, 1}, {{321, 432}, 1}, {{318, 432}, 1}, {{315, 432}, 1}, {{312, 432}, 1}, {{309, 432}, 1}, {{306, 432}, 1}, {{303, 432}, 1}, {{300, 432}, 1}, {{297, 432}, 1}, {{294, 432}, 1}, {{292, 432}, 1}, {{289, 432}, 1}, {{287, 432}, 1}, {{284, 432}, 1}, {{281, 432}, 1}, {{279, 432}, 2}, {{277, 432}, 2}, {{274, 432}, 1}, {{272, 432}, 2}, {{270, 432}, 2}, {{275, 432}, 1}, {{268, 432}, 1}, {{266, 432}, 1}, {{264, 432}, 1}, {{261, 432}, 1}, {{259, 432}, 1}, {{257, 432}, 1}, {{255, 432}, 1}, {{253, 432}, 1}, {{252, 432}, 1}, {{250, 432}, 1}, {{248, 432}, 1}, {{246, 432}, 1}, {{245, 432}, 1}, {{244, 432}, 1}, {{242, 432}, 1}, {{240, 432}, 1}, {{239, 432}, 1}, {{237, 432}, 1}, {{236, 432}, 1}, {{234, 432}, 1}, {{233, 432}, 1}, {{231, 432}, 1}, {{230, 432}, 1}, {{228, 432}, 1}, {{227, 432}, 1}, {{225, 432}, 1}, {{224, 432}, 1}, {{223, 432}, 1}, {{221, 432}, 1}, {{220, 432}, 1}, {{219, 432}, 1}, {{217, 432}, 1}, {{216, 432}, 1}, {{215, 432}, 1}, {{214, 432}, 1}, {{212, 432}, 1}, {{211, 432}, 1}, {{210, 432}, 1}, {{209, 432}, 1}}

$\endgroup$

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.