Elastic spacing on cards

Hello! Here’s what I’m trying to prototype:

  • The boxes have a flexible (or elastic) spacing between them.

  • When I drag a box closer to another one, the spacing between them increases.

  • When I drag a box farther away, the spacing decreases.

I’d like the ability to control the amount of space between them based on how far I drag the box up or down.

Anyone know how to achieve this or any advice? Thank you in advance!