\edef\c{\luaexpr{2/(1+math.sqrt(5))}} % Ratio of "y-radius" to "x-radius" (should be positive)
\edef\N{64} % Number of frames in the animation
\startMPinclusions[+]
	N:=\N;
	u:=136;
	pair f;
	c:=\c;
	if c<1: f:=(1+-+c,0); v:=u/2; else: f:=(0,1+-+(1/c)); v:=u/c/2; fi; % Focus f is defined
	path p,q;
	pair z;
	picture base;
	numeric L;
\stopMPinclusions
\starttext
	\startMPpage
		p:=fullcircle yscaled c; % This is the ellipse
		L:=length p;
		draw p scaled (2*v) withpen pencircle scaled (v/260) dashed evenly; % Draw the ellipse dashed (will be traced later)
		q:=bbox currentpicture enlarged (v/64); % Enlarge the bounding box slightly
		q:=(llcorner q+(-v/128,-v/128))--(lrcorner q+(v/128,-v/128))--(urcorner q+(v/128,v/128))--(urcorner q+(-v/128,v/128))--cycle;
		fill fullcircle scaled (v/32) shifted (f*v) withcolor red; % Focus
		fill fullcircle scaled (v/32) shifted (-f*v) withcolor red; % Focus
		base:=currentpicture; % Save this picture to draw in every frame
		setbounds currentpicture to q; % Set the bounding box as described before
	\stopMPpage
	\dorecurse{\luaexpr{\N}}{
		\startMPpage
			n:=\recurselevel;
			draw base; % Draw the common picture saved above
			draw subpath (0,(n-1)/(N-1)*L) of p scaled (2*v) withpen pencircle scaled (v/130) withcolor blue; % Trace the ellipse in blue
			z:=point ((n-1)/(N-1)*L) of p scaled v; % The point on the ellipse where we are thusfar
			fill fullcircle scaled (v/32) shifted (2*z) withcolor blue; % Draw the point
			draw (-f*v)--(2*z)--(f*v) withpen pencircle scaled (v/260); % Draw the string used to trace the ellipse
			setbounds currentpicture to q; % Set the bounding box so that it is the same for each frame
		\stopMPpage
	}
\stoptext
