3
$\begingroup$

Let's say I have the following animation:

Animate[ParametricPlot[{Cos[a t], Sin[a t]}, {t, 0, 1}], {a, 0, 
  2Pi}, AnimationRate -> 0.1]

Is there a way to somehow zoom into the moving point of the animated plot at a preselected xy-coordinate or time; such as being able to zoom into the animated moving point after 3 seconds or when the moving point reaches {x,y}={-1,0}?

Any help would be appreciated.

$\endgroup$
5
$\begingroup$

You can make PlotRange a function of any variables you need it to be a function of. I believe how to do it is most clearly explained with code:

f[t_] := With[{a = 2 Pi/20}, {Cos[a t], Sin[a t]}]
plotRangeF[t_, x_] := Which[
  t >= 0 && t < 5, {{0, 1}, {0, 1}},
  t >= 5 && t < 10, {{-1, 0}, {0, 1}},
  t >= 10 && t < 15, {{-1, 0}, {-1, 0}},
  t >= 15 && t <= 20, {{0, 1}, {-1, 0}}
  ]
frame[t_] := Graphics[{
   Point[f[t]]
   }, PlotRange -> plotRangeF[t, f[t]]
  ]
ListAnimate[Table[frame[t], {t, 0, 20, 0.1}]]

I think this may solve your problem. Do note that ParametricPlot also has the PlotRange option.

$\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.