\setupcolors[state=start]
\starttext

\definecolor[a][darkyellow]
\definecolor[b][s=.8]
\definecolor[c][darkred]

\startuniqueMPgraphic{CircularShade}
  path p;
  p:= unitsquare xscaled \overlaywidth yscaled \overlayheight ;
  circular_shade(p,0,\MPcolor{a},\MPcolor{b});
\stopuniqueMPgraphic

\startuniqueMPgraphic{LinearShade}
  path p;
  p:= unitsquare xscaled \overlaywidth yscaled \overlayheight ;
  linear_shade(p,0,\MPcolor{a},\MPcolor{b});
\stopuniqueMPgraphic

\defineoverlay[circular shade][\uniqueMPgraphic{CircularShade}]
\defineoverlay[linear shade]  [\uniqueMPgraphic{LinearShade}]

\framed
  [background=circular shade,frame=off]
  {\bf \white Hi there, I'm Circular!}

\framed
  [background=linear shade,frame=off]
  {\bf \white Whow, this is Linear!}

\startuniqueMPgraphic{test}
path p; p:=fullcircle scaled 1cm;
for i:= 0 step 2cm until 8cm:
  circular_shade(p shifted (i,0),0,\MPcolor{a},\MPcolor{b});
endfor;
\stopuniqueMPgraphic

\useMPgraphic{test}

\startuniqueMPgraphic{test1}
circular_shade(fullcircle scaled 1cm,0,\MPcolor{a},\MPcolor{b});
picture s; s:=currentpicture; currentpicture := nullpicture;
for i=0 step 2cm until 8cm:
  addto currentpicture also s shifted (i,0);
endfor;
\stopuniqueMPgraphic

\useMPgraphic{test1}

\startuniqueMPgraphic{test2}
sh:=define_circular_shade(origin,origin,0,8cm,\MPcolor{a},\MPcolor{b});
for i=0 step 2cm until 8cm:
  fill fullcircle scaled 1cm shifted (i,0) withshade sh;
endfor;
\stopuniqueMPgraphic

\useMPgraphic{test2}

\stoptext
