ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: weekend upload
       [not found] <mailman.580.1626060721.1143.ntg-context@ntg.nl>
@ 2021-07-12 19:29 ` Jeong Dal
  2021-07-12 20:00   ` Aditya Mahajan
  2021-07-13 10:25 ` weekend upload - stacking and animation Jeong Dal
  1 sibling, 1 reply; 8+ messages in thread
From: Jeong Dal @ 2021-07-12 19:29 UTC (permalink / raw)
  To: list ntg-context@ntg.nl ntg-context@ntg.nl ntg-context@ntg.nl
	ntg-context@ntg.nl


[-- Attachment #1.1: Type: text/plain, Size: 1794 bytes --]

Dear Aditya,

Thank you for your code and an explanation.

> Let's assume that the last MPpage was a \startuseMPgraphic{boxes} .... \stopuseMPgraphic. Suppose I wanted to use these pictures in a presentation. On the first slide, I can use
> 
>    \useMPgraphic[stacking=0]{boxes}
> 
> to show the three boxes, and on the next slide, I can use
> 
>    \useMPgraphic[stacking={-1,0}]{boxes}
> 

I tried to reproduce your example using \startuseMPgraphic{boxes} … \stopuseMPgraphic, and useMPgraphic[stacking=0]{boxes} .
A modified one of your code is below.
There is no error message but no output at all.
Would you please tell me what is wrong in here?

Best regards,
Dalyoung


\startMPdefinitions
  input boxes;

  primarydef a +- b =
    a -- (xpart a, ypart b) -- b
  enddef ;
  primarydef a -+ b =
    a -- (xpart b, ypart a) -- b
  enddef ;
\stopMPdefinitions
\defineframed
  [boxframed]
  [
    width=6em,
    height=2\lineheight,
    align={middle,lohi},
    background=color,
    backgroundcolor=blue,
    foregroundcolor=white,
    forefroundstyle=bold,
  ]

\startuseMPgraphic[offset=2mm]{boxes}
  boxit.A("\boxframed{Box A}");
  boxit.B("\boxframed{Box B}");
  boxit.C("\boxframed{Box C}");

  defaultdx := 0pt;
  defaultdy := 0pt;

  A.c = origin;

  B.w - A.e = (1cm, 0);

  0.5[ A.s, B.s ] - C.n = (0, 1cm);

  stacking := 0;
  drawunboxed(A,B,C);
  stacking := 1;
  drawarrow A.s +- C.w ;
  drawarrow B.s +- C.e ;

  newpath highlight;

  highlight := (A.sw -- B.se -- B.ne -- A.nw) enlarged EmWidth;
  fill highlight withcolor "darkgray" withstacking -1;

\stopuseMPgraphic

\starttext
\useMPgraphic[stacking={0}]{boxes}
\useMPgraphic[stacking={0,1}]{boxes}
\useMPgraphic[stacking=-1]{boxes}
\stoptext

[-- Attachment #1.2: Type: text/html, Size: 10974 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: weekend upload
  2021-07-12 19:29 ` weekend upload Jeong Dal
@ 2021-07-12 20:00   ` Aditya Mahajan
  0 siblings, 0 replies; 8+ messages in thread
From: Aditya Mahajan @ 2021-07-12 20:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

On Tue, 13 Jul 2021, Jeong Dal wrote:

> Dear Aditya,
> 
> Thank you for your code and an explanation.
> 
> > Let's assume that the last MPpage was a \startuseMPgraphic{boxes} .... \stopuseMPgraphic. Suppose I wanted to use these pictures in a presentation. On the first slide, I can use
> > 
> >    \useMPgraphic[stacking=0]{boxes}
> > 
> > to show the three boxes, and on the next slide, I can use
> > 
> >    \useMPgraphic[stacking={-1,0}]{boxes}
> > 
> 
> I tried to reproduce your example using \startuseMPgraphic{boxes} … \stopuseMPgraphic, and useMPgraphic[stacking=0]{boxes} .
> A modified one of your code is below.
> There is no error message but no output at all.
> Would you please tell me what is wrong in here?

> [...]
> \startuseMPgraphic[offset=2mm]{boxes}
> [...]

You cannot use [offset=2mm] here. Just use \startuseMPgraphic{boxes}.

Aditya

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: weekend upload - stacking and animation
       [not found] <mailman.580.1626060721.1143.ntg-context@ntg.nl>
  2021-07-12 19:29 ` weekend upload Jeong Dal
@ 2021-07-13 10:25 ` Jeong Dal
  2021-07-13 13:14   ` Hans Hagen
  2021-07-13 14:59   ` Wolfgang Schuster
  1 sibling, 2 replies; 8+ messages in thread
From: Jeong Dal @ 2021-07-13 10:25 UTC (permalink / raw)
  To: list ntg-context@ntg.nl ntg-context@ntg.nl ntg-context@ntg.nl
	ntg-context@ntg.nl


[-- Attachment #1.1: Type: text/plain, Size: 1057 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 10615 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: weekend upload - stacking and animation
  2021-07-13 10:25 ` weekend upload - stacking and animation Jeong Dal
@ 2021-07-13 13:14   ` Hans Hagen
  2021-07-13 14:11     ` Floris van Manen
  2021-07-13 14:59   ` Wolfgang Schuster
  1 sibling, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2021-07-13 13:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Jeong Dal

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: weekend upload - stacking and animation
  2021-07-13 13:14   ` Hans Hagen
@ 2021-07-13 14:11     ` Floris van Manen
  2021-07-13 15:02       ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Floris van Manen @ 2021-07-13 14:11 UTC (permalink / raw)
  To: ntg-context



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

<line 4.31>     \useMPanimation[menu=yes]{demo}

21        \expanded{\startanimation[#1]\the\scratchtoks\stopanimation}%
22        \endgroup}
23
24     \protect
25
26     \setupinteraction[state=start]
27
28     \usemodule[animation]
29
30     \starttext
31 >>      \useMPanimation[menu=yes]{demo}
32     \stoptext
33
The control sequence at the end of the top line of your error message 
was never
\def'ed. You can just continue as I'll forget about whatever was undefined.
mtx-context     | fatal error: return code: 256

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: weekend upload - stacking and animation
  2021-07-13 10:25 ` weekend upload - stacking and animation Jeong Dal
  2021-07-13 13:14   ` Hans Hagen
@ 2021-07-13 14:59   ` Wolfgang Schuster
  2021-07-13 22:34     ` Jeong Dal
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2021-07-13 14:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jeong Dal


[-- Attachment #1.1: Type: text/plain, Size: 1072 bytes --]

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


[-- Attachment #1.2: Type: text/html, Size: 10410 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: weekend upload - stacking and animation
  2021-07-13 14:11     ` Floris van Manen
@ 2021-07-13 15:02       ` Hans Hagen
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2021-07-13 15:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Floris van Manen

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: weekend upload - stacking and animation
  2021-07-13 14:59   ` Wolfgang Schuster
@ 2021-07-13 22:34     ` Jeong Dal
  0 siblings, 0 replies; 8+ messages in thread
From: Jeong Dal @ 2021-07-13 22:34 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 294 bytes --]

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


[-- Attachment #1.2: Type: text/html, Size: 2152 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-07-13 22:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.580.1626060721.1143.ntg-context@ntg.nl>
2021-07-12 19:29 ` weekend upload Jeong Dal
2021-07-12 20:00   ` Aditya Mahajan
2021-07-13 10:25 ` weekend upload - stacking and animation Jeong Dal
2021-07-13 13:14   ` Hans Hagen
2021-07-13 14:11     ` Floris van Manen
2021-07-13 15:02       ` Hans Hagen
2021-07-13 14:59   ` Wolfgang Schuster
2021-07-13 22:34     ` Jeong Dal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).