Question: An Button (Embedded Component) to start an Animation

 

Lets say I have a simple animation such as the code below.

 

restart;
with(plots): 

p := [seq([x, 30*x-x^2], x = 0 .. 30)]: 

An := proc (x)

pointplot(p[round(x)], axes = box, color = red, symbol = solidcircle, symbolsize = 30)

end proc:

animate(An, [x], x = 1 .. nops(p), frames = nops(p), trace = nops(p)) ;

 

 

Now I want a Button (Embedded Component) to start this animation. How can this be done ?

I have not figured out how to tell the button to play the animation and not simply load it .....humm

For example the below code will not work !

 

with(DocumentTools);
with(plots);

p := [seq([x, 30*x-x^2], x = 0 .. 30)];

An := proc (x)

pointplot(p[round(x)], axes = box, color = red, symbol = solidcircle, symbolsize = 30)

end proc;

Ann := animate(An, [x], x = 1 .. nops(p), frames = nops(p), trace = nops(p));

Do(%Plot1 = Ann);

 

Any ideas ??

Please Wait...