modification of annimation to get the end of animation