Code to build animation.