I am trying to get the red dot track vertically the green point on the graph, but they are different plots. And because of this I am experiencing difficulty.
There is a technique best to do this?
There is something about Piecewise, but didn't know how to apply.
velcarro = 69.2
dist1 = 8.4
time1 = 8.4/69.2
dist2 = 1.9
time2 = 27/60 // N
carro = {time1, dist1}
andando = {time2, dist2}
final = {time1 + time2, dist1 + dist2}
f[xP2_] := Evaluate[Fit[{{0, 0}, final}, {1, xP2}, xP2]];
xP2 = Subdivide[0, final[[1]], 30];
yP2 = f[#] & /@ xP2;
coordP2 = Transpose[{xP2, yP2}];
Table[
Show[{
Plot[
Evaluate[Fit[{{0, 0}, carro}, {1, x}, x]],
{x, 0, time1},
PlotStyle -> {Directive[Red, Thickness[0.005]]}
],
Plot[
Evaluate[Fit[{carro, final}, {1, x}, x]],
{x, time1, final[[2]]},
PlotRange -> {{final[[1]], 0}, {0, final[[2]]}},
PlotStyle -> {Directive[Red, Thickness[0.005]]}
],
Plot[
Evaluate[Fit[{{0, 0}, final}, {1, x}, x]],
{x, 0, final[[1]]},
PlotStyle -> {Directive[Dashed, Green, Thickness[0.005]]}
],
p1 = Graphics[{Red, PointSize[0.03], Point[{0, 0}]}],
p2 = Graphics[{Green, PointSize[0.03], Point[#]}]
},
PlotRange -> {{0, final[[1]]}, {0, final[[2]]}}], 1
] & /@ coordP2
{
and}
of my animation? $\endgroup$Point
don't change with the function argument $\endgroup$