chg: improved implemtation of animation

moved definition for function pointer from main file to animation file.
added a new function for flow control (top value is where animation is
completed, chang value is where tmp counting is changed from postive to
negative)