Change the shape of an object programmatically

Hello there.
I want to make a mechanic in which the player can use the mouse to control the shape of an object (arbitrarily to stretch / compress). The object can be a 2d sprite or a mesh.
Please tell me which way to dig.
Thanks.