ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Making metafun pictures fainter
@ 2021-10-10 15:54 Gavin via ntg-context
  0 siblings, 0 replies; only message in thread
From: Gavin via ntg-context @ 2021-10-10 15:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gavin

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

Hi list,

I’m trying to produce figures like this, showing motion as a series of snap-shots, with the earlier moments more faint.


[-- Attachment #2: PastedGraphic-1.pdf --]
[-- Type: application/pdf, Size: 48125 bytes --]

[-- Attachment #3: Type: text/plain, Size: 2131 bytes --]



Here are three examples of metafun code using transparency and “decorated".


\startMPinclusions
picture ball;
	ball := image(
		draw fullcircle scaled 1cm
      			withshademethod "circular"
			withshadecenter (.25,.25)
       		withcolor "lightgray" shadedinto black;
		draw fullcircle scaled 1cm withpen pencircle scaled 0.8pt;);
\stopMPinclusions

\starttext

\startMPpage
draw decorated (draw ball) withtransparency (1,.2);
draw decorated (draw ball shifted (1cm, 0cm)) withtransparency (1,.4);
draw decorated (draw ball shifted (4cm, 0cm)) withtransparency (1,.6);
draw ball shifted (9cm, 0cm);
\stopMPpage

\startMPpage
draw decorated (draw ball) withtransparency (1,.2);
draw decorated (draw ball shifted (0.25cm, 0cm)) withtransparency (1,.4);
draw decorated (draw ball shifted (1cm, 0cm)) withtransparency (1,.6);
draw ball shifted (2.25cm, 0cm);
\stopMPpage

\startMPpage
draw decorated (draw ball) withtransparency (1,.2);
filldraw fullcircle scaled 1cm withcolor white withpen pencircle scaled 0.8pt shifted (0.25cm, 0cm);
draw decorated (draw ball shifted (0.25cm, 0cm)) withtransparency (1,.4);
filldraw fullcircle scaled 1cm withcolor white withpen pencircle scaled 0.8pt shifted (1cm, 0cm);
draw decorated (draw ball shifted (1cm, 0cm)) withtransparency (1,.6);
draw ball shifted (2.25cm, 0cm);
\stopMPpage

\stoptext


Transparency alone does a good job if the objects don’t overlap (first example). If they do overlap, it’s kind of a mess (second example). I get a much better result if I put a white circle behind each transparent ball so that they look lighter without showing the earlier objects through  them (third example). However, that solution is going to be difficult for more complex shapes. I tried drawing the shape using “redecorated () withcolor white", to draw the white background object, but only the outline appears white. The circular shading disappears altogether, leaving the ball fill area transparent.

I also tried to use something like “softened .8” but could not get that to produce any output.

Any ideas?

Thanks!
Gavin

[-- Attachment #4: 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] only message in thread

only message in thread, other threads:[~2021-10-10 15:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-10 15:54 Making metafun pictures fainter Gavin via ntg-context

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).