[NTG-context] MetaPost Animation

Troy Henderson thenders at gmail.com
Thu Apr 15 19:53:12 CEST 2010


I am trying to create an animation in ConTeXt + MetaPost.  In
particular, I would like to have ConTeXt + MetaPost generate each
individual frame of the animation, and then I would like to place each
of these graphics on the page in succession.  I am looking for a
"ConTeXt way" without placing the MetaPost code in a separate source
file, running MetaPost, and using \externalfigure.  The following
MetaPost sample code generate 21 graphics images  (numbered .0 to
.20), but I have no idea how to have ConTeXt generate these graphics
without a manual external MetaPost run and have them included in a way
that is consistent with \startuseMPgraphic or similar.

Thanks in advance,

Troy Henderson

path p,q;
p:=fullcircle scaled 72;
L:=length p;
N:=20;
for n=0 upto N:
	beginfig(n);
		q:=subpath (0,n/N*L) of p;
		draw q withcolor red;
		fill fullcircle scaled 3 shifted point length q of q withcolor blue;
		setbounds currentpicture to unitsquare shifted (-0.5,-0.5) scaled 75;
	endfig;
endfor;
end


-- 
Troy Henderson
Assistant Professor
Department of Mathematics
University of Mobile
http://www.tlhiv.org


More information about the ntg-context mailing list