Simple Animation
 

Note that the blue box is the largest square you can draw with a 10-pixel margin around it (so you will take the minimum of the width and height when computing the size of the square), and that the circle pauses on the corners and is red while it pauses.