%% Rewind Animation of Moving Circle
% Create an animation of a moving circle and rewind it using rewindAnimation.
% First, create two symbolic variables, t and x. The variable t defines the time parameter of the animation. Use t to set the center of the circle at (t,1) and x to parameterize the perimeter of the circle within the range [-pi pi]. Create the circle animation object using fanimator. Set the x-axis and y-axis to be equal length.

syms t x
fanimator(@fplot,cos(x)+t,sin(x)+1,[-pi pi])
axis equal

% Play the animation by entering the command playAnimation. By default, playAnimation plays the animation within the range of t from 0 to 10. You can rewind the animation by using rewindAnimation. rewindAnimation restores the animation time parameter to its initial value at t = 0 and shows the starting animation frame.

rewindAnimation

%
% Copyright 2018 The MathWorks, Inc.