Re: [NTG-context] weekend upload - stacking and animation
![](https://secure.gravatar.com/avatar/ecffc5c1eb6692198d091ee98e921822.jpg?s=120&d=mm&r=g)
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! Best regards, Dalyoung
![](https://secure.gravatar.com/avatar/46562c7d27388490d62e8d7a5bc960dd.jpg?s=120&d=mm&r=g)
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 -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/aaec8862a4c7f861ffc1f105419e1805.jpg?s=120&d=mm&r=g)
On 13/07/2021 15:14, Hans Hagen wrote:
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
Placing this excerpt in a file and compiling it I get an error:
$ context animation.tex
resolvers | formats | executing runner 'run luametatex format':
/home/vm/context/tex/texmf-linux-64/bin/luametatex --jobname="animation"
--fmt=/home/vm/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt
--lua=/home/vm/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui
cont-yes.mkiv --c:currentrun=1 --c:fulljobname="./animation.tex"
--c:input="./animation.tex" --c:kindofrun=1 --c:maxnofruns=9
--c:texmfbinpath="/home/vm/context/tex/texmf-linux-64/bin"
open source > level 1, order 1, name 'cont-yes.mkiv'
fonts > beware: no fonts are loaded yet, using 'lm mono' in box
system >
system > ConTeXt ver: 2021.07.10 21:51 LMTX fmt: 2021.7.12
int: english/english
system > system > 'cont-new.mkxl' loaded
open source > level 2, order 2, name
'/home/vm/context/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system > beware: some patches loaded from cont-new.mkiv
close source > level 2, order 2, name
'/home/vm/context/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system > files > jobname './animation', input
'./animation.tex', result './animation'
fonts > latin modern fonts are not preloaded
languages > language 'en' is active
open source > level 2, order 3, name './animation.tex'
modules > 'animation' is not found
fonts > preloading latin modern fonts (second stage)
fonts > 'fallback modern-designsize rm 12pt' is loaded
tex error > tex error on line 31 in file ./animation.tex:
Undefined control sequence
\startanimation [menu=yes]{\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}}
<argument> \startanimation [menu=yes]\the \scratchtoks \stopanimation
<macro> \expanded #1->\xdef \m_syst_helpers_expanded {\noexpand #1
}\m_syst_helpers_expanded
<macro> \useMPanimation [#1]#2->\begingroup \scratchtoks \emptytoks \par
\dorecurse {10}{\etoksapp \scratchtoks {{\useMPgraphic [\c!stacking
={\recurselevel }]{#2}}}}\expanded {\startanimation [#1]\the
\scratchtoks \stopanimation }
\endgroup
![](https://secure.gravatar.com/avatar/46562c7d27388490d62e8d7a5bc960dd.jpg?s=120&d=mm&r=g)
On 7/13/2021 4:11 PM, Floris van Manen wrote:
On 13/07/2021 15:14, Hans Hagen wrote:
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
Placing this excerpt in a file and compiling it I get an error:
you probably don't have the animation module installed ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
Jeong Dal schrieb am 13.07.2021 um 12:25:
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.
\dorecurse {...} {\frame{...}} Wolfgang
![](https://secure.gravatar.com/avatar/ecffc5c1eb6692198d091ee98e921822.jpg?s=120&d=mm&r=g)
Dear Hans, Wolfgang, Both of your methods are working well. Using \frame, the \dorecurse problem is solved. \starttext \startanimation[menu=yes] \dorecurse{10} { \frame{\useMPgraphic[stacking={#1}]{demo}}} \stopanimation \stoptext Thank you for your solutions. Best regards, Dalyoung
participants (4)
-
Floris van Manen
-
Hans Hagen
-
Jeong Dal
-
Wolfgang Schuster