# Conditional range in a parametric plot

I have a program that needs to be done like this:

ParametricPlot[
equation,
If[x < 1, {x, 0, t}, {x, t, 2}]] But Mathematica didn't seem to recognize the values of xmin and xmax in the range of the independent variable x, nor the variable x itself. The simplest solution, in my opinion, would be to insert If expressions into the range itself, something like this: ParametricPlot[ equation, {x, If[x < 1, 0, t], If[x >= 1, t, 2]}]

EDIT:

This is why I needed to do this. I needed to paint the curve when 0 Lighter@Blue, PlotRange -> 5]
}]

An animation. First the frames:

movie = Table[
ParametricPlot[{f1[t], f2[t]},
{t, Clip[t0 – 2 Pi, {0, 2 Pi – 0.0001}],
Clip[t0, {0.0001, 2 Pi}]},
PlotStyle -> Lighter@Blue, PlotRange -> 5],
{t0, 0, 4 Pi, 2 Pi / 50}];

Then ListAnimate[movie] or Export[“foo.gif”, movie]:

+1, I know it’s tangent to the problem in the OP but since I went at it for a while with a set of equations that produced a very similar result as this, but not quite, could you hint as to how you found those equations? Ty.
– C. E.
Jan 8 ’14 at 16:25

@Anon They are an epicycloid and a hypocycloid, with the traced point on the rolling wheel set slightly inside the rim (0.85 r2).
– Michael E2
Jan 8 ’14 at 16:51

@MichaelE2 Actually it’s .8 but that’s good enough 😉
– Arcotick
Jan 8 ’14 at 21:00

I am guessing, but perhaps the OP is looking for something like this.

With[{t = .9},
Module[{range},
range = If[t < 1., {x, 0., t}, {x, t, 2.}]; ParametricPlot[{x, .5 x}, Evaluate@range, PlotRange -> {{0, 2}, {0, 1}}]]]

With[{t = 1.1},
Module[{range},
range = If[t < 1., {x, 0., t}, {x, t, 2.}]; ParametricPlot[{x, .5 x}, Evaluate@range, PlotRange -> {{0, 2}, {0, 1}}]]]

Update

Now that I hae a better understanding of what you want, I suggest you get the effect by controlling the coloring of the curve, rather than by adjusting its range. Here is an example.

Manipulate[
ParametricPlot[{Cos[t], Sin[t]}, {t, 0, tt},
PlotRange -> {{-1, 1}, {-1, 1}},
PlotStyle -> {Thick},
ColorFunction -> (If[#3 > 2 Ï€, White, Black] &),
ColorFunctionScaling -> False],
{tt, .1, 4 Ï€, .1, Appearance -> “Labeled”}]

Some black points can be seen on the white part. I knew I could make it with colors, and also putting a white function in top of the blue one, but I don’t see this as a good resolution, what if some other plots are under this curve?
– Arcotick
Jan 8 ’14 at 23:28