Hi Steven. Here is the explanation.
zeroPos is the vertical position where you start your vertical animation.
zeroPos – P is the difference between the starting point and the current point of the other bar.
We add these and we get the position of the second bar relative to the first one.
If the first one was going up, zeroPos – P was positiove, and so the position of the second would increase. If the first one was going down, zeroPos – P was negative, and the position of the second would decrease. We just added to zeroPos the difference. If the mirror axes would have been zero, this expression would have been just -P.