On 7/9/2021 11:33 PM, Aditya Mahajan wrote:


On Fri, 9 Jul 2021, Hans Hagen wrote:

Hi,

This weekend upload has something new for metapost animation lovers:

\starttext

\startuseMPgraphic{demo}
      stacking := 6;
      fill fullcircle scaled 10cm
          withcolor "red" ;
    % stacking := 3;
      stacking := 9;
      fill fullcircle scaled 10cm shifted (3cm,0)
          withcolor "green" ;
      interim stacking := 4;
      fill fullcircle scaled 10cm shifted (3cm,3cm)
          withcolor "blue" ;
      for i=1 upto 10 :
          draw fullcircle scaled (i*cm)
              withstacking 8
              withpen      pencircle scaled 1mm
              withcolor    "gray" ;
      endfor ;
      for i=1 upto 20 :
          draw fullcircle scaled (i*cm/2)
              withstacking (if odd(i) : i else : 5 fi)
              withpen      pencircle scaled 2mm ;
      endfor ;
      draw boundingbox currentpicture
          withpen      pencircle scaled 1pt
          withstacking 0 ;
      currentpicture := currentpicture xsized 15mm;
\stopuseMPgraphic

\setupMPvariables[demo]

\startTEXpage
      \vskip1ex
      \hbox{\space\dorecurse{10}{\useMPgraphic{demo}{list={0,#1}}\space}}
      \vskip1ex \nointerlineskip
      \hbox{\space\dorecurse{10}{\useMPgraphic{demo}{list={0,1-#1}}\space}}
      \vskip1ex
\stopTEXpage

\stoptext

I have some more ideas but want to approach it stepwise. It bpils down
to the fact that one can put stuff on different 'layers' and optionally
flush these (by default all are flushed but the stackling order is
honored). An advantage is that one doesn't have to set up a graphic in
order (read: save pictures, flush them later on) and it is actually a
rather cheap extension in terms of runtime and overhead. Although I
could emulate it in mkiv, it is currently an LMTX only feature.

The (optional) list accepts the usual {1,2,5,7-9} kind of specification.

Very interesting. What will be the syntax to use this with \processMPbuffer and 
\startMPcode?
For now just use:

\setupMPvariables[list=4]

etc (grouped)

btw, i noticed that I need to reset something between graphics

Hans

-----------------------------------------------------------------
                                          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