animating line function