Group of Squares: one gets bigger, others get small?

Hi, im wondering what that effect is called or how to achieve it where let’s say i have 6 squares, 3 on top, 3 on the bottom(2x3 matrix)

and where if i click one, it gets bigger, and all the other ones get smaller. the problem here is the how they get bigger.

if i click the middle square in the top row, it should stay in it’s position and grow where as if i click the bottom right one, it should grow towards the far left side.

hope that explains what im looking to do?

I’m guessing the registration point needs to be changed dynamically?

thanks.