I need to create some graphics to teach energy. One of the illustrations is about the sound energy that I represent using linear_shade function. In the following example the first illustration is represented correctly, but the second call of the function SoundEnergy implies the loss of gradient. What am I doing wrong?
Thanks in advance Jorge \startMPinclusions def SoundEnergy = path pr ; pr := unitsquare xscaled .3cm yscaled 2cm ; currentpicture:=nullpicture; for i=0 step 2 until 10: linear_shade(pr shifted (i*.3cm,0),0,white,black); linear_shade(pr shifted ((i+1)*.3cm,0),0,black,white); endfor; clip currentpicture to (0,0)--(0,2cm)--(2cm,2cm)--(3cm,1cm)--(2cm,0)--cycle; draw (0,0)--(0,2cm)--(2cm,2cm)--(3cm,1cm)--(2cm,0)--cycle withcolor .625red; addto finalpicture also currentpicture shifted(avanco*3.5cm,0) ; currentpicture := nullpicture ; avanco := avanco+1 ; enddef; \stopMPinclusions \starttext \startMPcode picture finalpicture ; finalpicture := nullpicture ; numeric avanco ; avanco := 0 ; bboxmargin := 0pt ; %% first call is OK SoundEnergy; %% second call loss the gradient SoundEnergy; currentpicture := finalpicture ; \stopMPcode \stoptext
___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________