smoothly deform a sphere using lerp

I want to deform smoothly my sphere when I stop pressing on a “S” key,
Here the code I used :

		Mesh mesh = GetComponent<MeshFilter>().mesh;
		Vector3[] vertices = mesh.vertices;
	void Update () {
		if (Input.GetKeyUp (KeyCode.S)) {
			for (var i = 0; i < vertices.Length; i++)
				vertices <em>= Vector3.Lerp(vertices<em>, new Vector3(vertices<em>.x * 1.5f,vertices<em>.y * 0.5f,vertices_.z * 1.5f),0.5f);_</em></em></em></em>

* mesh.vertices = vertices;*
* mesh.RecalculateBounds();*
* }*
}
I guess that Lerping many array elements simultaneously is trickier than this. Thank you for helping
But it seems that lerp has no effect the sphere is deformed brutally

The problem is that since you are performing this task in Update you are directly getting the end result of the for loop at once and then applying the final position of vertices to your mesh.

You can use a coroutine for doing this like:

void Update () {
    if (Input.GetKeyUp (KeyCode.S)) {
        StartCoroutine("DeformSphere"); // We use coroutine since we want this to happen multiple frames and KeyUp occurs in one frame only.
    }
}

IEnumerator DeforrmSphere()
{
             for (var i = 0; i < vertices.Length; i++) {
                 vertices <em>= Vector3.Lerp(vertices<em>, new Vector3(vertices<em>.x * 1.5f,vertices<em>.y * 0.5f,vertices_.z * 1.5f),0.5f);_</em></em></em></em>

mesh.vertices = vertices;
mesh.RecalculateBounds();
}
yield return null;
}
Also use a condition in your coroutine to stop it executing based on that condition