Hi, 

It's probably not the best solution as it uses the ‘old’ shading method, but seems to give the result you were expecting:

\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((0,0), (cosd(i) * 6cm, sind(i) * 6cm), 0.5[blue,white], white);
endfor;
\stopMPpage

(This code generates about twice as many lines as in your pdf; this can be reversed by changing the step from 5 to 10.)

My guess is that in your example the shading direction is not rotated with the path. It should be possible to rotate it by properly using `withshadedirection` (see section 8.3.3 in the metafun manual), although after experimenting a bit I could not find an easy way to make it work. (This does not say much though - I'm definitely not very experienced in MetaFun.)

Best wishes, 
Florent

Le sam. 21 sept. 2024 à 17:51, Keith McKay <mckaymeister@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
___________________________________________________________________________________