Thank you Florent, this is exactly what I was looking to do. I know why
you you got twice as many lines as me. In my code in the for .. endfor;
loop I rotated the subPath by i and then rotated the asPathEnvelope by i
again in the fill statement which was my error. You correctly rotated
the subPath by i only, to get the correct number of paths. I'm going to
read, yet again, 8.3.3 in the MetaFuN manual.
Thanks for your help
Keith
On 21/09/2024 19:37, Florent Michel wrote:
Apologies for the double email. Seems I slightly misunderstood what
you aimed for - the corrected (assuming there is no other
misunderstanding from me) is:
\startMPpage
pair A,B;
path p, psubPath, asPathEnvelope;
A = (0cm,0cm);B = (5cm,0cm);
p = A{dir 60} .. B;
fill fullsquare scaled 12cm withcolor 0.5[blue,white];
for i = 0 step 5 until 355:
psubPath := (subpath((0.1 * length p), (1 * length p) ) of p) rotated i;
asPathEnvelope := envelope pensquare scaled 0.5mm of psubPath;
fill asPathEnvelope
withshade define_linear_shade((cosd(i) * 0.5cm, sind(i) * 0.5cm),
(cosd(i) * 5cm, sind(i) * 5cm), 0.5[blue,white], white);
endfor;
\stopMPpage
Le sam. 21 sept. 2024 à 17:51, Keith McKay <mckaymeis...@gmail.com> a
écrit :
Hi,
I have been playing about with envelopes to produce shaded paths
as described in the new LuaMetFun manual, see page 105 therein.
Using the code below I wanted to produce a shaded path, in this
case a curve and then rotating it in 5 degree steps from 0 to 355
degrees to produce a kind of spiral. Here is the code:
\startMPpage
pair A,B; path p, psubPath, asPathEnvelope; A = (0cm,0cm);B =
(5cm,0cm); p = A{dir 60}.. B; fill fullsquare scaled 12cm
withcolor 0.5[blue,white]; for i = 0 step 5 until 355: psubPath :=
(subpath((0.1 * length p), (1 * length p))of p)rotated i;
asPathEnvelope := envelope pensquare scaled 0.5mm of psubPath;
fill asPathEnvelope rotated i yscaled 1 withshademethod "linear"
withshadecolors (0.5[blue,white],white); endfor; \stopMPpage
I had expected to get a series of curves where the outer point of
the curve was white, shading down to 0.5[blue,white]at the inner
point of the curve.
I was expecting the shading to remain that way, however, as the
curve is rotated round, the shading effect slowly changes until it
is reversed, and as it
continues to be rotated it returns to it original shading.
Although I quite like that effect, it's a nice feature, I would
like to be able to produce the shading
the way I wanted. A while back Hans explained to me why this
happened and how I could remedy it, but unfortunately my aged
memory has failed me and I
cant remember how to do it. So I thought the youthful brains of
the ConTeXt group may be able to help out, and it might be of
interest in any case. I
attach a pdf of the spiral effect.
Best Wishes
Keith McKay
___________________________________________________________________________________
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
___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________