changing direction of animation