ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Aditya Mahajan <adityam@umich.edu>
Subject: Re: weekend upload
Date: Mon, 12 Jul 2021 11:07:53 +0200	[thread overview]
Message-ID: <6a557b09-1630-a544-b4a9-9ce3e9223c64@xs4all.nl> (raw)
In-Reply-To: <nycvar.YAK.7.78.908.2107112249550.837077@nqv-guvaxcnq>

On 7/12/2021 5:31 AM, Aditya Mahajan wrote:
> On Sun, 11 Jul 2021, Bruce Horrocks wrote:
> 
>>> On 9 Jul 2021, at 17:29, Hans Hagen <j.hagen@xs4all.nl> wrote:
>>>
>>> This weekend upload has something new for metapost animation lovers:
>>
>> Forgive my ignorance but what exactly am I supposed to be seeing here? I run the example and get two rows of ten boxes. They don't move so it's not like an animated GIF was put into the PDF and they don't appear to be consecutive frames that could be joined into an animated GIF.
> 
> For me, this feature provides the same capability as 'layers' in a graphical program. Consider the diagram shown in page 1 of the attached PDF. Suppose I want to "highlight" boxes A and B by drawing a square around them. That is easy; simply determine the bounding box of A, B (I do that manually here), and expand it a bit and draw it. Simple. See page 2.
> 
> Now, suppose I want to fill this highlighted box. Suddenly, we have a problem. The highlight box needs to be "behind" the other boxes. How do we do it. We determine the location of boxes A, B, and C, but do not draw them. Determine the highlight box. Now draw the highlight box first and then draw the boxes. Suddenly the code became an order of magnitude more complicated.
> 
> With the new stacking mechanism, I can just put the highlight box on "stack -1", and everything works well. See page 4. What's also super cool is that I can control what gets shown by changing the stacking key.
> 
> 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}
> 
> to show the boxes and the highlight. Drawing such "conditional" graphics was cumbersome in the past. Now, it is easier.
> 
> If you show a bunch of such "conditional" graphics in a sequence, you get an animation (or you could wrap around the animation module).
> 
> Aditya
> 
> PS: Hans, stacking doesn't completely work with the boxes macro. drawunboxed is always drawn on stack 0, which the bpath is drawn on the right stack. That is the reason I use stack = -1 to put the highlight in the "background".

in a netx upload this will work ok

\startMPpage[offset=2mm, stacking={1,2}]

     draw fullsquare scaled 4cm withstacking 2 withcolor "red" ;
     draw image (
         draw fullsquare scaled 2cm withstacking 3 withcolor "green" 
withstacking 3 ;
         draw fullsquare scaled 1cm withstacking 4 withcolor "blue" 
withstacking 4 ;
     ) withstacking 2 withcolor "cyan";

     drawarrow llcorner currentpicture .. origin withstacking 3;
\stopMPpage





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

  parent reply	other threads:[~2021-07-12  9:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09 16:29 Hans Hagen
2021-07-09 17:19 ` Hans Hagen
2021-07-09 21:33 ` Aditya Mahajan
2021-07-09 22:24   ` Hans Hagen
2021-07-10 20:44   ` Hans Hagen
2021-07-11 13:04 ` Bruce Horrocks
2021-07-11 15:00   ` Hans Hagen
2021-07-12  3:31   ` Aditya Mahajan
2021-07-12  8:07     ` Hans Hagen
2021-07-12 10:12       ` Floris van Manen
2021-07-12 16:47         ` Hans Hagen
2021-07-12  9:07     ` Hans Hagen [this message]
     [not found] <mailman.580.1626060721.1143.ntg-context@ntg.nl>
2021-07-12 19:29 ` Jeong Dal
2021-07-12 20:00   ` Aditya Mahajan
     [not found] <mailman.1.1626170401.2795.ntg-context@ntg.nl>
2021-07-13 10:29 ` Jeong Dal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a557b09-1630-a544-b4a9-9ce3e9223c64@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).