Here's how it works. The camera locks at the area highlighted in pink, and the boss starts whittling down the tree on the right side of the screen. Once he's done, he dashes off to the right, and the camera lock gives way.
When the camera reaches the cyan area on the right, all objects are shifted 512 pixels to the left, placing the camera at the cyan area on the left. The boss then stops over the middle tree, and the camera locks at the pink area again.
In act 2, although the camera starts off at the same position which it locks at during the act 1 boss, the developers had the foresight to extend the level layout a bit further to the left, in order to encompass the entire looping section of act 1. This way, even if the boss is defeated before the camera locks back at the pink area, the player will never accidentally spawn outside of the act 2 layout.
However, nothing prevents you from defeating the boss after the camera unlocks, but before it can reach the cyan area on the right. When that happens, you start act 2 further along than intended, which looks more than a little funky.
If you're playing as either Sonic or Tails, this is a good time to put the controller down and go take a break. Because the camera starts off at the wrong position, the Knuckles cutscene doesn't activate, which means you're effectively stuck in the intro area until time runs out.