Question: How to animate linear transformation of multiple polygons?

Hey,

I want to animate action of linear transformation on multiple polygons, in the end, it should be a grid of multiple parallel lines that will get morphed. The transformation is defined by a matrix A.

So far I got this code to work:

with(plots):
with(plottools):
setoptions(style=patch,view=[-5..5,-5..5], scaling=constrained):
basis_i:=polygon([[0,0],[1,0]],color=red):

N:=20:
F:=(x,y) -> (1-k/N)*<x,y> + k/N*(A.<x,y>):
L := transform((x,y)->convert(F(x,y),list)):
A:=<<2,1>|<-1,1>>;
                          

frames:=seq(L(basis_i),k=0..N):

display(frames, insequence=true);
 

It animates the basis vector nicely, but I can't seem to figure out, how to animate multiple lines, multiple polygons.

Anyone knows how to do this?

Any help will be much appreciated.

 

Please Wait...