> Am 20.10.2014 um 13:32 schrieb Jeong Dal <hak...@me.com>:
> 
> Hi,
> 
> I tested the following simple code to generate enlarging circles as a test of 
> animation.
> But it just draw 5 circles in a row.
> 
> \usemodule[animation]
> \setupinteraction[state=start]
> \startbuffer[Circles]
> numeric u; u:= 1cm;
> draw fullcircle scaled \MPrawvar{Circles}{s}u;
> \stopbuffer
> \starttext
> \startanimation
> { \dorecurse{5}{%
> \setupMPvariables[Circles][s=\recurselevel]
> \processMPbuffer [Circles]
> }}
> \stopanimation
> \stoptext
> 
> It seems to me that \startanimation just treat the figures 
> {\dorecurse … } as just one figure.
> 
> Is there a way to treat it 5 figures to generate animation? 
> 
> Thank you for reading.

1. You have to expand the \recurselevel value.

2. Don’t put braces around \dorecurse because when \startanimation sees a 
opening braces it assumes you want to put each frame into a group of braces.


Variant 1:

\usemodule[animation]

\setupinteraction[state=start]

\startbuffer[Circles]
numeric u; u:= 1cm;
draw fullcircle scaled \MPrawvar{Circles}{s}u;
\stopbuffer

\starttext

\startanimation
\dorecurse{5}
  {\startexpanded
     \startframe
       \setupMPvariables[Circles][s=\recurselevel]
       \processMPbuffer [Circles]
     \stopframe
   \stopexpanded}
\stopanimation

\stoptext


Variant 2:

\usemodule[animation]

\setupinteraction[state=start]

\startuseMPgraphic{Circles}{s}
numeric u; u:= 1cm;
draw fullcircle scaled \MPvar{s}u;
\stopuseMPgraphic

\starttext

\startanimation
\dorecurse{5}
  {\startexpanded
     \frame{\useMPgraphic{Circles}{s=\recurselevel}}%
   \stopexpanded}
\stopanimation

\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to