This is great code! We were actually thinking about animating a panel the other day, for our project.
Problem is, we'd like to animate a button on a panel, not a panel...
This soooo easy.
You should know that.
I use a transparent button and animate a window beneath it so just make it like this;
panel bla
{
window(blabla)
button(alphachannelimagewithsizeofyourwindow,blabla)
etc.
EDIT:
@ Richi:
Your code will only work if you use quadratic patterns.