From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14897 invoked from network); 29 Nov 2023 11:29:55 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 29 Nov 2023 11:29:55 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id AC126483AE8 for ; Wed, 29 Nov 2023 12:28:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D_kLhd6pnQjW for ; Wed, 29 Nov 2023 12:28:52 +0100 (CET) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 1A372483B4F for ; Wed, 29 Nov 2023 12:26:25 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id ADEA2483ACC for ; Wed, 29 Nov 2023 12:25:34 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aRQf3BKIReDm for ; Wed, 29 Nov 2023 12:25:33 +0100 (CET) Received: from outbound00.knthost.com (outbound00.knthost.com [45.13.66.34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 371E2483ACB for ; Wed, 29 Nov 2023 12:25:33 +0100 (CET) Date: Wed, 29 Nov 2023 12:25:22 +0100 DKIM-Filter: OpenDKIM Filter v2.10.3 outbound00.knthost.com 753C5F0BC3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=labonneheure.ch; s=default; t=1701257067; bh=kbPgDXF4a4on7XVcfX0ykoUFKSLsSrZoUzjNldipNqM=; h=Date:From:To:In-Reply-To:References:Subject; b=5Nr3MdVIveqYppAfiaHY9WPmDhY0rhlryfdkOyBvPzUUh8XF8mpRSYf0NpvUwoNj0 4GD/fNx8ET6lmqJ7Iqc9dkm6VBclRDZFkigZ6p68AA7NvXbZ2y7Zt5LpNPsiN5gvxA RIhGkt08VBgyuRluB8RA3Uog+HNBSpIt6gOZP7B3BarFOJYgrV5CBoajM3DdP0g/Vn YJAINUib0Ilr+ofjJcOj9QXZxZ+SaCcuc//d1z7D9UM7tIgF5RRWLtvHQvEQF5UuII 4t+lfkZ5hQLXL0kVB0UeL10aLbLWIrwuG5g7UuUdmKgzmdUlYTBFhI3P3XqbLz2sbZ Ss3GjyMwAfpiw== To: mailing list for ConTeXt users Message-ID: In-Reply-To: References: X-Mailer: Mailspring MIME-Version: 1.0 Message-ID-Hash: 44CVN7Q32KCMZZOVH24VLX45GYDB6N44 X-Message-ID-Hash: 44CVN7Q32KCMZZOVH24VLX45GYDB6N44 X-MailFrom: emanuel@labonneheure.ch X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: multipage metapost output from ConTeXt List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Emanuel Han via ntg-context Cc: Emanuel Han Content-Type: multipart/mixed; boundary="===============3010973224065999762==" --===============3010973224065999762== Content-Type: multipart/alternative; boundary="65671fa2_6b8b4567_be3b" --65671fa2_6b8b4567_be3b Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Dear Aditya and =46abrice, thanks for your responses. I included some of =46abrice's code into mine for testing purpose, and in= deed the multipage works now. What is bizarre is that issues appear now that didn't appear before: Path A is drawn with color red on page 1, and in color black on all follo= wing pages, while it should stay red. textext(, ) is overwriting with =22T=3D=22&decimal(cur= rentime) which has been used previously in textext() before the for k=3D1= endfor loop. This overwriting happens only for the first textext() which= occurs inside the for k=3D1 endfor loop. All other textext() inside the = for k=3D1 endfor loop are not drawn at all. If the line =C2=AB draw texte= xt(=22T=3D=22&decimal(currentime)) scaled 2 shifted(0,2in) withcolor mage= nta ; =C2=BB is commented out, the first textext() inside the for k=3D1 e= ndfor loop is not drawn neither. It must be an issue with textext(), beca= use when I replace textext() by lmt=5Foutline=5B=5D, the text is drawn. Adjusted mwe: =5Cenableregime=5Butf=5D % enable unicoded input =5Cdefinefontfamily =5BRoman=46ont=5D =5Brm=5D =5Bcalluna=5D =5Cdefinefontfamily =5BKorean=46ont=5D =5Brm=5D =5Bapplemyungjo=5D =5Cdefinefontfamily =5BJapanese=46ont=5D =5Brm=5D =5Bhannotatesc=5D =5Cdefinefontfeature =5Bfea=5D =5Bmode=3Dnode,language=3Ddflt,script=3Darab, init=3Dyes, medi=3Dyes, fina=3Dyes, isol=3Dyes, calt=3Dyes, rlig=3Dyes, tlig=3Dyes, trep=3Dyes, curs=3Dyes, kern=3Dyes, mark=3Dyes =5D =5Cstarttypescript =5Bserif=5D =5Bnotonaskharabic=5D =5Cdefinefontsynonym =5Bnotonaskharabic-Light=5D =5Bname:notonaskharabic=5D= =5Bfeatures=3Dfea=5D =5Cdefinefontsynonym =5Bnotonaskharabic-Bold=5D =5Bname:notonaskharabic=5D= =5Bfeatures=3Dfea=5D =5Cdefinefontsynonym =5Bnotonaskharabic-Italic=5D =5Bname:notonaskharabic= =5D =5Bfeatures=3Dfea=5D =5Cdefinefontsynonym =5Bnotonaskharabic-Bold-Italic=5D =5Bname:notonaskha= rabic=5D =5Bfeatures=3Dfea=5D =5Cstoptypescript =5Cstarttypescript =5Bserif=5D =5Bnotonaskharabic=5D =5Cusetypescript=5Bserif=5D=5Bfallback=5D =5Cdefinefontsynonym =5BSerif=5D =5Bnotonaskharabic-Light=5D =5Bfeatures=3D= fea=5D =5Cdefinefontsynonym =5BSerifItalic=5D =5Bnotonaskharabic-Italic=5D =5Bfe= atures=3Dfea=5D =5Cdefinefontsynonym =5BSerifBold=5D =5Bnotonaskharabic-Bold=5D =5Bfeatur= es=3Dfea=5D =5Cdefinefontsynonym =5BSerifBoldItalic=5D =5Bnotonaskharabic-Bold-Italic= =5D =5Bfeatures=3Dfea=5D =5Cstoptypescript =5Cstarttypescript =5Bnotonaskharabic=5D =5Cdefinetypeface =5Bnotonaskharabic=5D =5Brm=5D =5Bserif=5D =5Bnotonaskh= arabic=5D =5Bdefault=5D =5Cstoptypescript =5Cusetypescript=5Bnotonaskharabic=5D =5Csetupbodyfont =5BRoman=46ont=5D =5Cusecolors=5Bcrayola=5D =5CstartMPinclusions picture p=5B=5D; path The=46rame ; The=46rame :=3D fullsquare scaled 5in ; z0 =3D (0,0); z1 =3D (60,40); z2 =3D (40,90); z3 =3D (10,70); z4 =3D (30,50); z5 =3D (90,70); z6 =3D (-10,70); path A; A =3D z0..z1..z2..z3..z4 ; pair AStartPoint; AStartPoint =3D point 0 of A; pair AEndPoint; AEndPoint =3D point 4 of A; path B; B =3D z5..z6; pair BStartPoint; BStartPoint =3D point 0 of B; pair BEndPoint; BEndPoint =3D point 1 of B; path C; C =3D AStartPoint..AEndPoint; p1:=3Dimage( draw A withcolor red; ); p2:=3Dimage(draw A; label(lmt=5Foutline =5B text =3D =22=5CJapanese=46ont =E6=97=A5=E6=9C=AC=E8=AA=9E=22 =5D, AEndPoint);); p3:=3Dimage( label(textext(=22=5Cnotonaskharabic =5Ctextdir TRT =D8=AF=D8=A7=D9=86=DA=AF= =22) scaled 1.2, BStartPoint); ); p4:=3Dimage(draw A; label(lmt=5Foutline =5B text =3D =22=5CKorean=46ont =ED=95=9C=EA=B5=AD=EC=96=B4=22 =5D, AStartPoint);); p5:=3Dimage( label(textext(=22b=C4=81ng=22), BEndPoint); draw C withcolor green; ); p6:=3Dimage( draw B withcolor blue; ); =5CstopMPinclusions =5Cstarttext =5Cdorecurse=7B6=7D=7B % =46rame =5CsetupMPpage=5Bbackground=3Dcolor, backgroundcolor=3DSpringGreen=5D =5CstartMPpage=5Bpagestate=3Dstart=5D currentime :=3D =231 ; % Just for learning : draw The=46rame withpen pencircle scaled .1in withcolor magenta ; draw textext(=22T=3D=22&decimal(currentime)) scaled 2 shifted(0,2in) with= color magenta ; for k=3D1 upto currentime: draw p=5Bk=5D; endfor setbounds currentpicture to The=46rame ; desiredformat :=3D 1080;% In pixels (will be converted by default at 72dp= i) currentpicture :=3D currentpicture xysized (desiredformat ,desiredformat = ); =5CstopMPpage =7D =5Cstoptext On Nov. 27 2023, at 11:25 pm, Aditya Mahajan wrote:= > On Mon, 27 Nov 2023, =46abrice L wrote: > > > Hi, > > > > It is fun fact very easy to do. You just use =5CstartMPpage (=E2=80=A6= ) =5CstopMPpage multiple times. Here is an example which build an animati= on of a particle moving according to a Brownian motion. > > A very similar option is to pass a variable to a metapost drawing. This= is what I use: > https://adityam.github.io/context-blog/post/metapost-animation/ > It only works when viewed in acrobat, you can just comment out the anim= ation part and wrap it in =5CstartTEXpage .. =5CstopTEXpage to get multi-= page animation. > Aditya=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F > If your question is of interest to others as well, please add an entry = to the Wiki=21 > > maillist : ntg-context=40ntg.nl / https://mailman.ntg.nl/mailman3/lists= /ntg-context.ntg.nl > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirro= r) > archive : https://github.com/contextgarden/context > wiki : https://wiki.contextgarden.net > =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F > --65671fa2_6b8b4567_be3b Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Dear Aditya and =46abrice,
thanks for your responses.
I included some of =46abrice's code into mine for testing pur= pose, and indeed the multipage works now.
What is bizarre is t= hat issues appear now that didn't appear before:
  • Path A is drawn with color red on p= age 1, and in color black on all following pages, while it should stay re= d.
  • textext(<text>, <pair>) is overwriting = <text> with =22T=3D=22&decimal(currentime) which has been used = previously  in textext() before the for k=3D1 endfor loop. This over= writing happens only for the first textext() which occurs inside the for = k=3D1 endfor loop. All other textext() inside the for k=3D1 endfor loop a= re not drawn at all. If the line  =C2=AB draw textext(=22T=3D=22&= ;decimal(currentime)) scaled 2 shifted(0,2in) withcolor magenta ; =C2=BB = is commented out, the first textext() inside the for k=3D1 endfor loop is= not drawn neither. It must be an issue with textext(), because when I re= place textext() by lmt=5Foutline=5B=5D, the text is drawn.
  • Adjusted mwe:

    =5Cenableregime=5Butf=5D % enable uni= coded input

    =5Cdefinefontfamily =5BRoman=46ont=5D =5Brm=5D = =5Bcalluna=5D

    =5Cdefinefontfamily =5BKorean=46ont=5D =5Brm= =5D =5Bapplemyungjo=5D

    =5Cdefinefontfamily =5BJapanese=46on= t=5D =5Brm=5D =5Bhannotatesc=5D

    =5Cdefinefontfeature
    =
     =5Bfea=5D
     =5Bmode=3Dnode,language=3Ddflt,scrip= t=3Darab,
      init=3Dyes,
      medi=3Dyes,
    =
      fina=3Dyes,
      isol=3Dyes,
      cal= t=3Dyes,
      rlig=3Dyes,
      tlig=3Dyes,
    <= div>  trep=3Dyes,
  curs=3Dyes,
  kern= =3Dyes,
  mark=3Dyes
=5D

=5Cstartt= ypescript =5Bserif=5D =5Bnotonaskharabic=5D
 =5Cdefinefont= synonym =5Bnotonaskharabic-Light=5D       =5B= name:notonaskharabic=5D        =5Bfeat= ures=3Dfea=5D
 =5Cdefinefontsynonym =5Bnotonaskharabic-Bol= d=5D        =5Bname:notonaskharabic=5D=         =5Bfeatures=3Dfea=5D
 =5Cdefinefontsynonym =5Bnotonaskharabic-Italic=5D   = ;   =5Bname:notonaskharabic=5D     &nb= sp;  =5Bfeatures=3Dfea=5D
 =5Cdefinefontsynonym =5Bno= tonaskharabic-Bold-Italic=5D =5Bname:notonaskharabic=5D   =      =5Bfeatures=3Dfea=5D
=5Cstoptypescript=

=5Cstarttypescript =5Bserif=5D =5Bnotonaskharabic=5D
=
 =5Cusetypescript=5Bserif=5D=5Bfallback=5D
 =5Cd= efinefontsynonym =5BSerif=5D       &nb= sp;           &nbs= p;   =5Bnotonaskharabic-Light=5D     &= nbsp; =5Bfeatures=3Dfea=5D
 =5Cdefinefontsynonym =5BSerifI= talic=5D           = ;      =5Bnotonaskharabic-Italic=5D  &= nbsp;   =5Bfeatures=3Dfea=5D
 =5Cdefinefontsynon= ym =5BSerifBold=5D         &= nbsp;         =5Bnotonaskharabic-= Bold=5D        =5Bfeatures=3Dfea=5D
 =5Cdefinefontsynonym =5BSerifBoldItalic=5D   = ;          =5Bnotonaskharabi= c-Bold-Italic=5D =5Bfeatures=3Dfea=5D
=5Cstoptypescript
=5Cstarttypescript =5Bnotonaskharabic=5D
  =5Cdefin= etypeface =5Bnotonaskharabic=5D =5Brm=5D =5Bserif=5D =5Bnotonaskharabic=5D= =5Bdefault=5D
=5Cstoptypescript

=5Cusetypescrip= t=5Bnotonaskharabic=5D

=5Csetupbodyfont =5BRoman=46ont=5D
   
=5Cusecolors=5Bcrayola=5D
=5CstartMPinclusions

picture p=5B=5D;
 = ;path The=46rame ;
 The=46rame :=3D fullsquare scaled 5in = ;

 z0 =3D (0,0);   
 z1= =3D (60,40);
 z2 =3D (40,90); 
 z3 =3D= (10,70);
 z4 =3D (30,50);
 z5 =3D (90,70);=
 z6 =3D (-10,70);

path A; A =3D z0..z1..z2.= .z3..z4 ;
pair AStartPoint; AStartPoint =3D point 0 of A;
pair AEndPoint; AEndPoint =3D point 4 of A;
path B; B =3D=   z5..z6;
pair BStartPoint; BStartPoint =3D point 0 of B;=
pair BEndPoint; BEndPoint =3D point 1 of B;
path C; = C =3D AStartPoint..AEndPoint;

p1:=3Dimage(
 = ;   draw A withcolor red;
);

p2:=3Dimag= e(draw A; label(lmt=5Foutline =5B
text =3D =22=5CJapanese=46on= t =E6=97=A5=E6=9C=AC=E8=AA=9E=22
    =5D, AEndPo= int););

p3:=3Dimage(
    label(tex= text(=22=5Cnotonaskharabic =5Ctextdir TRT =D8=AF=D8=A7=D9=86=DA=AF=22) sc= aled 1.2, BStartPoint);
);

p4:=3Dimage(draw A; la= bel(lmt=5Foutline =5B
text =3D =22=5CKorean=46ont =ED=95=9C=EA= =B5=AD=EC=96=B4=22
    =5D, AStartPoint););
p5:=3Dimage(
    label(textext(=22b=C4= =81ng=22), BEndPoint);
    draw C withcolor gree= n;
);

p6:=3Dimage(
    d= raw B withcolor blue;
);
=5CstopMPinclusions
=5Cstarttext

=5Cdorecurse=7B6=7D=7B % =46rame
 =5CsetupMPpage=5Bbackground=3Dcolor, backgroundcolor=3DSpringGre= en=5D
=5CstartMPpage=5Bpagestate=3Dstart=5D  
<= div> currentime :=3D =231 ;
 % Just for learning :
 draw The=46rame withpen pencircle scaled .1in withcolor mag= enta ;
 draw textext(=22T=3D=22&decimal(currentime)) s= caled 2 shifted(0,2in) withcolor magenta ;
 for k=3D1 upto= currentime: draw p=5Bk=5D; endfor
 setbounds currentpictu= re to The=46rame ;

 desiredformat :=3D 1080;% In pixel= s (will be converted by default at 72dpi)
 currentpicture = :=3D currentpicture xysized (desiredformat ,desiredformat );
&n= bsp;
=5CstopMPpage
=7D

=5Cstoptext
On Nov. 27 2023, at 11:= 25 pm, Aditya Mahajan <adityam=40umich.edu> wrote:
On Mon, 27 Nov 2023, =46abrice L wrote:

> Hi,=
>
> It is fun fact very easy to do. You just u= se =5CstartMPpage (=E2=80=A6) =5CstopMPpage multiple times. Here is an ex= ample which build an animation of a particle moving according to a Browni= an motion.

A very similar option is to pass a variable to a= metapost drawing. This is what I use:

https://adityam.gith= ub.io/context-blog/post/metapost-animation/

It only works w= hen viewed in acrobat, you can just comment out the animation part and wr= ap it in =5CstartTEXpage .. =5CstopTEXpage to get multi-page animation.
Aditya=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
If your question = is of interest to others as well, please add an entry to the Wiki=21
maillist : ntg-context=40ntg.nl / https://mailman.ntg.nl/mailma= n3/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.ne= t
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
--65671fa2_6b8b4567_be3b-- --===============3010973224065999762== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / 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 ___________________________________________________________________________________ --===============3010973224065999762==--