# Changing the color in my animation

I'm helping my students with parametrization. I tried to change the color on the second rotation of the unit circle with this code:

Manipulate[
ParametricPlot[{Cos[2 t], Sin[2 t]}, {t, 0, tau}, PlotRange -> 1.2,
PlotStyle -> {If[t <= π, "Blue", "Red"]}],
{{tau, 0.1}, 0, 2 π}]


But it remains blue after the first rotation. Can someone make a suggestion how to change the color?

• "Blue" and "Red" should probably be replaced with just Blue and Red; colors are keywords in Mathematica mostly; see also GrayLevel, Hue, and RGBColor. Also, the parameter t is not defined generally outside of the first argument to the function; you should look at the ColorFunction option. – nben Jan 31 '17 at 19:28
• @user16054 Yep, my mistake. Thanks for pointing it out. – David Jan 31 '17 at 19:42

You should be using ColorFunction, as PlotStyle does not do variable-dependent coloring:
Manipulate[ParametricPlot[{Cos[2 t], Sin[2 t]}, {t, -\$MachineEpsilon, τ},

where I have also taken the liberty of offsetting the starting point in ParametricPlot[] to prevent errors when τ becomes 0, and using the colors as symbols instead of strings.