Re: [NTG-context] \startanimation and \dorecurse
Dear Wolfgang, Thank you for a nice solution. I applied your method to produce an animation which draw a circle using the following: %%%%%%%% \usemodule[animation] \setupinteraction[state=start] \startuseMPgraphic{Circles}{s} numeric sn, L, N; path p, q; p := fullcircle scaled 72; L:=length p; N:=20; sn:= \MPvar{s}; q := subpath (0, sn/N*L) of p;% draw q withcolor red; fill fullcircle scaled 3 shifted point length q of q withcolor blue; setbounds currentpicture to unitsquare shifted (-0.5,-0.5) scaled 75; \stopuseMPgraphic \starttext \startanimation \dorecurse{20} {\startexpanded %\setupMPvariables[Circles][s] \useMPgraphic{Circles}{s=\recurselevel} \stopexpanded} \stopanimation \stoptext %%%%%%%%%% However, it just draw 20 figures instead of making an animation. Would you please tell me what is wrong in the above code? Thank you. Best regards, Dalyoung
Am 21.10.2014 um 14:08 schrieb Jeong Dal
: Dear Wolfgang,
Thank you for a nice solution.
I applied your method to produce an animation which draw a circle using the following:
%%%%%%%% \usemodule[animation] \setupinteraction[state=start] \startuseMPgraphic{Circles}{s} numeric sn, L, N; path p, q; p := fullcircle scaled 72; L:=length p; N:=20; sn:= \MPvar{s}; q := subpath (0, sn/N*L) of p;% draw q withcolor red; fill fullcircle scaled 3 shifted point length q of q withcolor blue; setbounds currentpicture to unitsquare shifted (-0.5,-0.5) scaled 75; \stopuseMPgraphic \starttext \startanimation \dorecurse{20} {\startexpanded %\setupMPvariables[Circles][s] \useMPgraphic{Circles}{s=\recurselevel} \stopexpanded} \stopanimation \stoptext %%%%%%%%%%
However, it just draw 20 figures instead of making an animation.
Would you please tell me what is wrong in the above code?
You have to put each meatiest graphic into a frame, there are three ways to create a frame. 1. Use braces around the frame \startanimation {First frame} {Second frame} {Third frame} \stopanimation This method doesn’t work in your case where you use \dorecurse to create the graphics. 2. Use the \frame command. \startanimation \frame{First frame} \frame{Second frame} \frame{Third frame} \stopanimation In this case the \frame command is used store the content for each frame, this can be used when you create all frames with a loop like in your case, e.g. \dorecurse{10}{\expanded{\frame{\useMPPgraphic{…}{var=\recurselevel}}}} 3. Use the \startframe environment. \startanimation \startframe First frame \stopframe \startframe Second frame \stopframe \startframe Third frame \stopframe \stopaniamtion This is the same as the second method except that you use star/stop delimiters for each frame content instead of putting it into a argument. Wolfgang
participants (2)
-
Jeong Dal
-
Wolfgang Schuster