Question: Animation in Plot component

I want to have a Plot component display animations, controlled by a button. I want each click
of the button to show a new animation.

So e.g. the Action when Clicked for the button might be something like this (for animations alternately in blue and red):

use DocumentTools, plots in

if cc = red then cc:= blue else cc:= red fi;
Do(%Plot0 =animate(plot,[sin(x+t),t=0..Pi,colour=cc],x=0..Pi,frames=4));

end use;

The problem is that when the button is clicked, the Plot component first reverts to the first frame
of the last animation before switching to the new animation.  Any ideas on how I can prevent this?

Please Wait...