[In Progress] `layer`.x calculated at start of animation

I’m creating a tab bar with an icon and an underline for the focused tab.

The icons animate to be shown when focused using opacity and scale responses.

The underline animates to the respective x and width of the focused tab.

What I’m noticing is that the underline is animating to the wrong position as the x position of the focused tab changes between the start and end of the animation (because of the changing width of the icon). For example, if tab 1 is focused and I tap on tab 2, because tab 1’s icon scales to 0px, tab 2’s final x position shifts to the left by 16px while the move response is pulling tab 2’s starting x position.

It would be easy enough to add a 16px offset, however if I’m moving from tab 3 to tab 2, tab 3’s icon animation doesn’t affect tab 2’s x position. So now I’m trying to figure out a set of variable assigns to set the starting and ending tabs and detect if the starting tab is to the left or right of the ending tab and adjusting the offset accordingly which is not something I should really be wasting my time doing.

So long story short, can someone fix this so that ProtoPie calculates the final x position of a layer?

tabs.mp4