Hey everyone I'm trying to pause an animation I made.
Following is the loop that generates the animation.
Before, the position over time of the falling objects are calculated and saved as a vector.
Objects are generated by the patch command.
With every iteration of the loop the new position is shown in a figure.
tu is the time the objects fall until they hit the ground.
tf is a vector with the time intervals between 0 and tu.
tf consists of as many columns as needed to guarantee 25 frames per seconds.
So far everything works as planed.
q = 1;
time = 0;
tic;
while time < tu
time = toc;
app.GeschwindigkeitEditField.Value = vt(q);
app.aktuelleZeitEditField.Value = tf(q);
app.StreckeEditField.Value = st(q);
app.kinetischeEnergieEditField.Value = Ekin(q);
app.potentielleEnergieEditField.Value = Epot(q);
app.GesamtenergieEditField.Value = Eges(q);
app.rotatorischeEnergieEditField.Value = 0;
Kreis.XData = xAkreis + R;
Kreis.YData = yAkreis + y(q);
InnenKreis.XData = xIkreis + R;
InnenKreis.YData = yIkreis + y(q);
xlim([-R 20+R]);
ylim([-H-Boden*3/2 R+2]);
pau = tf(q) - toc;
pause(pau);
q = q + 1;
if q > length(tf)
q = length(tf);
end
end
I now want to pause my animation at any point and continue it at the same point.
I tried a second infinite while loop inside the first one that is started by using a switch in app designer but if it started it started with different delays and didn't continue after I used the switch again.
Thanks for any help!
3 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/639655-pausing-and-continuing-an-animation-in-app-designer#comment_1118115
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/639655-pausing-and-continuing-an-animation-in-app-designer#comment_1118115
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/639655-pausing-and-continuing-an-animation-in-app-designer#comment_1118700
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/639655-pausing-and-continuing-an-animation-in-app-designer#comment_1118700
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/639655-pausing-and-continuing-an-animation-in-app-designer#comment_1118805
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/639655-pausing-and-continuing-an-animation-in-app-designer#comment_1118805
Sign in to comment.