I've been trying to restart an animation after variables change from Manipulate
PopUpMenus
. My animation takes the form:
Animate[expr, {u, umin, umax, du}].
I can change u
, after variations to Manipulate
, back to an initial value momentarily, but from there u
jumps back to its previous position (or farther forward) as if its continued running. I would be content with simply restarting the entire animation after changing the Manipulate
variables.
My code for Animate[]
is in the following simplified form (I hope to make the i
slider bar return back to the left and the red dot to begin being plotted at x=-10
each time the function is changed):
gPrev[x_] := Sin[x];
Manipulate[
Switch[functionNumb,
0, g[x_] := Sin[x],
1, g[x_] := Cos[x],
2, g[x_] := ArcTan[x]],
{functionNumb, 0, 2, 1}]
Animate[
Plot[{g[x]}, {x, -10, 10},
Epilog -> {Red, PointSize[0.015], Point@{i, g[i]}}], {i, -10, 10, 1},
DisplayAllSteps -> True, AnimationRunning -> False]
Manipulate[ Animate[Plot[{f[x]}, {x, -10, 10}, Epilog -> {Red, PointSize[0.015], Point@{i, f[i]}}], {i, -10, 10, 1}, DisplayAllSteps -> True, AnimationRunning -> False], {f, {Sin, Cos, ArcTan}}]
$\endgroup$