How to animations actually work?

It seems like I am missing something magic going on under the covers. When you call UIView.animate(), does iOS somehow scan the “animations” code block for any variables that are set in it, determine their current values, and then animate the difference?

And assuming that is true, how does the animation of the CenterXConstraints (i.e. the code on p. 154) work? Those are set to their final values at the beginning of the animateLabelTransitions() method, which as far as I can tell has not identified itself as “about to do an animation”…so why aren’t those immediately reflected? And if the answer to that is “because you have not called layoutIfNeeded()”, then why doesn’t the very first call to layoutIfNeeded() in the animations: code block just move them right to their final spot?

OK, this thread explains how it works for the animations: code block, or at least speculates enough to clear up the mystery: https://stackoverflow.com/questions/11467188/how-do-ios-animation-blocks-work.

Still have no idea how the CenterXConstrains changes wind up animated though–we are not in an “animation context” at the time they are set, are we? Or is the target method for a button considered to be executed in “animation context”?