I'm trying to make an illustration for teaching purposes, but the code is a little long to post. I've made up a toy problem that seems to have the same issue.
Below, I have some code with the same fundamental structure as my desired illustration which allows the user to pick a point from the options and then does an animated plot of the line between the origin and the selected point:
Manipulate[
Animate[
Module[{m},
m = y1/x1;
Show[
Plot[m*x, {x, -3, t}, PlotRange -> {{-3, 3}, {-3, 3}}],
Graphics[{PointSize[0.02], Red, Point[{x1, y1}]}]
]
],
{{t, -3.01, ""}, -3, 3, AppearanceElements -> None},
AnimationRepetitions -> 1
],
{{x1, 1, "x_value"}, {-2, -1, 1}},
{{y1, 2, "y_value"}, {0, 1, 2}}
]
What I would like is:
- For the control types to stay the same, including the hidden animate control.
- For the animate to show the animation exactly once and then show the static plot on the whole range
{-3,3}. - For the animate to restart the animation if either
x_valueory_valueare changed. - For all other functionality to be unchanged, including the "algorithm" used. For example, let us assume that passing
mis not an option. Though, it would be OK, and perhaps preferable, if theAnimatewere wrapped into theManipulate.
I have tried turning the Animate into a Dynamic@Animate with x1 as a tracked symbol, but that did not seem to have any change.