Trapped-ion Fock-state preparation by potential deformation