On 12/31/2025 12:38 PM, Keith McKay wrote:
Hi all,
The following example creates a unitcircle scaled to the \recurselevel
value on each MPpage.
\starttext
\dostepwiserecurse{1}{80}{1}{
\startMPpage
path a;
a := unitsquare xyscaled(80,80) ;
draw a;
draw unitcircle xyscaled(\recurselevel , \recurselevel);
\stopMPpage
}
\dostepwiserecurse{79}{2}{-1}{
\startMPpage
path a;
a := unitsquare xyscaled(80,80) ;
draw a;
draw unitcircle xyscaled(\recurselevel , \recurselevel);
\stopMPpage
}
\stoptext
If you run this and scan through pages, the circle starts at 1 and
increases to 80 and then decreases from 79 to 2. I use the pdf to create
a mp4 movie showing the circle increasing and decreasing when I replay
it as a loop. You can download the file here:
https://1drv.ms/v/c/de5fffb8e01e255b/
IQCLuQ9bYQovSIaOc7S5vc8_AQnAfqudRCjr_PC_pT6Rgx8?e=fuq9AS
However if my graphic is complicated, compilation time will increase by
quite a bit. So I was thinking that when the circle is decreasing I have
already calculated those MPpages as the circle was increasing so could I
not reuse those MPpages to create the following sequence of MPpages?
1, 2, 3, ... 78, 79, 80, 79, 78, ...3, 2
i.e I have reused the MPpages 79 to 2 which would loop in a movie when
played back.
I though I could make a copy the pdf file then add MPpages from the
original file to create the sequence of MPpages above. I've had a look
through the merging pdf files manual and it suggests using:
\externalfigure[myfile.pdf][page=4]
but that doesn't seem to work with MPpages since it adds the pdf page as
a text page. Any hints on how I can solve this?
If it's the same graphic but just scaled,
\starttext
\startreusableMPgraphic{keith}
draw unitcircle xyscaled(10,10);
\stopreusableMPgraphic
\dostepwiserecurse{1}{80}{1}{
\startTEXpage[width=80mm,height=80mm]
\vfill
\scale[width=#1mm]{\reuseMPgraphic{keith}}
\stopTEXpage
}
\dostepwiserecurse{79}{2}{-1}{
\startTEXpage[width=80mm,height=80mm]
\vfill
\scale[width=#1mm]{\reuseMPgraphic{keith}}
\stopTEXpage
}
\stoptext
Otherwise look at the other posted solutions.
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 : [email protected] /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________