%@ Maxime Chupin
%@ 26 octobre 2023
prologues := 3;
outputtemplate := "svg/%j-%c.svg";
outputformat := "svg";
input colorbrewer-rgb;
u:=5cm;
nbrPoints:=666;
pair points[];
vardef ReelToPair(expr j)=
save Angle;
Angle:=j/nbrPoints*360;
(cosd(Angle)*u,sind(Angle)*u)
enddef;
vardef colorvalue(expr j)=
save norm, intpart, decpart;
norm:=j/maxi*9;
intpart := floor norm+1;
decpart := norm-(floor norm);
((1.0-decpart)*Spectral[11][intpart]+(decpart)*Spectral[11][intpart+1])
enddef;
maxi:=400;
for i:=0 upto maxi:
module:=10*i/maxi;
beginfig(i);
filldraw unitsquare shifted (-0.5,-0.5) scaled 2.3u withcolor 0.1*white;
for j:=1 upto nbrPoints:
points[1]:=ReelToPair(j);
points[2]:= ReelToPair(((j*module) mod nbrPoints)) ;
draw points[1]--points[2] withcolor (colorvalue(i)) withpen pencircle
scaled 0.2pt;
endfor;
draw fullcircle scaled (2*u) withcolor white;
endfig;
endfor;
for i:=maxi downto 0:
module:=10*i/maxi;
beginfig(2*maxi-i);
filldraw unitsquare shifted (-0.5,-0.5) scaled 2.3u withcolor 0.1*white;
for j:=1 upto nbrPoints:
points[1]:=ReelToPair(j);
points[2]:= ReelToPair(((j*module) mod nbrPoints)) ;
draw points[1]--points[2] withcolor (colorvalue(i)) withpen pencircle
scaled 0.2pt;
endfor;
draw fullcircle scaled (2*u) withcolor white;
endfig;
endfor;
end.