Smooth camera size interpolation

I am trying to interpolate the camera size with this code:

// t counts between 0 and 1
cam.orthographicSize = Mathf.SmoothStep(cam.orthogaphicSize, CAMERA_DEFAULT_ZOOM * ZoomFactor, t);

The issue is that this does not produce a smooth result.
I think that is because I update orthographicSize and use it as the starting point for each iteration.

What is the proper way of interpolating with a moving start value ?

One option i thought of was to keep track of the orthographicSize at the moment of starting the interpolation. I am not sure that is the best approach.

I think you already figured this out. When interpolating, you don’t want to use the updated cam.orthographicSize with SmoothStep, you need to store a copy of the starting orthographicSize and use that for your first variable. “t” will determine where the camera is at this frame.

using UnityEngine;
using System.Collections;

public class SmoothCameraSize : MonoBehaviour 
public Camera interpolateCam;

private float startingSize;
private float endSize;
private float t = 0;

private void Awake()
	startingSize = interpolateCam.orthographicSize;
	endSize = startingSize * 2;

private void Update()
	t += Time.deltaTime;
	interpolateCam.orthographicSize = Mathf.SmoothStep(startingSize, endSize, t);