I am not totally sure i know what you mean about "create extension"
I have made a small example of how it could be done..capx
Everytime you drag one of the balls into another ball both of the balls will shrink 25% in size.
its a function call. So if you want it to be something else just alter the parameter going in to the function.
Was that what you were looking for?