Question: animating a rotation transformation

Hi! A question regarding animating a rotation transformation defined by plottools[transform]. I can get the shear, translation and stretch to be animated. But when I use the same commands for rotation, the output doesn't appear. Here are my commands attempting to animate the rotation:

with(plots):

with(plottools):

with(LinearAlgebra):

p:=plottools[rectangle]([0,1],[1,0])

g:=transform((x,y)->convert(Multiply(Matrix([[cos(r), sin(r)],[-sin(r),cos(r)]]), <<x,y>>), list)):

animate(display, [g(p)], r=-1..1)

Here are the commands for the translation, which work (changing the last two lines above):

h:=transform((x,y)->[x+r,y]):

animate(display,[h(p)], r=-1..1)

Even when I define the rotation explicitly in terms of coordinates, the animation doesn't work.

 

Any thoughts? Any help will be appreciated.

Please Wait...