rewindAnimationrewinds previously played animation objects by restoring the animation time parameter to its initial value. The animation objects must be created using thefanimatorfunction.
Create an animation of a moving circle and rewind it usingrewindAnimation.
First, create two symbolic variables,tandx. The variabletdefines the time parameter of the animation. Usetto set the center of the circle at(t,1)andxto parameterize the perimeter of the circle within the range[-pi pi]. Create the circle animation object usingfanimator. Set thex-axis andy-axis to be equal length.
由enterin播放动画g the commandplayAnimation. By default,playAnimationplays the animation within the range oftfrom 0 to 10. You can rewind the animation by usingrewindAnimation.rewindAnimationrestores the animation time parameter to its initial value att = 0and shows the starting animation frame.
Create an animation of a moving circle with a timer, and rewind the animation usingrewindAnimation.
First, create two symbolic variables,tandx. The variabletdefines the time parameter of the animation. Create a figure window for the animation.
symstxfig = figure;
Create the circle animation object usingfanimator. Usetto set the center of the circle at(t,1)andxto parameterize the perimeter of the circle within the range[-pi pi]. Set the range of the animation time parameter to[4 8]. Set thex-axis andy-axis to be equal length.
Next, add a timer animation object. Use thetextfunction to create a piece of text to count the elapsed time. Usenum2strto convert the time parameter to a string.
Play the animation in figurefigbetween 4 and 8 seconds by entering theplayAnimationcommand.
playAnimation(fig,'AnimationRange',[4 8])
You can rewind a previously played animation by usingrewindAnimation.rewindAnimationrestores the animation time parameter to its initial value att = 4and shows the starting animation frame.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.