Prevent being called multiple times by requestanimationframe.