Controlling the shape of a quantum wavefunction