Am 01.01.2013 um 04:50 schrieb Jeong Dal <hak...@me.com>:

> Dear Wolfgang,
> 
> Thank you for the explanation, and your sample works nicely.
> 
> I  enclosed \processMPbuffer using \startframe and \stopframe as following.
> Then  I got a 'undefined control sequence' error.
> If I use '\framed[]' instead of '\startframe … \stopframe', then it gave all 
> 7 circles of different radius in two pages without error.
> If I add "\startanimation … \stopanimation", the only change is the 
> appearance of menu at the bottom of the last circle.(no animation)
> 
> What is wrong in the code?

1. The \frame and \startframe commands are only available *in* the animation 
environment where they are locally defined.

2. Although \framed sound similar to \frame there is no relation between both 
commands.

3. You have to expand the loop value *before* it is passed to metapost, see 
below.

\usemodule[animation]
\setupinteraction[state=start]

\startuseMPgraphic{circles}{counter}
        path p;
        numeric n, u;
        u := 1cm;
        n:=\MPvar{counter}*u;
        p := fullcircle scaled n;
        draw p;
\stopuseMPgraphic

\starttext
\startanimation[menu=yes]
\dorecurse{7}{%
        \startframe
        \useMPgraphic{circles}{counter=#1}%
        \stopframe}
\stopanimation
\stoptext

4. You can also include the metapost code in the frame but you have to expand 
the \recurselevel value with the \expanded command (I have to upload a new 
version of the module first because \startframe isn’t expandable yet).

\usemodule[animation]
\setupinteraction[state=start]

\starttext
\startanimation[menu=yes]
\dorecurse{7}{\expanded
   {\startframe
    \startMPcode
    path p;
    numeric n, u;
    u := 1cm;
    n:=\recurselevel*u;
    p := fullcircle scaled n;
    draw p;
    \stopMPcode
    \stopframe}}
\stopanimation
\stoptext

5. Use a PDF viewer with javascript support (e.g. Adobe Reader) to view the 
animation.

Kind regards and a happy new year,
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