change the animation algorithm and reset the background while animation