If you want to do it with PHP, which is running server-side, you'll have to repeatedly send pages with a different size each time. Even if all users have broadband or you are running over a fast lan the animation effect will be poor at best.
Do it on one page and all the animation runs on the server and all the user sees is the end result.
You might be able to do it with javascript (I hope someone else can jump in here if it's possible) .
You could certainly do an animation with Flash or a Java applet.