optimize the animation