Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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