It’s not ideal to have slides that only work if everyone is paying attention at all times. This animation should not be used to impart information. You can highlight changes in other ways.
I'm not sure if this is considered animation or not, but I've demonstrated code refactors between slides by adding a colored border around the code in question (both in the before and in the after slide).
I'd probably do something similar for stepping through code. But at that point it's a quasi-animation (albeit, one that can still be understood by pdf slides).