On 7/13/2021 12:25 PM, Jeong Dal wrote:
Dear Hans, Aditya,

Now, I understand the stacking method.
I made a simple animation using it.


\startuseMPgraphic{demo}
for i=1 upto 10:
draw fullcircle scaled (.3*i*cm) withcolor (.1*i*red) withpen pencircle scaled (.5*bp) withstacking i;
endfor;
\stopuseMPgraphic
\setupinteraction[state=start]
\usemodule[animation]

\starttext
\startanimation[menu=yes]
% \dorecurse{10}
% { {\useMPgraphic[stacking={#1}]{demo}}}
{\useMPgraphic[stacking={1}]{demo}}
{\useMPgraphic[stacking={2}]{demo}}
{\useMPgraphic[stacking={3}]{demo}}
{\useMPgraphic[stacking={4}]{demo}}
{\useMPgraphic[stacking={5}]{demo}}
{\useMPgraphic[stacking={6}]{demo}}
{\useMPgraphic[stacking={7}]{demo}}
{\useMPgraphic[stacking={8}]{demo}}
{\useMPgraphic[stacking={9}]{demo}}
{\useMPgraphic[stacking={10}]{demo}}
\stopanimation
\stoptext


However, I cannot succeed to use \dorecurse to make the code simple.
If there is another good method, please let me know.

Anyway, thanks for this new feature!
How about:

\startuseMPgraphic{demo}
    for i=1 upto 10:
        draw fullcircle scaled (i*cm/3)
            withcolor (i*red/10)
            withpen   pencircle scaled (bp/2)
            withstacking i
        ;
    endfor ;
\stopuseMPgraphic

\unprotect

\tolerant\protected\def\useMPanimation[#1]#2%
  {\begingroup
   \scratchtoks\emptytoks

\dorecurse{10}{\etoksapp\scratchtoks{{\useMPgraphic[\c!stacking={\recurselevel}]{#2}}}}%
   \expanded{\startanimation[#1]\the\scratchtoks\stopanimation}%
   \endgroup}

\protect

\setupinteraction[state=start]

\usemodule[animation]

\starttext
    \useMPanimation[menu=yes]{demo}
\stoptext

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to