1
$\begingroup$

Writing:

p1 = ParametricPlot[{t, 0}, {t, 0, 1}, 
                     Axes -> False, 
                     PlotStyle -> Gray];
frames = {};
For[t0 = 1, t0 <= 2, t0 = t0 + 0.05,
    p2 = ParametricPlot[{t, 0}, {t, 0, t0}, 
                        Axes -> False, 
                        PlotStyle -> Green];
    frames = Join[frames, {Magnify[Show[{p1, p2}, 
                  PlotRange -> {{-2, 2}, {-2, 2}}], 1.5]}]
   ]
Export["prova1.gif", frames, "AnimationRepetitions" -> \[Infinity]];

I get:

enter image description here

that's what I want.

Instead, writing:

p1 = ParametricPlot3D[{t, 0, 0}, {t, 0, 1}, 
                       Axes -> False, 
                       Boxed -> False,
                       PlotStyle -> Gray];
frames = {};
For[t0 = 1, t0 <= 2, t0 = t0 + 0.05,
    p2 = ParametricPlot3D[{t, 0, 0}, {t, 0, t0}, 
                          Axes -> False, 
                          Boxed -> False,
                          PlotStyle -> Green];
    frames = Join[frames, {Magnify[Show[{p1, p2}, 
                  PlotRange -> {{-2, 2}, {-2, 2}, {-2, 2}}], 1.5]}]
   ]
Export["prova2.gif", frames, "AnimationRepetitions" -> \[Infinity]];

I get:

enter image description here

that is not as desired.

How can I fix it?

$\endgroup$

closed as off-topic by C. E., Carl Lange, m_goldberg, bbgodfrey, march Feb 6 at 17:48

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – C. E., Carl Lange, m_goldberg, bbgodfrey, march
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ The two lines are partially in exactly the same place. It's not clear which should be shown, hence sometimes the gray is shown and sometimes the green. You need to give one of the lines a small offset (which doesn't have to be discernible to the human eye) so that it is clear which line is closer to the camera. $\endgroup$ – C. E. Feb 6 at 10:23
  • 1
    $\begingroup$ Perfect, solved! Thank you! $\endgroup$ – TeM Feb 6 at 11:03

Browse other questions tagged or ask your own question.