I'm trying to create a plot that shows an animation of a point moving along a function. The idea behind this is that a I want the point to follow the function until the discontinuity point.
For every discontinuity point p of f, a button for that discontinuity is showed and when clicked it should open a dialog box where the f is plotted and then a point should move toward p.
p is defined as a pt[x_] := Graphics[{Red, AbsolutePointSize[8], Point[{x, f[x]}]}];
so that it can be plotted in function of the value of x controlled by a manipulate. The manipulate is then used for animation.
When I call my animate function I pass two values, one is the function to plot, and the other is a list of the discontinuity points. Everything works fine, I get a button for every discontinuity and, when clicked, a dialog window is opened and the f is plotted, but the point doesn't follow the function form.
I can't understand what is the cause of this behaviour because the pt[] works correctly if used in a notebook without using function calls.
(*
f : function to plot
l : list of discontinuity points of f
*)
AnimateFunction[f_,l_] := Module[{list = l, data, g},
pt[x_] := Graphics[{Red, AbsolutePointSize[8], Point[{x, f[x]}]}];
Grid[{
Table
[
With[{data00=data},
Button[
data00,{CreateDialog[
Manipulate[
Show[plot,pt[x]],
{{x, -10,"Point"}, -10, 10, .1, AppearanceElements -> All},
{{plot,Plot[{f[x],Line[{{data00, Infinity}, {data00, Infinity}}]},
{x,data00-1,data00+1},
PlotRange->{{data00-1,data00+1},{-Infinity,Infinity}},
ImageSize->500,
ScalingFunctions->"Infinite",
Exclusions->{data00},
PlotStyle->{Thick,Dashed},
Epilog->{Red,Dashed,Line[{{data00, 10}, {data00, -10}}],PointSize[Medium],Point[{data00,0}]}]},None}
]]}
]
],{data,list}]}
]
]
```