Some changes to properly support pausing of animation when scrolling.