How to slerp two objects

I am trying to swap two objects: origin and target. The colliders are taken from hitInfo when I raycast. I can’t seem to figure it out properly even after following the posts on the forum.

When I change the translationTime = 30f, the Debug.Log at the bottom still instantly shows that the position are changed, even though there is no different on the game preview scene (i.e. the object did not move).

This is not called within the Update(). How do you use slerp to move an object?

   public void animSwapTile(Collider origin, Collider target){
		float translationTime = 30f;
		float timer = 0f;
		Vector3 posA = origin.transform.localPosition;
		Vector3 posB = target.transform.localPosition;
		while(timer < translationTime){
			Vector3 center = posA + posB * 0.5f;
			center -= new Vector3(0f, 1f, 0f);
			Vector3 partA = posA - center;
			Vector3 partB = posB - center;
			posA = Vector3.Slerp(partA, partB, timer/translationTime);
			timer += Time.deltaTime;	
		if(timer >= translationTime){
			posA = posB;	
			Debug.Log(posA + ", " + posB);

Ugh. Why is this not in Update? That while loop is going to fail you unless there is a yield of some sort in there. Just use Update. Or FixedUpdate.